Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Inji 388] : Error message in QR login #1050

Merged
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
5 changes: 4 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,10 @@
"cancel": "Cancel",
"essentialClaims": "Important Claims",
"voluntaryClaims": "Voluntary Claims",
"required": "It is necessary"
"required": "It is necessary",
"errors":{
"invalidQR": "QR code is invalid. Please try again!"
}
},
"ReceiveVcScreen": {
"header": "Card details",
Expand Down
21 changes: 16 additions & 5 deletions machines/QrLoginMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import i18n from '../i18n';
import {parseMetadatas, VCMetadata} from '../shared/VCMetadata';
import {
getEndEventData,
sendEndEvent
sendEndEvent,
} from '../shared/telemetry/TelemetryUtils';
import {TelemetryConstants} from '../shared/telemetry/TelemetryConstants';
import {API_URLS} from '../shared/api';
Expand Down Expand Up @@ -340,10 +340,21 @@ export const qrLoginMachine =
},

SetErrorMessage: assign({
errorMessage: (context, event) =>
i18n.t(`errors.genericError`, {
ns: 'common',
}),
errorMessage: (context, event) => {
const message = event.data.name;
const ID_ERRORS_MAP = {
invalid_link_code: 'invalidQR',
};
const errorMessage = ID_ERRORS_MAP[message]
? i18n.t(`errors.${ID_ERRORS_MAP[message]}`, {
ns: 'QrLogin',
})
: i18n.t(`errors.genericError`, {
ns: 'common',
});

return errorMessage;
},
}),

setConsentClaims: assign({
Expand Down
3 changes: 3 additions & 0 deletions shared/telemetry/TelemetryConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const TelemetryConstants = {
hardwareKeyStore:
'Some security features will be unavailable as hardware key store is not available',
activationCancelled: 'Activation Cancelled',
vcsAreTampered:
'Tampered cards detected and removed for security reasons. Please download again',
}),

ErrorId: Object.freeze({
Expand All @@ -40,6 +42,7 @@ export const TelemetryConstants = {
activationFailed: 'ACTIVATION_FAILED',
tampered: 'TAMPERED',
dataRetrieval: 'DATA_RETRIEVAL',
vcsAreTampered: 'VC_TAMPERED',
}),

Screens: Object.freeze({
Expand Down