|
1 | 1 | import type createActors from '@components/MultifactorAuthentication/machine/mfaActors'; |
2 | 2 | import mfaMachine from '@components/MultifactorAuthentication/machine/mfaMachine'; |
3 | | -import type {MfaContext, MfaEvent} from '@components/MultifactorAuthentication/machine/types'; |
| 3 | +import type {MfaContext} from '@components/MultifactorAuthentication/machine/types'; |
4 | 4 |
|
5 | 5 | import type {OutputFrom, StateValue} from 'xstate'; |
6 | 6 |
|
7 | 7 | import {createActor} from 'xstate'; |
8 | 8 |
|
9 | 9 | import createInitEvent from './flowFixtures'; |
10 | | -import {CHECK_LOCAL_CREDENTIALS_DONE_EVENT_TYPE, VALIDATE_DEVICE_DONE_EVENT_TYPE} from './flowPaths'; |
| 10 | +import {CHECK_LOCAL_CREDENTIALS_DONE_EVENT_TYPE, createActorDoneEvent, VALIDATE_DEVICE_DONE_EVENT_TYPE} from './flowPaths'; |
11 | 11 |
|
12 | 12 | type ValidateDeviceOutput = OutputFrom<ReturnType<typeof createActors>['validateDevice']>; |
13 | 13 | type CheckLocalCredentialsOutput = OutputFrom<ReturnType<typeof createActors>['checkLocalCredentials']>; |
@@ -46,18 +46,14 @@ function createActorAtState(value: StateValue, contextOverrides?: Partial<MfaCon |
46 | 46 | * Completes the invoked device-check actor by sending its done event carrying the given output. |
47 | 47 | */ |
48 | 48 | function sendValidateDeviceDone(actor: ReturnType<typeof createActorAtState>, output: ValidateDeviceOutput) { |
49 | | - // Framework actor events are not part of the application's MfaEvent union. |
50 | | - // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion |
51 | | - actor.send({type: VALIDATE_DEVICE_DONE_EVENT_TYPE, output} as unknown as MfaEvent); |
| 49 | + actor.send(createActorDoneEvent(VALIDATE_DEVICE_DONE_EVENT_TYPE, output)); |
52 | 50 | } |
53 | 51 |
|
54 | 52 | /** |
55 | 53 | * Completes the invoked credentials-check actor by sending its done event carrying the given output. |
56 | 54 | */ |
57 | 55 | function sendCheckLocalCredentialsDone(actor: ReturnType<typeof createActorAtState>, output: CheckLocalCredentialsOutput) { |
58 | | - // Framework actor events are not part of the application's MfaEvent union. |
59 | | - // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion |
60 | | - actor.send({type: CHECK_LOCAL_CREDENTIALS_DONE_EVENT_TYPE, output} as unknown as MfaEvent); |
| 56 | + actor.send(createActorDoneEvent(CHECK_LOCAL_CREDENTIALS_DONE_EVENT_TYPE, output)); |
61 | 57 | } |
62 | 58 |
|
63 | 59 | export {createActorAtState, createFlowContext, sendCheckLocalCredentialsDone, sendValidateDeviceDone}; |
0 commit comments