Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import {
|
||||
QueryClient,
|
||||
useMutation,
|
||||
useSuspenseQuery,
|
||||
} from '@tanstack/react-query';
|
||||
import { t } from 'i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
import { authenticationSession } from '@/lib/authentication-session';
|
||||
import { PlatformWithoutSensitiveData } from '@activepieces/shared';
|
||||
|
||||
import { platformApi } from '../lib/platforms-api';
|
||||
|
||||
import { flagsHooks } from './flags-hooks';
|
||||
|
||||
export const platformHooks = {
|
||||
useDeleteAccount: () => {
|
||||
const navigate = useNavigate();
|
||||
return useMutation({
|
||||
mutationFn: async () => {
|
||||
await platformApi.deleteAccount();
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success(t('Account deleted successfully'));
|
||||
navigate('/sign-in');
|
||||
},
|
||||
});
|
||||
},
|
||||
useCurrentPlatform: () => {
|
||||
const currentPlatformId = authenticationSession.getPlatformId();
|
||||
const query = useSuspenseQuery({
|
||||
queryKey: ['platform', currentPlatformId],
|
||||
queryFn: platformApi.getCurrentPlatform,
|
||||
staleTime: Infinity,
|
||||
});
|
||||
return {
|
||||
platform: query.data,
|
||||
refetch: async () => {
|
||||
await query.refetch();
|
||||
},
|
||||
setCurrentPlatform: (
|
||||
queryClient: QueryClient,
|
||||
platform: PlatformWithoutSensitiveData,
|
||||
) => {
|
||||
queryClient.setQueryData(['platform', currentPlatformId], platform);
|
||||
},
|
||||
};
|
||||
},
|
||||
useUpdateLisenceKey: (queryClient: QueryClient) => {
|
||||
const currentPlatformId = authenticationSession.getPlatformId();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (tempLicenseKey: string) => {
|
||||
if (tempLicenseKey.trim() === '') return;
|
||||
await platformApi.verifyLicenseKey(tempLicenseKey.trim());
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['platform', currentPlatformId],
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: flagsHooks.queryKey,
|
||||
});
|
||||
toast.success(t('License activated successfully!'));
|
||||
},
|
||||
onError: () => {
|
||||
toast.error(t('Activation failed, invalid license key'));
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user