Enhance Activepieces automation flows with restore UI and publishing

- Add "Restore Defaults" dropdown to Automations page with confirmation
- Create flows in "Defaults" folder for organization
- Pre-populate trigger sample data when creating/restoring flows
- Auto-publish flows (lock and enable) after creation
- Fix email template context variables to match template tags
- Fix dark mode logo switching in Activepieces iframe
- Add iframe refresh on flow restore
- Auto-populate business context (name, email, phone, address) in emails

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-21 23:38:10 -05:00
parent ac3115a5a1
commit 7b380fa903
14 changed files with 786 additions and 149 deletions

View File

@@ -0,0 +1,35 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import * as activepiecesApi from '../api/activepieces';
export const activepiecesKeys = {
all: ['activepieces'] as const,
defaultFlows: () => [...activepiecesKeys.all, 'defaultFlows'] as const,
};
export const useDefaultFlows = () => {
return useQuery({
queryKey: activepiecesKeys.defaultFlows(),
queryFn: activepiecesApi.getDefaultFlows,
staleTime: 30 * 1000,
});
};
export const useRestoreFlow = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: activepiecesApi.restoreFlow,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: activepiecesKeys.defaultFlows() });
},
});
};
export const useRestoreAllFlows = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: activepiecesApi.restoreAllFlows,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: activepiecesKeys.defaultFlows() });
},
});
};