diff --git a/components/boldsign/boldsign.app.mjs b/components/boldsign/boldsign.app.mjs index f479e938d5613..e3c1b11cb2149 100644 --- a/components/boldsign/boldsign.app.mjs +++ b/components/boldsign/boldsign.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/callerapi/callerapi.app.mjs b/components/callerapi/callerapi.app.mjs index 725326a4da3d0..8fa151ce9331b 100644 --- a/components/callerapi/callerapi.app.mjs +++ b/components/callerapi/callerapi.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/calllerapi/calllerapi.app.mjs b/components/calllerapi/calllerapi.app.mjs index 96154a136ac76..cf89b869907a9 100644 --- a/components/calllerapi/calllerapi.app.mjs +++ b/components/calllerapi/calllerapi.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/packages/connect-react/CHANGELOG.md b/packages/connect-react/CHANGELOG.md index 288a41af258bc..e59e25cbe6a9a 100644 --- a/packages/connect-react/CHANGELOG.md +++ b/packages/connect-react/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog +# [1.0.0-preview.13] - 2024-12-17 + +- Added skippable prop types to support triggers + # [1.0.0-preview.12] - 2024-12-13 - Don't throw when validating unexpected values from the api diff --git a/packages/connect-react/package.json b/packages/connect-react/package.json index 661bad4b1aef9..3e68e075c80e9 100644 --- a/packages/connect-react/package.json +++ b/packages/connect-react/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/connect-react", - "version": "1.0.0-preview.12", + "version": "1.0.0-preview.13", "description": "Pipedream Connect library for React", "files": [ "dist" diff --git a/packages/connect-react/src/components/Control.tsx b/packages/connect-react/src/components/Control.tsx index ba1c0ecddcc31..23007e459a417 100644 --- a/packages/connect-react/src/components/Control.tsx +++ b/packages/connect-react/src/components/Control.tsx @@ -1,6 +1,9 @@ import { FormContext } from "../hooks/form-context"; import { FormFieldContext } from "../hooks/form-field-context"; -import { ConfigurableProp, ConfigurableProps } from "@pipedream/sdk"; +import { + ConfigurableProp, + ConfigurableProps, +} from "@pipedream/sdk"; // import { ControlAny } from "./ControlAny" import { ControlApp } from "./ControlApp"; import { ControlBoolean } from "./ControlBoolean"; diff --git a/packages/connect-react/src/components/InternalComponentForm.tsx b/packages/connect-react/src/components/InternalComponentForm.tsx index 7e22498929faa..e890b79adc869 100644 --- a/packages/connect-react/src/components/InternalComponentForm.tsx +++ b/packages/connect-react/src/components/InternalComponentForm.tsx @@ -3,7 +3,10 @@ import type { CSSProperties, FormEventHandler, } from "react"; import { useCustomize } from "../hooks/customization-context"; -import { useFormContext } from "../hooks/form-context"; +import { + useFormContext, + skippablePropTypes, +} from "../hooks/form-context"; import { InternalField } from "./InternalField"; import { Alert } from "./Alert"; import { ErrorBoundary } from "./ErrorBoundary"; @@ -73,6 +76,9 @@ export function InternalComponentForm() { if (prop.hidden) { continue; } + if (skippablePropTypes.includes(prop.type)) { + continue; + } if (prop.optional) { const enabled = optionalPropIsEnabled(prop); optionalProps.push([ diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index 292be68c579d6..c506617e2124b 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -38,6 +38,13 @@ export type FormContext = { userId: string; }; +export const skippablePropTypes = [ + "$.service.db", + "$.interface.http", + "$.interface.apphook", + "$.interface.timer", // TODO add support for this (cron string and timers) +] + export const FormContext = createContext | undefined>(undefined); // eslint-disable-line @typescript-eslint/no-explicit-any export const useFormContext = () => { @@ -172,7 +179,7 @@ export const FormContextProvider = ({ // so can't rely on that base control form validation const propErrors = (prop: ConfigurableProp, value: unknown): string[] => { const errs: string[] = []; - if (prop.optional || prop.hidden || prop.disabled) return [] + if (prop.optional || prop.hidden || prop.disabled || skippablePropTypes.includes(prop.type)) return [] if (prop.type === "app") { const field = fields[prop.name] if (field) { @@ -247,6 +254,9 @@ export const FormContextProvider = ({ if (prop.hidden) { continue; } + if (skippablePropTypes.includes(prop.type)) { + continue; + } // if prop.optional and not shown, we skip and do on un-collapse if (prop.optional && !optionalPropIsEnabled(prop)) { continue; @@ -336,7 +346,7 @@ export const FormContextProvider = ({ const checkPropsNeedConfiguring = () => { const _propsNeedConfiguring = [] for (const prop of configurableProps) { - if (!prop || prop.optional || prop.hidden) continue + if (!prop || prop.optional || prop.hidden || skippablePropTypes.includes(prop.type)) continue const value = configuredProps[prop.name as keyof ConfiguredProps] const errors = propErrors(prop, value) if (errors.length) {