import type { XOTemplateAction } from "@xo-cash/types"; import { TransactionWizardFlow } from "./TransactionWizardFlow.js"; import { DataWizardFlow } from "./DataWizardFlow.js"; import type { WizardFlow } from "./WizardFlow.js"; export { WizardFlow } from "./WizardFlow.js"; export { TransactionWizardFlow } from "./TransactionWizardFlow.js"; export { DataWizardFlow } from "./DataWizardFlow.js"; /** * Inspect a template action and return the appropriate wizard flow strategy. * * Actions with `data` fields and no `transaction` are data-only flows. * Everything else uses the transaction flow. */ export function createWizardFlow(action: XOTemplateAction): WizardFlow { if (action.data?.length && !action.transaction) { return new DataWizardFlow([action.data]); } return new TransactionWizardFlow(); }