diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/QuestionPrompt.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/QuestionPrompt.svelte new file mode 100644 index 0000000000..439a309db9 --- /dev/null +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/QuestionPrompt.svelte @@ -0,0 +1,49 @@ + + +
+ Enter the message you wish to display to the user. +
+ + +
+
+ + diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js index 1ecd8f474a..f65a558a58 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js @@ -16,3 +16,4 @@ export { default as ExportData } from "./ExportData.svelte" export { default as ContinueIf } from "./ContinueIf.svelte" export { default as UpdateFieldValue } from "./UpdateFieldValue.svelte" export { default as ShowNotification } from "./ShowNotification.svelte" +export { default as QuestionPrompt } from "./QuestionPrompt.svelte" diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json index 5d11a27636..b66aa899cc 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json @@ -116,6 +116,11 @@ "type": "application", "component": "ShowNotification", "dependsOnFeature": "showNotificationAction" + }, + { + "name": "Question", + "type": "application", + "component": "QuestionPrompt" } ] } \ No newline at end of file diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index 6fcef37182..a5107eeb40 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -312,6 +312,10 @@ const showNotificationHandler = action => { notificationStore.actions[type]?.(message, autoDismiss) } +const questionHandler = action => { + return +} + const handlerMap = { ["Save Row"]: saveRowHandler, ["Duplicate Row"]: duplicateRowHandler, @@ -331,6 +335,7 @@ const handlerMap = { ["Export Data"]: exportDataHandler, ["Continue if / Stop if"]: continueIfHandler, ["Show Notification"]: showNotificationHandler, + ["Question"]: questionHandler, } const confirmTextMap = { @@ -338,6 +343,7 @@ const confirmTextMap = { ["Save Row"]: "Are you sure you want to save this row?", ["Execute Query"]: "Are you sure you want to execute this query?", ["Trigger Automation"]: "Are you sure you want to trigger this automation?", + ["Question"]: "Are you sure you want to contiune?", } /** @@ -401,12 +407,14 @@ export const enrichButtonActions = (actions, context) => { buttonContext.push(result) const newContext = { ...context, actions: buttonContext } - // Enrich and call the next button action - const next = enrichButtonActions( - actions.slice(i + 1), - newContext - ) - resolve(await next()) + // Enrich and call the next button action if there is more than one action remaining + if (actions.length > 1) { + const next = enrichButtonActions( + actions.slice(i + 1), + newContext + ) + resolve(await next()) + } } else { resolve(false) }