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:
35
frontend/src/hooks/useActivepieces.ts
Normal file
35
frontend/src/hooks/useActivepieces.ts
Normal 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() });
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user