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 @@ -54,10 +54,10 @@ const AppendAfterErrorScreen = ({ attestationOptions }: { attestationOptions: st
case AppendSituationCode.CtApiNotAvailablePreAuthenticator:
case AppendSituationCode.CboApiNotAvailablePreAuthenticator:
case AppendSituationCode.CboApiNotAvailablePostAuthenticator:
void handleErrorHard(situationCode);
void handleErrorHard(situationCode, false);
break;
case AppendSituationCode.ClientPasskeyOperationCancelled:
void handleErrorSoft(situationCode);
void handleErrorSoft(situationCode, true);
break;
case AppendSituationCode.ClientExcludeCredentialsMatch:
void handleCredentialExistsError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ const AppendAfterHybridLoginScreen = ({ attestationOptions }: { attestationOptio
case AppendSituationCode.CtApiNotAvailablePreAuthenticator:
case AppendSituationCode.CboApiNotAvailablePreAuthenticator:
case AppendSituationCode.CboApiNotAvailablePostAuthenticator:
void handleErrorHard(situationCode);
void handleErrorHard(situationCode, false);
break;
case AppendSituationCode.ClientPasskeyOperationCancelled:
void handleErrorSoft(situationCode);
void handleErrorSoft(situationCode, true);
break;
case AppendSituationCode.ClientExcludeCredentialsMatch:
void handleCredentialExistsError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ const AppendInitScreen = () => {
case AppendSituationCode.CtApiNotAvailablePreAuthenticator:
case AppendSituationCode.CboApiNotAvailablePreAuthenticator:
case AppendSituationCode.CboApiNotAvailablePostAuthenticator:
void handleErrorHard(situationCode);
void handleErrorHard(situationCode, false);

statefulLoader.current.finishWithError();
break;
case AppendSituationCode.ClientPasskeyOperationCancelled:
void handleErrorSoft(situationCode);
void handleErrorSoft(situationCode, true);
setAppendLoading(false);
break;
case AppendSituationCode.ClientExcludeCredentialsMatch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const LoginErrorScreenHard = () => {
};

const handleSituation = (situationCode: LoginSituationCode) => {
log.debug(`situation: ${situationCode}`);
const messageCode = `situation: ${situationCode}`;
log.debug(messageCode);

const identifier = currentIdentifier;
const message = getLoginErrorMessage(situationCode);
Expand All @@ -58,21 +59,21 @@ const LoginErrorScreenHard = () => {
case LoginSituationCode.CboApiNotAvailablePostAuthenticator:
navigateToScreen(LoginScreenType.Invisible);
config.onFallback(identifier, message);
void getConnectService().recordEventLoginErrorUntyped();
void getConnectService().recordEventLoginErrorUnexpected(messageCode);

setLoading(false);
break;
case LoginSituationCode.ClientPasskeyOperationCancelledTooManyTimes:
navigateToScreen(LoginScreenType.Invisible);
config.onFallback(identifier, message);
void getConnectService().recordEventLoginError();
void getConnectService().recordEventLoginError(messageCode);

setLoading(false);
break;

case LoginSituationCode.ClientPasskeyOperationCancelled:
setHardErrorCount(hardErrorCount + 1);
void getConnectService().recordEventLoginError();
void getConnectService().recordEventLoginError(messageCode);

setLoading(false);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const LoginErrorScreenSoft = () => {
};

const handleSituation = (situationCode: LoginSituationCode) => {
log.debug(`situation: ${situationCode}`);
const messageCode = `situation: ${situationCode}`;
log.debug(messageCode);

const identifier = currentIdentifier;
const message = getLoginErrorMessage(situationCode);
Expand All @@ -52,14 +53,14 @@ const LoginErrorScreenSoft = () => {
case LoginSituationCode.CboApiNotAvailablePostAuthenticator:
navigateToScreen(LoginScreenType.Invisible);
config.onFallback(identifier, message);
void getConnectService().recordEventLoginErrorUntyped();
void getConnectService().recordEventLoginErrorUnexpected(messageCode);

setLoading(false);
break;
case LoginSituationCode.ClientPasskeyOperationCancelled:
navigateToScreen(LoginScreenType.ErrorHard);
config.onError?.(situationCode.toString());
void getConnectService().recordEventLoginError();
void getConnectService().recordEventLoginError(messageCode);

setLoading(false);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const LoginHybridScreen = (resStart: ConnectLoginStartRsp) => {
}, [getConnectService, config, navigateToScreen, currentIdentifier, loading]);

const handleSituation = (situationCode: LoginSituationCode) => {
log.debug(`situation: ${situationCode}`);
const messageCode = `situation: ${situationCode}`;
log.debug(messageCode);

const identifier = currentIdentifier;
const message = getLoginErrorMessage(situationCode);
Expand All @@ -47,14 +48,14 @@ const LoginHybridScreen = (resStart: ConnectLoginStartRsp) => {
case LoginSituationCode.CboApiNotAvailablePostAuthenticator:
navigateToScreen(LoginScreenType.Invisible);
config.onFallback(identifier, message);
void getConnectService().recordEventLoginErrorUntyped();
void getConnectService().recordEventLoginErrorUnexpected(messageCode);

setLoading(false);
break;
case LoginSituationCode.ClientPasskeyOperationCancelled:
navigateToScreen(LoginScreenType.ErrorSoft);
config.onError?.(situationCode.toString());
void getConnectService().recordEventLoginError();
void getConnectService().recordEventLoginError(messageCode);

setLoading(false);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ const LoginInitScreen: FC<Props> = ({ showFallback = false }) => {
return handleSituation(LoginSituationCode.ClientPasskeyConditionalOperationCancelled);
}

void getConnectService().recordEventLoginErrorUntyped();
// if a passkey has been deleted, CUI will fail => fallback with message
if (res.val instanceof ConnectConditionalUIPasskeyDeleted) {
return handleSituation(LoginSituationCode.PasskeyNotAvailablePostConditionalAuthenticator);
Expand Down Expand Up @@ -214,13 +213,15 @@ const LoginInitScreen: FC<Props> = ({ showFallback = false }) => {
};

const handleSituation = (situationCode: LoginSituationCode) => {
log.debug(`situation: ${situationCode}`);
const messageCode = `situation: ${situationCode}`;
log.debug(messageCode);

const message = getLoginErrorMessage(situationCode);

switch (situationCode) {
case LoginSituationCode.CboApiNotAvailablePreAuthenticator:
fallback(identifier, message);
void getConnectService().recordEventLoginErrorUnexpected(messageCode);

statefulLoader.current.finish();
break;
Expand All @@ -235,18 +236,20 @@ const LoginInitScreen: FC<Props> = ({ showFallback = false }) => {
case LoginSituationCode.CtApiNotAvailablePostAuthenticator:
case LoginSituationCode.CboApiNotAvailablePostAuthenticator:
fallback(identifier, message);
void getConnectService().recordEventLoginErrorUnexpected(messageCode);

setIdentifierBasedLoading(false);
break;
case LoginSituationCode.ClientPasskeyOperationCancelled:
navigateToScreen(LoginScreenType.ErrorSoft);
void getConnectService().recordEventLoginError();
void getConnectService().recordEventLoginError(messageCode);
config.onError?.(situationCode.toString());

setIdentifierBasedLoading(false);
break;
case LoginSituationCode.UserNotFound:
setError(message ?? '');
void getConnectService().recordEventLoginErrorUnexpected(messageCode);

setIdentifierBasedLoading(false);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export const LoginPasskeyReLoginScreen = () => {
};

const handleSituation = (situationCode: LoginSituationCode) => {
log.debug(`situation: ${situationCode}`);
const messageCode = `situation: ${situationCode}`;
log.debug(messageCode);

const identifier = currentIdentifier;
const message = getLoginErrorMessage(situationCode);
Expand All @@ -64,14 +65,14 @@ export const LoginPasskeyReLoginScreen = () => {
case LoginSituationCode.CboApiNotAvailablePreAuthenticator:
navigateToScreen(LoginScreenType.Invisible);
config.onFallback(identifier, message);
void getConnectService().recordEventLoginErrorUntyped();
void getConnectService().recordEventLoginErrorUnexpected(messageCode);

setLoading(false);
break;
case LoginSituationCode.ClientPasskeyOperationCancelled:
navigateToScreen(LoginScreenType.ErrorSoft);
config.onError?.(situationCode.toString());
void getConnectService().recordEventLoginError();
void getConnectService().recordEventLoginError(messageCode);

setLoading(false);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ const PasskeyListScreen = () => {
};

const handleSituation = (situationCode: PasskeyListSituationCode) => {
log.debug(`situation: ${situationCode}`);
const messageCode = `situation: ${situationCode}`;
log.debug(messageCode);

const message = getPasskeyListErrorMessage(situationCode);
switch (situationCode) {
Expand All @@ -188,13 +189,17 @@ const PasskeyListScreen = () => {
if (message) {
setErrorMessage(message);
}

void getConnectService().recordEventManageErrorUnexpected(messageCode);
break;
case PasskeyListSituationCode.CtApiNotAvailablePreDelete:
case PasskeyListSituationCode.CboApiNotAvailableDuringDelete:
hide();
if (message) {
setErrorMessage(message);
}

void getConnectService().recordEventManageErrorUnexpected(messageCode);
break;
case PasskeyListSituationCode.CtApiNotAvailablePreAuthenticator:
case PasskeyListSituationCode.CboApiNotAvailablePreAuthenticator:
Expand All @@ -205,6 +210,8 @@ const PasskeyListScreen = () => {
if (message) {
setErrorMessage(message);
}

void getConnectService().recordEventManageErrorUnexpected(messageCode);
}
};

Expand Down
4 changes: 2 additions & 2 deletions packages/connect-react/src/contexts/AppendProcessContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export interface AppendProcessContextProps {
currentScreenOptions: any;
config: CorbadoConnectAppendConfig;
navigateToScreen: (s: AppendScreenType, options?: any) => void;
handleErrorSoft: (situation: AppendSituationCode) => Promise<void>;
handleErrorHard: (situation: AppendSituationCode, explicit?: boolean) => Promise<void>;
handleErrorSoft: (situation: AppendSituationCode, expected: boolean) => Promise<void>;
handleErrorHard: (situation: AppendSituationCode, expected: boolean) => Promise<void>;
handleCredentialExistsError: () => Promise<void>;
handleSkip: (situation: AppendSituationCode, explicit?: boolean) => Promise<void>;
}
Expand Down
17 changes: 11 additions & 6 deletions packages/connect-react/src/contexts/AppendProcessProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,24 @@ export const AppendProcessProvider: FC<PropsWithChildren<Props>> = ({ children,
}, []);

const handleErrorSoft = useCallback(
async (situationCode: AppendSituationCode) => {
await getConnectService().recordEventAppendError();
async (situationCode: AppendSituationCode, expected: boolean) => {
if (expected) {
await getConnectService().recordEventAppendError();
} else {
await getConnectService().recordEventAppendErrorUnexpected(`situation: ${situationCode}`);
}

config.onError?.(situationCode.toString());
},
[getConnectService, config],
);

const handleErrorHard = useCallback(
async (situationCode: AppendSituationCode, explicit?: boolean) => {
if (explicit) {
await getConnectService().recordEventAppendExplicitAbort();
} else {
async (situationCode: AppendSituationCode, expected: boolean) => {
if (expected) {
await getConnectService().recordEventAppendError();
} else {
await getConnectService().recordEventAppendErrorUnexpected(`situation: ${situationCode}`);
}

config.onError?.(situationCode.toString());
Expand Down
4 changes: 3 additions & 1 deletion packages/web-core/openapi/spec_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,8 @@ components:
properties:
eventType:
$ref: '#/components/schemas/passkeyEventType'
message:
type: string
challenge:
type: string

Expand Down Expand Up @@ -1637,7 +1639,7 @@ components:

passkeyEventType:
type: string
enum: [ login-explicit-abort, login-error, login-error-untyped, login-one-tap-switch, user-append-after-cross-platform-blacklisted, user-append-after-login-error-blacklisted, append-credential-exists, append-explicit-abort, append-error ]
enum: [ login-explicit-abort, login-error, login-error-untyped, login-error-unexpected, login-one-tap-switch, user-append-after-cross-platform-blacklisted, user-append-after-login-error-blacklisted, append-credential-exists, append-explicit-abort, append-error, append-error-unexpected, manage-error-unexpected ]

blockType:
type: string
Expand Down
11 changes: 10 additions & 1 deletion packages/web-core/src/api/v2/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,12 @@ export interface ConnectEventCreateReq {
* @memberof ConnectEventCreateReq
*/
'eventType': PasskeyEventType;
/**
*
* @type {string}
* @memberof ConnectEventCreateReq
*/
'message'?: string;
/**
*
* @type {string}
Expand Down Expand Up @@ -1781,12 +1787,15 @@ export const PasskeyEventType = {
LoginExplicitAbort: 'login-explicit-abort',
LoginError: 'login-error',
LoginErrorUntyped: 'login-error-untyped',
LoginErrorUnexpected: 'login-error-unexpected',
LoginOneTapSwitch: 'login-one-tap-switch',
UserAppendAfterCrossPlatformBlacklisted: 'user-append-after-cross-platform-blacklisted',
UserAppendAfterLoginErrorBlacklisted: 'user-append-after-login-error-blacklisted',
AppendCredentialExists: 'append-credential-exists',
AppendExplicitAbort: 'append-explicit-abort',
AppendError: 'append-error'
AppendError: 'append-error',
AppendErrorUnexpected: 'append-error-unexpected',
ManageErrorUnexpected: 'manage-error-unexpected'
} as const;

export type PasskeyEventType = typeof PasskeyEventType[keyof typeof PasskeyEventType];
Expand Down
Loading
Loading