Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | 9x 11x 8x 2x 131x | import { ConnectionFlowOrigin } from '../types';
import { setKeyringResult, setReconnectingAccount } from './connection-data';
import {
CANCEL_CONNECTION_FLOW,
GO_TO_NEXT_CONNECTION_FLOW_STEP,
GO_TO_PREVIOUS_CONNECTION_FLOW_STEP,
SELECT_CONNECTION_FLOW_PLATFORM,
SET_CONNECTION_FLOW_INPUT,
START_CONNECTION_FLOW,
} from './constants';
/**
* Starts the connection flow at the platform picker.
*
* @param options - Options.
* @param options.origin - Where the flow was started from.
*
* @return An action object.
*/
export function startConnectionFlow( { origin }: { origin: ConnectionFlowOrigin } ) {
return {
type: START_CONNECTION_FLOW,
origin,
};
}
/**
* Selects a platform and advances to its first connect step.
*
* @param serviceId - The selected service ID.
*
* @return An action object.
*/
export function selectPlatform( serviceId: string ) {
return {
type: SELECT_CONNECTION_FLOW_PLATFORM,
serviceId,
};
}
/**
* Goes back to the previous step. No-op past the OAuth boundary (`confirm`,
* `creating`) and at the first step.
*
* @return An action object.
*/
export function goToPreviousStep() {
return {
type: GO_TO_PREVIOUS_CONNECTION_FLOW_STEP,
};
}
/**
* Advances to the next step. Past the OAuth boundary the keyring result drives
* the transition instead.
*
* @return An action object.
*/
export function goToNextStep() {
return {
type: GO_TO_NEXT_CONNECTION_FLOW_STEP,
};
}
/**
* Records a connect input value, so it survives leaving the input step.
*
* @param field - The input name.
* @param value - The value entered.
*
* @return An action object.
*/
export function setConnectionFlowInput( field: string, value: string ) {
return {
type: SET_CONNECTION_FLOW_INPUT,
field,
value,
};
}
/**
* Cancels the connection flow, resetting the step and selection along with the
* keyring/reconnect state that feeds the flow's derived steps.
*
* @return A thunk.
*/
export function cancelConnectionFlow() {
return function ( { dispatch } ) {
dispatch( setKeyringResult( undefined ) );
dispatch( setReconnectingAccount( undefined ) );
dispatch( { type: CANCEL_CONNECTION_FLOW } );
};
}
|