diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/PromptUser.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/PromptUser.svelte new file mode 100644 index 0000000000..85d395e4f4 --- /dev/null +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/PromptUser.svelte @@ -0,0 +1,50 @@ + + +
+ 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 4a9640312d..90ce1607e4 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,5 +16,6 @@ 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 PromptUser } from "./PromptUser.svelte" export { default as OpenSidePanel } from "./OpenSidePanel.svelte" export { default as CloseSidePanel } from "./CloseSidePanel.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 521ad85f0a..7497990304 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json @@ -117,6 +117,11 @@ "component": "ShowNotification", "dependsOnFeature": "showNotificationAction" }, + { + "name": "Prompt User", + "type": "application", + "component": "PromptUser" + }, { "name": "Open Side Panel", "type": "application", diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index e471518285..06bc6f356a 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -327,6 +327,8 @@ const showNotificationHandler = action => { notificationStore.actions[type]?.(message, autoDismiss) } +const promptUserHandler = () => {} + const OpenSidePanelHandler = action => { const { id } = action.parameters if (id) { @@ -357,6 +359,7 @@ const handlerMap = { ["Export Data"]: exportDataHandler, ["Continue if / Stop if"]: continueIfHandler, ["Show Notification"]: showNotificationHandler, + ["Prompt User"]: promptUserHandler, ["Open Side Panel"]: OpenSidePanelHandler, ["Close Side Panel"]: CloseSidePanelHandler, } @@ -366,6 +369,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?", + ["Prompt User"]: "Are you sure you want to contiune?", } /** @@ -417,8 +421,12 @@ export const enrichButtonActions = (actions, context) => { return new Promise(resolve => { const defaultText = confirmTextMap[action["##eventHandlerType"]] const confirmText = action.parameters?.confirmText || defaultText + + const defaultTitleText = action["##eventHandlerType"] + const customTitleText = + action.parameters?.customTitleText || defaultTitleText confirmationStore.actions.showConfirmation( - action["##eventHandlerType"], + customTitleText, confirmText, async () => { // When confirmed, execute this action immediately, @@ -429,7 +437,7 @@ export const enrichButtonActions = (actions, context) => { buttonContext.push(result) const newContext = { ...context, actions: buttonContext } - // Enrich and call the next button action + // Enrich and call the next button action if there is more than one action remaining const next = enrichButtonActions( actions.slice(i + 1), newContext