From 301761956530b7261f5805622623e47bc820e292 Mon Sep 17 00:00:00 2001 From: Dave Date: Thu, 28 May 2026 14:24:06 -0400 Subject: [PATCH] feature/IO-3725-RPS-Changes - Deprecations / Bug fixes --- src/util/antdFeedback.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/util/antdFeedback.js diff --git a/src/util/antdFeedback.js b/src/util/antdFeedback.js new file mode 100644 index 0000000..9b2cdd5 --- /dev/null +++ b/src/util/antdFeedback.js @@ -0,0 +1,24 @@ +import { message as staticMessage, notification as staticNotification } from "antd"; + +let messageApi = staticMessage; +let notificationApi = staticNotification; + +const createApiProxy = (getApi) => + new Proxy( + {}, + { + get(_target, prop) { + const api = getApi(); + const value = api[prop]; + return typeof value === "function" ? value.bind(api) : value; + } + } + ); + +export const configureAntdFeedback = ({ message, notification }) => { + if (message) messageApi = message; + if (notification) notificationApi = notification; +}; + +export const antdMessage = createApiProxy(() => messageApi); +export const antdNotification = createApiProxy(() => notificationApi);