@symply.io/basic-components 1.4.0-beta.3 → 1.4.0-beta.4
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.
@@ -12,10 +12,11 @@ var __assign = (this && this.__assign) || function () {
|
|
12
12
|
import { useState, useCallback } from "react";
|
13
13
|
function useInteractions() {
|
14
14
|
var ERROR_MESSAGE = "Internal Server Error";
|
15
|
+
var UNKNOWN_MESSAGE = "Unknown Message";
|
15
16
|
var _a = useState({
|
16
17
|
open: false,
|
17
|
-
message:
|
18
|
-
type: "
|
18
|
+
message: UNKNOWN_MESSAGE,
|
19
|
+
type: "error",
|
19
20
|
timeout: 3500
|
20
21
|
}), promptArgs = _a[0], setPromptArgs = _a[1];
|
21
22
|
var onHide = useCallback(function (_, reason) {
|
@@ -25,12 +26,12 @@ function useInteractions() {
|
|
25
26
|
setPromptArgs(function (args) { return (__assign(__assign({}, args), { open: false })); });
|
26
27
|
}, []);
|
27
28
|
var onShow = useCallback(function (args) {
|
28
|
-
var _a = args.message, message = _a === void 0 ?
|
29
|
+
var _a = args.message, message = _a === void 0 ? UNKNOWN_MESSAGE : _a, _b = args.type, type = _b === void 0 ? "error" : _b, _c = args.timeout, timeout = _c === void 0 ? 3500 : _c;
|
29
30
|
setPromptArgs({
|
30
|
-
open: true,
|
31
31
|
message: message === 400 ? ERROR_MESSAGE : message,
|
32
32
|
type: type,
|
33
|
-
timeout: timeout
|
33
|
+
timeout: timeout,
|
34
|
+
open: true
|
34
35
|
});
|
35
36
|
}, []);
|
36
37
|
return { promptArgs: promptArgs, onShow: onShow, onHide: onHide };
|