tek-wallet 0.0.417 → 0.0.419
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.
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { RealtimeProviderDataType } from "./type";
|
|
3
|
-
import { VariantType } from "notistack";
|
|
4
3
|
export declare const initialRealtime: RealtimeProviderDataType;
|
|
5
|
-
export interface Notification {
|
|
6
|
-
message: string;
|
|
7
|
-
variant: VariantType;
|
|
8
|
-
}
|
|
9
4
|
export declare const RealtimeContext: React.Context<RealtimeProviderDataType>;
|
|
10
5
|
declare function RealtimeProvider({ children }: {
|
|
11
6
|
children: React.ReactNode;
|
|
@@ -100,13 +100,21 @@ function RealtimeProvider(_a) {
|
|
|
100
100
|
console.error("🚀 ~ TEK-WALLET: Error connecting to realtime", error);
|
|
101
101
|
}
|
|
102
102
|
}, [masterWallet]);
|
|
103
|
+
var closeNotification = function (id) {
|
|
104
|
+
setNotifications(function (prev) { return prev.filter(function (n) { return n.id !== id; }); });
|
|
105
|
+
};
|
|
103
106
|
return ((0, jsx_runtime_1.jsxs)(exports.RealtimeContext.Provider, { value: {
|
|
104
107
|
isConnected: isConnected,
|
|
105
108
|
transaction: transaction,
|
|
106
109
|
pushNotification: pushNotification,
|
|
107
110
|
}, children: [children, (0, jsx_runtime_1.jsx)(notistack_1.SnackbarProvider, { maxSnack: 2, children: notifications.map(function (notification) {
|
|
108
|
-
var _a;
|
|
109
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Snackbar, { open: true,
|
|
111
|
+
var _a, _b, _c, _d, _e;
|
|
112
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Snackbar, { open: true, anchorOrigin: {
|
|
113
|
+
vertical: (_b = (_a = notification === null || notification === void 0 ? void 0 : notification.anchorOrigin) === null || _a === void 0 ? void 0 : _a.vertical) !== null && _b !== void 0 ? _b : "top",
|
|
114
|
+
horizontal: (_d = (_c = notification === null || notification === void 0 ? void 0 : notification.anchorOrigin) === null || _c === void 0 ? void 0 : _c.horizontal) !== null && _d !== void 0 ? _d : "right",
|
|
115
|
+
}, onClose: function () {
|
|
116
|
+
closeNotification(notification.id);
|
|
117
|
+
}, slots: { transition: SlideTransition }, message: notification.message, autoHideDuration: (_e = notification.duration) !== null && _e !== void 0 ? _e : 2000 }, notification.id));
|
|
110
118
|
}) })] }));
|
|
111
119
|
}
|
|
112
120
|
exports.default = RealtimeProvider;
|