tek-wallet 0.0.417 → 0.0.421
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;
|
|
@@ -70,8 +70,8 @@ exports.initialRealtime = {
|
|
|
70
70
|
isConnected: false,
|
|
71
71
|
pushNotification: function () { },
|
|
72
72
|
};
|
|
73
|
-
function
|
|
74
|
-
return (0, jsx_runtime_1.jsx)(Slide_1.default, __assign({}, props, { direction: "
|
|
73
|
+
function GrowTransition(props) {
|
|
74
|
+
return (0, jsx_runtime_1.jsx)(Slide_1.default, __assign({}, props, { direction: "down" }));
|
|
75
75
|
}
|
|
76
76
|
exports.RealtimeContext = react_1.default.createContext(exports.initialRealtime);
|
|
77
77
|
function RealtimeProvider(_a) {
|
|
@@ -100,13 +100,23 @@ 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) {
|
|
105
|
+
return prev.map(function (n) { return (n.id === id ? __assign(__assign({}, n), { open: false }) : n); });
|
|
106
|
+
});
|
|
107
|
+
};
|
|
103
108
|
return ((0, jsx_runtime_1.jsxs)(exports.RealtimeContext.Provider, { value: {
|
|
104
109
|
isConnected: isConnected,
|
|
105
110
|
transaction: transaction,
|
|
106
111
|
pushNotification: pushNotification,
|
|
107
112
|
}, 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:
|
|
113
|
+
var _a, _b, _c, _d, _e, _f;
|
|
114
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Snackbar, { open: (_a = notification.open) !== null && _a !== void 0 ? _a : true, anchorOrigin: {
|
|
115
|
+
vertical: (_c = (_b = notification === null || notification === void 0 ? void 0 : notification.anchorOrigin) === null || _b === void 0 ? void 0 : _b.vertical) !== null && _c !== void 0 ? _c : "top",
|
|
116
|
+
horizontal: (_e = (_d = notification === null || notification === void 0 ? void 0 : notification.anchorOrigin) === null || _d === void 0 ? void 0 : _d.horizontal) !== null && _e !== void 0 ? _e : "right",
|
|
117
|
+
}, onClose: function () {
|
|
118
|
+
closeNotification(notification.id);
|
|
119
|
+
}, slots: { transition: GrowTransition }, message: notification.message, autoHideDuration: (_f = notification.duration) !== null && _f !== void 0 ? _f : 2000 }, notification.id));
|
|
110
120
|
}) })] }));
|
|
111
121
|
}
|
|
112
122
|
exports.default = RealtimeProvider;
|