@trackunit/react-core-contexts 1.9.152 → 1.9.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -237,7 +237,29 @@ const ManagerApolloProvider = ({ children }) => {
237
237
  * This is a provider for the ToastContext.
238
238
  */
239
239
  const ToastProviderIrisApp = ({ children }) => {
240
- const value = react.useMemo(() => ({ addToast: irisAppRuntimeCore.ToastRuntime.addToast, removeToast: irisAppRuntimeCore.ToastRuntime.removeToast }), []);
240
+ const value = react.useMemo(() => ({
241
+ addToast: async (toast) => {
242
+ const response = await irisAppRuntimeCore.ToastRuntime.addToast({
243
+ ...toast,
244
+ primaryAction: toast.primaryAction?.label,
245
+ secondaryAction: toast.secondaryAction?.label,
246
+ link: toast.link?.label,
247
+ });
248
+ switch (response) {
249
+ case "primaryAction":
250
+ toast.primaryAction?.onClick?.();
251
+ break;
252
+ case "secondaryAction":
253
+ toast.secondaryAction?.onClick?.();
254
+ break;
255
+ case "link":
256
+ toast.link?.onClick?.();
257
+ break;
258
+ }
259
+ return response;
260
+ },
261
+ removeToast: irisAppRuntimeCore.ToastRuntime.removeToast,
262
+ }), []);
241
263
  return jsxRuntime.jsx(reactCoreContextsApi.ToastProvider, { value: value, children: children });
242
264
  };
243
265
 
package/index.esm.js CHANGED
@@ -235,7 +235,29 @@ const ManagerApolloProvider = ({ children }) => {
235
235
  * This is a provider for the ToastContext.
236
236
  */
237
237
  const ToastProviderIrisApp = ({ children }) => {
238
- const value = useMemo(() => ({ addToast: ToastRuntime.addToast, removeToast: ToastRuntime.removeToast }), []);
238
+ const value = useMemo(() => ({
239
+ addToast: async (toast) => {
240
+ const response = await ToastRuntime.addToast({
241
+ ...toast,
242
+ primaryAction: toast.primaryAction?.label,
243
+ secondaryAction: toast.secondaryAction?.label,
244
+ link: toast.link?.label,
245
+ });
246
+ switch (response) {
247
+ case "primaryAction":
248
+ toast.primaryAction?.onClick?.();
249
+ break;
250
+ case "secondaryAction":
251
+ toast.secondaryAction?.onClick?.();
252
+ break;
253
+ case "link":
254
+ toast.link?.onClick?.();
255
+ break;
256
+ }
257
+ return response;
258
+ },
259
+ removeToast: ToastRuntime.removeToast,
260
+ }), []);
239
261
  return jsx(ToastProvider, { value: value, children: children });
240
262
  };
241
263
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "1.9.152",
3
+ "version": "1.9.157",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,16 +9,16 @@
9
9
  "dependencies": {
10
10
  "@apollo/client": "3.13.8",
11
11
  "react": "19.0.0",
12
- "@trackunit/iris-app-api": "1.10.3",
13
- "@trackunit/iris-app-runtime-core-api": "1.7.120",
14
- "@trackunit/react-core-hooks": "1.7.124",
15
- "@trackunit/i18n-library-translation": "1.7.131",
16
- "@trackunit/react-components": "1.10.86",
17
- "@trackunit/iris-app-runtime-core": "1.8.120",
12
+ "@trackunit/iris-app-api": "1.10.8",
13
+ "@trackunit/iris-app-runtime-core-api": "1.7.125",
14
+ "@trackunit/react-core-hooks": "1.7.129",
15
+ "@trackunit/i18n-library-translation": "1.7.136",
16
+ "@trackunit/react-components": "1.10.91",
17
+ "@trackunit/iris-app-runtime-core": "1.8.125",
18
18
  "graphql": "^16.10.0",
19
19
  "graphql-sse": "^2.5.4",
20
20
  "@js-temporal/polyfill": "^0.5.1",
21
- "@trackunit/react-core-contexts-api": "1.8.79"
21
+ "@trackunit/react-core-contexts-api": "1.8.84"
22
22
  },
23
23
  "module": "./index.esm.js",
24
24
  "main": "./index.cjs.js",