blob: d5edb4083aedccd18be7749cba0fe7996487b6a2 (
plain)
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
|
import type { Intent } from '@jet/environment/dispatching';
import { FlowAction } from '@jet-app/app-store/api/models';
export const FLOW_ACTION_KIND: FlowAction['$kind'] = 'flowAction';
/**
* Creates a FlowAction For a given destination.
*
* Note: this is only here temporarily as a convenience for the "web" client, to be used
* while the upstream `FlowAction` is represented as a class that needs to be constructed,
* so those details are abstracted away from our codebase. Once `FlowAction` has been
* migrated to a POJO, there should be a factory-function provided that we should leverage
* instead
*
* @param destination Destination of the `FlowAction`
*/
export function makeFlowAction(destination: Intent<unknown>): FlowAction {
const action = new FlowAction(
// This data is only used by the Jet app's `PageRouter` architecture, which is not
// relevant for us. We should safely be able to pass an arbitrary value here.
'page',
);
// The important part for the "web" client router: setting the `destination`
action.destination = destination;
return action;
}
|