feat: introduce singleton webhook URL
This commit is contained in:
@@ -166,12 +166,8 @@ export default function FlowStep(
|
||||
|
||||
const actionsOrTriggers: Array<ITrigger | IAction> =
|
||||
(isTrigger ? app?.triggers : app?.actions) || [];
|
||||
const substeps = React.useMemo(
|
||||
() =>
|
||||
actionsOrTriggers?.find(({ key }: ITrigger | IAction) => key === step.key)
|
||||
?.substeps || [],
|
||||
[actionsOrTriggers, step?.key]
|
||||
);
|
||||
const actionOrTrigger = actionsOrTriggers?.find(({ key }) => key === step.key);
|
||||
const substeps = actionOrTrigger?.substeps || [];
|
||||
|
||||
const handleChange = React.useCallback(({ step }: { step: IStep }) => {
|
||||
onChange(step);
|
||||
@@ -283,7 +279,7 @@ export default function FlowStep(
|
||||
step={step}
|
||||
/>
|
||||
|
||||
{substeps?.length > 0 &&
|
||||
{actionOrTrigger && substeps?.length > 0 &&
|
||||
substeps.map((substep: ISubstep, index: number) => (
|
||||
<React.Fragment key={`${substep?.name}-${index}`}>
|
||||
{substep.key === 'chooseConnection' && app && (
|
||||
@@ -308,6 +304,7 @@ export default function FlowStep(
|
||||
onSubmit={expandNextStep}
|
||||
onChange={handleChange}
|
||||
onContinue={onContinue}
|
||||
showWebhookUrl={'showWebhookUrl' in actionOrTrigger ? actionOrTrigger.showWebhookUrl : false}
|
||||
step={step}
|
||||
/>
|
||||
)}
|
||||
|
@@ -18,6 +18,7 @@ import type { IStep, ISubstep } from '@automatisch/types';
|
||||
type TestSubstepProps = {
|
||||
substep: ISubstep;
|
||||
expanded?: boolean;
|
||||
showWebhookUrl?: boolean;
|
||||
onExpand: () => void;
|
||||
onCollapse: () => void;
|
||||
onChange?: ({ step }: { step: IStep }) => void;
|
||||
@@ -52,6 +53,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
|
||||
onSubmit,
|
||||
onContinue,
|
||||
step,
|
||||
showWebhookUrl = false,
|
||||
} = props;
|
||||
|
||||
const formatMessage = useFormatMessage();
|
||||
@@ -119,7 +121,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{step.webhookUrl && (
|
||||
{step.webhookUrl && showWebhookUrl && (
|
||||
<WebhookUrlInfo webhookUrl={step.webhookUrl} sx={{ mb: 2 }} />
|
||||
)}
|
||||
|
||||
|
Reference in New Issue
Block a user