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:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,115 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { peekshotAuth } from '../../index';
import { projectId } from '../common/props';
import {
CreateScreenshotResponse,
GetScreenshotResponse,
} from '../common/types';
export const captureScreenshot = createAction({
auth: peekshotAuth,
name: 'captureScreenshot',
displayName: 'Capture Screenshot',
description: 'Captures Screenshot of a URL.',
props: {
projectId: projectId,
url: Property.ShortText({ displayName: 'Target URL', required: true }),
width: Property.ShortText({
displayName: 'Custom Screenshot Width',
required: false,
}),
height: Property.ShortText({
displayName: 'Custom Screenshot Height',
required: false,
}),
file_type: Property.StaticDropdown({
displayName: 'Image Format',
description: 'Output format for the screenshot.',
required: false,
options: {
disabled: false,
options: [
{ label: 'PNG', value: 'png' },
{ label: 'JPEG', value: 'jpeg' },
],
},
}),
inject_css: Property.LongText({
displayName: 'Custom CSS',
description: 'Custom CSS to apply.',
required: false,
}),
inject_js: Property.LongText({
displayName: 'Custom JavaScript',
description: 'Custom JavaScript to apply.',
required: false,
}),
full_page: Property.Checkbox({
displayName: 'Full Page?',
description: 'To capture the entire page.',
required: false,
}),
},
async run({ propsValue, auth }) {
const {
projectId,
url,
width,
height,
file_type,
full_page,
inject_css,
inject_js,
} = propsValue;
const res = await httpClient.sendRequest<CreateScreenshotResponse>({
method: HttpMethod.POST,
url: 'https://api.peekshot.com/api/v1/screenshots',
headers: {
'x-api-key': auth.secret_text as string,
'Content-Type': 'application/json',
},
body: {
project_id: projectId.toString(),
url,
width,
height,
inject_css,
inject_js,
file_type,
full_page: full_page ? 'true' : 'false',
},
});
// Handle error in initial response
if (!res.body || !res.body.data || !res.body.data.requestId) {
throw new Error('Failed to initiate screenshot request');
}
const requestId = res.body.data.requestId;
let status = res.body.status;
const timeoutAt = Date.now() + 5 * 60 * 1000;
while (status !== 'COMPLETE' && Date.now() < timeoutAt) {
await new Promise((resolve) => setTimeout(resolve, 5000)); // wait 5 seconds
const pollRes = await httpClient.sendRequest<GetScreenshotResponse>({
method: HttpMethod.GET,
url: `https://api.peekshot.com/api/v1/screenshots/${requestId}`,
headers: {
'x-api-key': auth.secret_text,
'Content-Type': 'application/json',
},
});
status = pollRes.body?.data?.status;
if (status === 'COMPLETE') {
return pollRes.body; // Screenshot is ready
}
}
throw new Error('Screenshot generation timed out or failed.');
},
});

View File

@@ -0,0 +1,53 @@
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { Property } from '@activepieces/pieces-framework';
import { ListProjectsResponse } from './types';
import { peekshotAuth } from '../..';
export const projectId = Property.Dropdown({
displayName: 'Project',
required: true,
refreshers: [],
auth: peekshotAuth,
options: async ({ auth }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Please connect your account first.',
options: [],
};
}
try {
const response = await httpClient.sendRequest<ListProjectsResponse>({
method: HttpMethod.GET,
url: 'https://api.peekshot.com/api/v1/projects',
headers: {
'x-api-key': auth.secret_text,
'Content-Type': 'application/json',
},
});
// Handle the specific API response format
const responseData = response.body;
if (responseData?.status === 'success' && responseData?.data?.projects) {
const projects = responseData.data.projects;
const projectOptions = projects.map((project) => ({
label: project.name,
value: project.id,
}));
return {
options: projectOptions,
};
}
return {
options: [],
};
} catch (error) {
return {
options: [],
};
}
},
});

View File

@@ -0,0 +1,27 @@
export interface ListProjectsResponse {
status: string;
message: string;
data: {
projects: Array<{ id: number; name: string }>;
};
}
export interface CreateScreenshotResponse {
status: string;
message: string;
data: {
url: string;
requestId: number;
};
}
export interface GetScreenshotResponse {
status: string;
message: string;
data: {
url: string;
id: number;
status:string
};
}