mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
Merge pull request #1090 from tw-mosip/inji-332
[INJI-332]: fix clearing of UIN/VID after retreiving it from AID
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
import {TelemetryConstants} from '../../../shared/telemetry/TelemetryConstants';
|
||||
|
||||
import {API_URLS} from '../../../shared/api';
|
||||
import {IndividualId} from '../../../shared/constants';
|
||||
|
||||
const model = createModel(
|
||||
{
|
||||
@@ -36,6 +37,10 @@ const model = createModel(
|
||||
},
|
||||
{
|
||||
events: {
|
||||
SET_INDIVIDUAL_ID: (individualId: IndividualId) => ({
|
||||
id: individualId.id,
|
||||
idType: individualId.idType,
|
||||
}),
|
||||
INPUT_ID: (id: string) => ({id}),
|
||||
INPUT_OTP: (otp: string) => ({otp}),
|
||||
RESEND_OTP: () => ({}),
|
||||
@@ -65,11 +70,9 @@ export const AddVcModalMachine =
|
||||
id: 'AddVcModal',
|
||||
initial: 'acceptingIdInput',
|
||||
on: {
|
||||
INPUT_ID: {
|
||||
actions: 'setId',
|
||||
},
|
||||
SELECT_ID_TYPE: {
|
||||
actions: ['clearIdError', 'setIdType'],
|
||||
SET_INDIVIDUAL_ID: {
|
||||
actions: ['clearIdError', 'clearId', 'setIdType', 'setId'],
|
||||
target: '#AddVcModal.acceptingIdInput.idle',
|
||||
},
|
||||
},
|
||||
states: {
|
||||
@@ -97,6 +100,9 @@ export const AddVcModalMachine =
|
||||
idle: {
|
||||
entry: 'focusInput',
|
||||
on: {
|
||||
SET_INDIVIDUAL_ID: {
|
||||
actions: ['clearIdError', 'clearId', 'setIdType', 'setId'],
|
||||
},
|
||||
INPUT_ID: {
|
||||
actions: 'setId',
|
||||
},
|
||||
@@ -216,7 +222,7 @@ export const AddVcModalMachine =
|
||||
cancelDownload: {
|
||||
on: {
|
||||
CANCEL: {
|
||||
actions: ['resetIdInputRef', 'forwardToParent'],
|
||||
actions: ['clearId', 'resetIdInputRef', 'forwardToParent'],
|
||||
},
|
||||
WAIT: {
|
||||
target: 'acceptingOtpInput',
|
||||
|
||||
@@ -43,9 +43,14 @@ export interface Typegen0 {
|
||||
services: never;
|
||||
};
|
||||
eventsCausingActions: {
|
||||
clearId: 'SELECT_ID_TYPE';
|
||||
clearIdError: 'INPUT_ID' | 'SELECT_ID_TYPE' | 'VALIDATE_INPUT';
|
||||
clearId: 'CANCEL' | 'SELECT_ID_TYPE' | 'SET_INDIVIDUAL_ID';
|
||||
clearIdError:
|
||||
| 'INPUT_ID'
|
||||
| 'SELECT_ID_TYPE'
|
||||
| 'SET_INDIVIDUAL_ID'
|
||||
| 'VALIDATE_INPUT';
|
||||
clearOtp:
|
||||
| 'SET_INDIVIDUAL_ID'
|
||||
| 'WAIT'
|
||||
| 'done.invoke.AddVcModal.acceptingIdInput.requestingOtp:invocation[0]'
|
||||
| 'error.platform.AddVcModal.acceptingOtpInput.resendOTP:invocation[0]'
|
||||
@@ -54,6 +59,7 @@ export interface Typegen0 {
|
||||
focusInput:
|
||||
| 'INPUT_ID'
|
||||
| 'SELECT_ID_TYPE'
|
||||
| 'SET_INDIVIDUAL_ID'
|
||||
| 'VALIDATE_INPUT'
|
||||
| 'error.platform.AddVcModal.acceptingIdInput.requestingOtp:invocation[0]'
|
||||
| 'error.platform.AddVcModal.acceptingOtpInput.resendOTP:invocation[0]'
|
||||
@@ -61,7 +67,7 @@ export interface Typegen0 {
|
||||
| 'xstate.after(100)#AddVcModal.acceptingIdInput.focusing';
|
||||
forwardToParent: 'CANCEL' | 'DISMISS';
|
||||
resetIdInputRef: 'CANCEL';
|
||||
setId: 'INPUT_ID';
|
||||
setId: 'INPUT_ID' | 'SET_INDIVIDUAL_ID';
|
||||
setIdBackendError:
|
||||
| 'error.platform.AddVcModal.acceptingIdInput.requestingOtp:invocation[0]'
|
||||
| 'error.platform.AddVcModal.acceptingOtpInput.resendOTP:invocation[0]'
|
||||
@@ -69,11 +75,12 @@ export interface Typegen0 {
|
||||
setIdErrorEmpty: 'VALIDATE_INPUT';
|
||||
setIdErrorWrongFormat: 'VALIDATE_INPUT';
|
||||
setIdInputRef: 'READY';
|
||||
setIdType: 'SELECT_ID_TYPE';
|
||||
setIdType: 'SELECT_ID_TYPE' | 'SET_INDIVIDUAL_ID';
|
||||
setOtp: 'INPUT_OTP';
|
||||
setOtpError: 'error.platform.AddVcModal.requestingCredential:invocation[0]';
|
||||
setRequestId: 'done.invoke.AddVcModal.requestingCredential:invocation[0]';
|
||||
setTransactionId:
|
||||
| 'SET_INDIVIDUAL_ID'
|
||||
| 'error.platform.AddVcModal.acceptingOtpInput.resendOTP:invocation[0]'
|
||||
| 'error.platform.AddVcModal.requestingCredential:invocation[0]'
|
||||
| 'xstate.init';
|
||||
|
||||
@@ -24,8 +24,7 @@ export const IdInputModal: React.FC<IdInputModalProps> = props => {
|
||||
const controller = useIdInputModal(props);
|
||||
|
||||
const setIndividualID = () => {
|
||||
controller.INPUT_ID(individualId.id);
|
||||
controller.SELECT_ID_TYPE(individualId.idType);
|
||||
controller.SET_INDIVIDUAL_ID(individualId);
|
||||
};
|
||||
|
||||
const dismissInput = () => {
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
selectIdType,
|
||||
} from './AddVcModalMachine';
|
||||
import {VcIdType} from '../../../types/VC/ExistingMosipVC/vc';
|
||||
import {IndividualId} from '../../../shared/constants';
|
||||
|
||||
export function useIdInputModal({service}: IdInputModalProps) {
|
||||
return {
|
||||
@@ -28,6 +29,8 @@ export function useIdInputModal({service}: IdInputModalProps) {
|
||||
isAcceptingOtpInput: useSelector(service, selectIsAcceptingOtpInput),
|
||||
isRequestingOtp: useSelector(service, selectIsRequestingOtp),
|
||||
|
||||
SET_INDIVIDUAL_ID: (individualId: IndividualId) =>
|
||||
service.send(AddVcModalEvents.SET_INDIVIDUAL_ID(individualId)),
|
||||
INPUT_ID: (id: string) => service.send(AddVcModalEvents.INPUT_ID(id)),
|
||||
SELECT_ID_TYPE: (selectedValue: VcIdType) =>
|
||||
service.send(AddVcModalEvents.SELECT_ID_TYPE(selectedValue)),
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
OtpVerificationModalProps,
|
||||
useOtpVerificationModal,
|
||||
} from './OtpVerificationModalController';
|
||||
import {isIOS} from '../../../shared/constants';
|
||||
import {GET_INDIVIDUAL_ID, isIOS} from '../../../shared/constants';
|
||||
|
||||
export const OtpVerificationModal: React.FC<
|
||||
OtpVerificationModalProps
|
||||
@@ -68,6 +68,11 @@ export const OtpVerificationModal: React.FC<
|
||||
props.onInputDone(otp);
|
||||
};
|
||||
|
||||
const handleRequestOTPCancel = () => {
|
||||
GET_INDIVIDUAL_ID({id: '', idType: 'UIN'});
|
||||
controller.CANCEL();
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
isVisible={props.isVisible}
|
||||
@@ -157,7 +162,7 @@ export const OtpVerificationModal: React.FC<
|
||||
testID="cancel"
|
||||
type="clear"
|
||||
title={t('confirmationDialog.cancel')}
|
||||
onPress={controller.CANCEL}
|
||||
onPress={handleRequestOTPCancel}
|
||||
/>
|
||||
</Column>
|
||||
</MessageOverlay>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Platform} from 'react-native';
|
||||
import {MIMOTO_HOST, ESIGNET_HOST, DEBUG_MODE} from 'react-native-dotenv';
|
||||
import {Argon2iConfig} from './commonUtil';
|
||||
import {VcIdType} from '../types/vc';
|
||||
import {VcIdType} from '../types/VC/ExistingMosipVC/vc';
|
||||
|
||||
export let MIMOTO_BASE_URL = MIMOTO_HOST;
|
||||
export let ESIGNET_BASE_URL = ESIGNET_HOST;
|
||||
|
||||
Reference in New Issue
Block a user