@@ -29,43 +29,23 @@ const LoopbackProbe: FunctionComponent<{ uischema: LoopbackProbeElement }> = ({
2929 } ,
3030} ) => {
3131 const widgetContext = useWidgetContext ( ) ;
32- const {
33- authClient,
34- pollingTransaction,
35- idxTransaction,
36- setIdxTransaction,
37- } = widgetContext ;
38-
39- // Use pollingTransaction if available to get latest challengeRequest during active polling
40- // Fall back to idxTransaction for initial state
41- const activeTransaction = pollingTransaction || idxTransaction ;
42-
43- // Extract fresh deviceChallengePayload from active transaction using same logic as transformer
44- // This ensures we respond to new challenges during continuous polling
45- const liveDeviceChallengePayload = activeTransaction ?. nextStep ?. name === 'device-challenge-poll'
46- ? activeTransaction . nextStep ?. relatesTo ?. value
47- // @ts -expect-error challenge is not defined on contextualData
48- : activeTransaction ?. nextStep ?. relatesTo ?. value ?. contextualData ?. challenge ?. value ;
49-
50- // Use static config from initial deviceChallengePayload (doesn't change during polling)
32+ const { authClient, idxTransaction, setIdxTransaction } = widgetContext ;
33+
5134 const probeTimeoutMillis : number = typeof deviceChallengePayload . probeTimeoutMillis === 'undefined'
5235 ? 100 : deviceChallengePayload . probeTimeoutMillis ;
5336 const ports : string [ ] = deviceChallengePayload . ports || [ ] ;
5437 const {
5538 domain,
5639 httpsDomain,
40+ challengeRequest,
5741 } = deviceChallengePayload ;
5842
59- // Get latest challengeRequest from live transaction, fall back to initial value
60- const challengeRequest = liveDeviceChallengePayload ?. challengeRequest
61- || deviceChallengePayload . challengeRequest ;
62-
6343 const submitHandler = async ( stepName : string ) => {
6444 const payload : IdxActionParams = {
6545 step : stepName ,
6646 } ;
67- if ( typeof activeTransaction ?. context . stateHandle !== 'undefined' ) {
68- payload . stateHandle = activeTransaction . context . stateHandle ;
47+ if ( typeof idxTransaction ?. context . stateHandle !== 'undefined' ) {
48+ payload . stateHandle = idxTransaction . context . stateHandle ;
6949 }
7050 const newTransaction = await authClient ?. idx . proceed ( payload ) ;
7151 setIdxTransaction ( newTransaction ) ;
@@ -78,8 +58,8 @@ const LoopbackProbe: FunctionComponent<{ uischema: LoopbackProbeElement }> = ({
7858 params,
7959 } ] ,
8060 } ;
81- if ( typeof activeTransaction ?. context . stateHandle !== 'undefined' ) {
82- payload . stateHandle = activeTransaction . context . stateHandle ;
61+ if ( typeof idxTransaction ?. context . stateHandle !== 'undefined' ) {
62+ payload . stateHandle = idxTransaction . context . stateHandle ;
8363 }
8464 const newTransaction = await authClient ?. idx . proceed ( payload ) ;
8565 setIdxTransaction ( newTransaction ) ;
0 commit comments