diff --git a/package.json b/package.json index 6533f2113..70588ce37 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "@glific/flow-editor", "license": "AGPL-3.0", "repository": "git://github.com/glific/floweditor.git", - "version": "1.13.9-2", - "description": "'Standalone flow editing tool designed for use within the RapidPro suite of messaging tools but can be adopted for use outside of that ecosystem.'", + "version": "1.13.9-3", + "description": "'Standalone flow editing tool designed for use within the Glific suite of messaging tools'", "browser": "umd/flow-editor.min.js", "unpkg": "umd/flow-editor.min.js", "homepage": "https://glific.org", diff --git a/src/components/flow/routers/webhook/WebhookRouterForm.tsx b/src/components/flow/routers/webhook/WebhookRouterForm.tsx index 0c55ec37b..6796ddd9e 100644 --- a/src/components/flow/routers/webhook/WebhookRouterForm.tsx +++ b/src/components/flow/routers/webhook/WebhookRouterForm.tsx @@ -208,10 +208,15 @@ export default class WebhookRouterForm extends React.Component< private handleSave(): void { // validate our url in case they haven't interacted - const valid = this.handleUpdate( - { url: this.state.url.value, resultName: this.state.resultName.value }, - true - ); + let valid = false; + if (this.state.method.value.name === 'FUNCTION') { + valid = this.handleUpdate({ resultName: this.state.resultName.value }, true); + } else { + valid = this.handleUpdate( + { url: this.state.url.value, resultName: this.state.resultName.value }, + true + ); + } if (valid) { this.props.updateRouter(stateToNode(this.props.nodeSettings, this.state)); @@ -325,9 +330,17 @@ export default class WebhookRouterForm extends React.Component<
{ + method === 'FUNCTION' + ? this.setState({ url: { value: url } }) + : this.handleUrlUpdate(url, name); + }} autocomplete={true} />
diff --git a/src/components/flow/routers/webhook/helpers.ts b/src/components/flow/routers/webhook/helpers.ts index f8f99d9e5..42b69cd33 100644 --- a/src/components/flow/routers/webhook/helpers.ts +++ b/src/components/flow/routers/webhook/helpers.ts @@ -15,7 +15,8 @@ export enum Methods { PUT = 'PUT', DELETE = 'DELETE', HEAD = 'HEAD', - PATCH = 'PATCH' + PATCH = 'PATCH', + FUNCTION = 'FUNCTION' } export interface MethodOption { @@ -35,10 +36,11 @@ export const GET_METHOD: MethodOption = { export const METHOD_OPTIONS: MethodOption[] = [ GET_METHOD, { value: Methods.POST, name: Methods.POST }, - { value: Methods.PUT, name: Methods.PUT }, - { value: Methods.DELETE, name: Methods.DELETE }, - { value: Methods.HEAD, name: Methods.HEAD }, - { value: Methods.PATCH, name: Methods.PATCH } + // { value: Methods.PUT, name: Methods.PUT }, + // { value: Methods.DELETE, name: Methods.DELETE }, // These methods are not needed currently + // { value: Methods.HEAD, name: Methods.HEAD }, + { value: Methods.PATCH, name: Methods.PATCH }, + { value: Methods.FUNCTION, name: Methods.FUNCTION } ]; export const getOriginalAction = (settings: NodeEditorSettings): CallWebhook => {