import { googleTriggerDefinitions as triggerDefinitions } from "@automate.ax/catalog/triggers/google" import { normalizeFormId } from "@automate.ax/integration-contracts/google-forms" import { createTrigger } from "../../../automation/create-trigger" import type { IntegrationAccountReference } from "../../../automation/integrations" export { GOOGLE_FORMS_FORM_CHANGED_EVENT_SCHEMA, GOOGLE_FORMS_NOTIFICATION_SCHEMA, } from "@automate.ax/integration-contracts/google-forms" /** Options for subscribing to Google Form content and settings changes. */ export interface OnGoogleFormChangedOptions { /** * Google account binding used to watch the form. * * Omitting this value uses the project's default Google account binding. */ account?: string | IntegrationAccountReference<"google"> /** Google Form ID or standard Forms URL. */ form: string } /** * Subscribes to changes to a form's content and settings. * * The signal exposes the current normalized form directly and preserves * provider notification metadata under `event`. * * @param options - Form and Google account selection. * @throws When the account selection is dynamic or belongs to another service. */ export const onGoogleFormChanged = createTrigger( triggerDefinitions.googleFormsFormChanged, (options: OnGoogleFormChangedOptions) => ({ account: options.account, formId: normalizeFormId(options.form), }), ) /** Options for subscribing to Google Form submissions. */ export interface OnGoogleFormResponseSubmittedOptions { /** * Google account binding used to watch the form. * * Omitting this value uses the project's default Google account binding. */ account?: string | IntegrationAccountReference<"google"> /** Google Form ID or standard Forms URL. */ form: string } /** * Subscribes to new and edited submissions for a Google Form. * * Google reports both first-time responses and respondent edits as response * submissions. The signal contains the fully normalized response. * * @param options - Form and Google account selection. * @throws When the account selection is dynamic or belongs to another service. */ export const onGoogleFormResponseSubmitted = createTrigger( triggerDefinitions.googleFormsResponseSubmitted, (options: OnGoogleFormResponseSubmittedOptions) => ({ account: options.account, formId: normalizeFormId(options.form), }), )