@scaleflex/widget-informer 4.3.0 → 4.4.0
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/CHANGELOG.md +8 -0
- package/package.json +5 -5
- package/lib/ErrorsModal/index.js +0 -32
- package/lib/Informer.styled.js +0 -61
- package/lib/InformerUI.js +0 -110
- package/lib/InformerUIDetails.js +0 -32
- package/lib/index.js +0 -78
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.4.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.1.0...v4.4.0) (2025-10-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @scaleflex/widget-informer
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [4.3.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.1.0...v4.3.0) (2025-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @scaleflex/widget-informer
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/widget-informer",
|
|
3
3
|
"description": "A notification and error pop-up bar for Scaleflex.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"style": "dist/style.min.css",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@scaleflex/ui": "^3.0.0-beta.11",
|
|
19
|
-
"@scaleflex/widget-common": "^4.
|
|
20
|
-
"@scaleflex/widget-icons": "^4.
|
|
21
|
-
"@scaleflex/widget-utils": "^4.
|
|
19
|
+
"@scaleflex/widget-common": "^4.4.0",
|
|
20
|
+
"@scaleflex/widget-icons": "^4.4.0",
|
|
21
|
+
"@scaleflex/widget-utils": "^4.4.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"react": "^19.0.0",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"react": ">=19.0.0",
|
|
31
31
|
"react-dom": ">=19.0.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "04b8ec545c4f10be89f5a44eed954acf8433360c"
|
|
34
34
|
}
|
package/lib/ErrorsModal/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Cross2, CopyOutline } from '@scaleflex/icons';
|
|
2
|
-
import Styled from '../Informer.styled';
|
|
3
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
var ErrorsModal = function ErrorsModal(_ref) {
|
|
5
|
-
var i18n = _ref.i18n,
|
|
6
|
-
isErrorsModalOpen = _ref.isErrorsModalOpen,
|
|
7
|
-
closeErrorsModal = _ref.closeErrorsModal,
|
|
8
|
-
displayedErrors = _ref.displayedErrors,
|
|
9
|
-
handleCopyErrors = _ref.handleCopyErrors;
|
|
10
|
-
return /*#__PURE__*/_jsxs(Styled.ErrorsModal, {
|
|
11
|
-
open: isErrorsModalOpen,
|
|
12
|
-
onClose: closeErrorsModal,
|
|
13
|
-
children: [/*#__PURE__*/_jsx(Styled.ErrorsModalTitle, {
|
|
14
|
-
onClose: closeErrorsModal,
|
|
15
|
-
primary: i18n('informerErrorsModalTitle')
|
|
16
|
-
}), /*#__PURE__*/_jsx(Styled.ErrorsModalContent, {
|
|
17
|
-
children: /*#__PURE__*/_jsxs(Styled.ErrorsWrapper, {
|
|
18
|
-
children: [(Array.isArray(displayedErrors) ? displayedErrors : []).map(function (error, index) {
|
|
19
|
-
return /*#__PURE__*/_jsxs(Styled.Detail, {
|
|
20
|
-
children: [/*#__PURE__*/_jsx(Cross2, {}), "\u201C", error, "\u201D"]
|
|
21
|
-
}, index);
|
|
22
|
-
}), /*#__PURE__*/_jsx(Styled.CopyButton, {
|
|
23
|
-
color: "link-secondary",
|
|
24
|
-
startIcon: /*#__PURE__*/_jsx(CopyOutline, {}),
|
|
25
|
-
onClick: handleCopyErrors,
|
|
26
|
-
children: i18n('informerErrorsModalCopyButton')
|
|
27
|
-
})]
|
|
28
|
-
})
|
|
29
|
-
})]
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
export default ErrorsModal;
|
package/lib/Informer.styled.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { FV, PC, PSH } from '@scaleflex/widget-common';
|
|
5
|
-
import { TooltipV2, ModalTitle, ModalContent, Modal, Button } from '@scaleflex/ui/core';
|
|
6
|
-
var InformerWrapper = styled.div(function (_ref) {
|
|
7
|
-
var isHidden = _ref.isHidden,
|
|
8
|
-
positionFixed = _ref.positionFixed,
|
|
9
|
-
theme = _ref.theme;
|
|
10
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: ", ";\n display: flex;\n justify-content: center;\n bottom: 40px;\n left: 50%;\n right: 0;\n z-index: 2000;\n width: fit-content;\n opacity: 1;\n transform: translateX(-50%);\n transition: all 300ms ease-in;\n background-color: ", ";\n visibility: visible; // we are using visibility to avoid any tabindex inside the div's children like button.\n\n ", ";\n\n .SfxButton-Label {\n font-size: 13px;\n }\n"])), positionFixed ? 'fixed' : 'absolute', theme.palette[PC.BackgroundStateless], isHidden && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n opacity: 0;\n transform: translate(-50%, 200px);\n visibility: hidden; // we are using visibility to avoid any tabindex inside the div's children like button.\n "]))));
|
|
11
|
-
});
|
|
12
|
-
var LabelsTooltip = styled(TooltipV2)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n background-color: ", ";\n box-shadow: ", ";\n padding-bottom: 0px;\n max-width: 276px;\n\n & + .SfxPopper-arrow::before {\n background: ", ";\n }\n"])), function (_ref2) {
|
|
13
|
-
var theme = _ref2.theme;
|
|
14
|
-
return theme.palette[PC.BackgroundStateless];
|
|
15
|
-
}, function (_ref3) {
|
|
16
|
-
var theme = _ref3.theme;
|
|
17
|
-
return theme.shadows[PSH.ShadowXl];
|
|
18
|
-
}, function (_ref4) {
|
|
19
|
-
var theme = _ref4.theme;
|
|
20
|
-
return theme.palette[PC.BackgroundStateless];
|
|
21
|
-
});
|
|
22
|
-
var ErrorsModal = styled(Modal)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 500px;\n max-width: 500px;\n z-index: 1800;\n"])));
|
|
23
|
-
var ErrorsModalTitle = styled(ModalTitle)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n text-align: center;\n\n .SfxModalTitle-LabelPrimary {\n ", "\n //TODO: fix issue of multiple passing props to modal title and label in Scaleflex/ui\n height: 35.12px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .SfxModalTitle-Close {\n top: 12px;\n right: 12px;\n }\n"])), function (_ref5) {
|
|
24
|
-
var theme = _ref5.theme;
|
|
25
|
-
return theme.typography.font[FV.LabelLargeUp];
|
|
26
|
-
});
|
|
27
|
-
var ErrorsModalContent = styled(ModalContent)(function (_ref6) {
|
|
28
|
-
var palette = _ref6.theme.palette;
|
|
29
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 24px;\n max-height: 536px;\n overflow-y: auto;\n\n &:hover {\n color: ", ";\n button {\n color: ", ";\n }\n }\n"])), function (_ref7) {
|
|
30
|
-
var palette = _ref7.theme.palette;
|
|
31
|
-
return palette[PC.AccentPrimaryHover];
|
|
32
|
-
}, function (_ref8) {
|
|
33
|
-
var palette = _ref8.theme.palette;
|
|
34
|
-
return palette[PC.AccentPrimaryHover];
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
var ErrorsWrapper = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: ", ";\n flex-direction: column;\n display: flex;\n padding: 12px;\n gap: 12px;\n"])), function (_ref9) {
|
|
38
|
-
var palette = _ref9.theme.palette;
|
|
39
|
-
return palette[PC.BackgroundBaseLight];
|
|
40
|
-
});
|
|
41
|
-
var Detail = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n gap: 8px;\n align-items: flex-start;\n ", ";\n\n > svg {\n margin-top: 4px;\n flex-shrink: 0;\n color: ", ";\n }\n"])), function (_ref10) {
|
|
42
|
-
var theme = _ref10.theme;
|
|
43
|
-
return theme.typography.font[FV.TextMedium];
|
|
44
|
-
}, function (_ref11) {
|
|
45
|
-
var palette = _ref11.theme.palette;
|
|
46
|
-
return palette[PC.Red];
|
|
47
|
-
});
|
|
48
|
-
var CopyButton = styled(Button)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n width: 100%;\n justify-content: flex-end;\n"])));
|
|
49
|
-
var DetailsButton = styled(Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-left: 2px;\n"])));
|
|
50
|
-
var Styled = {
|
|
51
|
-
InformerWrapper: InformerWrapper,
|
|
52
|
-
ErrorsModal: ErrorsModal,
|
|
53
|
-
ErrorsModalTitle: ErrorsModalTitle,
|
|
54
|
-
ErrorsModalContent: ErrorsModalContent,
|
|
55
|
-
ErrorsWrapper: ErrorsWrapper,
|
|
56
|
-
DetailsButton: DetailsButton,
|
|
57
|
-
Detail: Detail,
|
|
58
|
-
CopyButton: CopyButton,
|
|
59
|
-
LabelsTooltip: LabelsTooltip
|
|
60
|
-
};
|
|
61
|
-
export default Styled;
|
package/lib/InformerUI.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
-
import { useState } from 'react';
|
|
8
|
-
import { useSelector } from 'react-redux';
|
|
9
|
-
import { useCore } from '@scaleflex/widget-core/lib/hooks';
|
|
10
|
-
import copyText from '@scaleflex/widget-utils/lib/copyText';
|
|
11
|
-
import { PopupContent as Informer } from '@scaleflex/ui/core';
|
|
12
|
-
import { selectInfo } from '@scaleflex/widget-core/lib/slices/info.slice';
|
|
13
|
-
import Styled from './Informer.styled';
|
|
14
|
-
import ErrorsModal from './ErrorsModal';
|
|
15
|
-
import InformerUIDetails from './InformerUIDetails';
|
|
16
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
-
var timeoutId = null;
|
|
18
|
-
var InformerUI = function InformerUI(_ref) {
|
|
19
|
-
var i18n = _ref.i18n,
|
|
20
|
-
hideInfo = _ref.hideInfo;
|
|
21
|
-
var _useSelector = useSelector(selectInfo),
|
|
22
|
-
isHidden = _useSelector.isHidden,
|
|
23
|
-
type = _useSelector.type,
|
|
24
|
-
message = _useSelector.message,
|
|
25
|
-
details = _useSelector.details,
|
|
26
|
-
errors = _useSelector.errors;
|
|
27
|
-
var _useState = useState(null),
|
|
28
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
isVisibilityNotLocked = _useState2[0],
|
|
30
|
-
setIsVisibilityNotLocked = _useState2[1];
|
|
31
|
-
var _useState3 = useState(false),
|
|
32
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
-
isErrorsModalOpen = _useState4[0],
|
|
34
|
-
setIsErrorsModalOpen = _useState4[1];
|
|
35
|
-
var _useState5 = useState(errors),
|
|
36
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
37
|
-
displayedErrors = _useState6[0],
|
|
38
|
-
setDisplayedErrors = _useState6[1];
|
|
39
|
-
var _useCore = useCore(),
|
|
40
|
-
info = _useCore.info;
|
|
41
|
-
var handleCopyErrors = function handleCopyErrors() {
|
|
42
|
-
copyText({
|
|
43
|
-
text: errors,
|
|
44
|
-
i18n: i18n,
|
|
45
|
-
info: info,
|
|
46
|
-
successMsgI18nKey: 'informerErrorsModalSuccessCopyMsg'
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
var lockInformerVisibility = function lockInformerVisibility() {
|
|
50
|
-
if (isHidden && !timeoutId) return;
|
|
51
|
-
clearTimeout(timeoutId);
|
|
52
|
-
setIsVisibilityNotLocked(false);
|
|
53
|
-
};
|
|
54
|
-
var unLockInformerVisibility = function unLockInformerVisibility() {
|
|
55
|
-
if (isVisibilityNotLocked !== false) return;
|
|
56
|
-
// Giving it some more amount of time in-case the user needs to re-hover it again before hiding.
|
|
57
|
-
timeoutId = setTimeout(function () {
|
|
58
|
-
timeoutId = null;
|
|
59
|
-
setIsVisibilityNotLocked(null);
|
|
60
|
-
}, 250);
|
|
61
|
-
};
|
|
62
|
-
var onClose = function onClose() {
|
|
63
|
-
hideInfo();
|
|
64
|
-
if (isVisibilityNotLocked === false) {
|
|
65
|
-
setIsVisibilityNotLocked(null);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var closeErrorsModal = function closeErrorsModal() {
|
|
69
|
-
setIsErrorsModalOpen(false);
|
|
70
|
-
setDisplayedErrors(null);
|
|
71
|
-
};
|
|
72
|
-
var openErrorsModal = function openErrorsModal() {
|
|
73
|
-
setIsErrorsModalOpen(true);
|
|
74
|
-
setDisplayedErrors(errors);
|
|
75
|
-
hideInfo();
|
|
76
|
-
};
|
|
77
|
-
var renderMessage = function renderMessage() {
|
|
78
|
-
var hasDetails = details || errors;
|
|
79
|
-
return /*#__PURE__*/_jsxs("span", {
|
|
80
|
-
children: [message || details, hasDetails && /*#__PURE__*/_jsx(InformerUIDetails, {
|
|
81
|
-
details: details,
|
|
82
|
-
errors: errors,
|
|
83
|
-
i18n: i18n,
|
|
84
|
-
openErrorsModal: openErrorsModal
|
|
85
|
-
})]
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
89
|
-
children: [/*#__PURE__*/_jsx(Styled.InformerWrapper, {
|
|
90
|
-
isHidden: isVisibilityNotLocked !== null && isVisibilityNotLocked !== void 0 ? isVisibilityNotLocked : isHidden,
|
|
91
|
-
children: /*#__PURE__*/_jsx(Informer, {
|
|
92
|
-
status: type || 'info',
|
|
93
|
-
message: renderMessage(),
|
|
94
|
-
onClose: onClose,
|
|
95
|
-
onMouseOver: lockInformerVisibility,
|
|
96
|
-
onMouseLeave: unLockInformerVisibility,
|
|
97
|
-
onTouchStart: lockInformerVisibility,
|
|
98
|
-
onTouchCancel: unLockInformerVisibility,
|
|
99
|
-
onTouchEnd: unLockInformerVisibility
|
|
100
|
-
})
|
|
101
|
-
}), /*#__PURE__*/_jsx(ErrorsModal, {
|
|
102
|
-
i18n: i18n,
|
|
103
|
-
displayedErrors: displayedErrors,
|
|
104
|
-
isErrorsModalOpen: isErrorsModalOpen,
|
|
105
|
-
closeErrorsModal: closeErrorsModal,
|
|
106
|
-
handleCopyErrors: handleCopyErrors
|
|
107
|
-
})]
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
export default InformerUI;
|
package/lib/InformerUIDetails.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Styled from './Informer.styled';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
var renderDetailsButton = function renderDetailsButton(_ref) {
|
|
4
|
-
var onClick = _ref.onClick,
|
|
5
|
-
i18n = _ref.i18n;
|
|
6
|
-
return /*#__PURE__*/_jsx(Styled.DetailsButton, {
|
|
7
|
-
size: "sm",
|
|
8
|
-
color: "link-primary",
|
|
9
|
-
onClick: onClick,
|
|
10
|
-
children: i18n('informerSeeDetailsButtonLabel')
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var InformerUIDetails = function InformerUIDetails(_ref2) {
|
|
14
|
-
var details = _ref2.details,
|
|
15
|
-
errors = _ref2.errors,
|
|
16
|
-
i18n = _ref2.i18n,
|
|
17
|
-
openErrorsModal = _ref2.openErrorsModal;
|
|
18
|
-
if (Array.isArray(errors)) return renderDetailsButton({
|
|
19
|
-
i18n: i18n,
|
|
20
|
-
onClick: openErrorsModal
|
|
21
|
-
});
|
|
22
|
-
return /*#__PURE__*/_jsx(Styled.LabelsTooltip, {
|
|
23
|
-
arrow: true,
|
|
24
|
-
position: "top",
|
|
25
|
-
size: "md",
|
|
26
|
-
title: details,
|
|
27
|
-
children: renderDetailsButton({
|
|
28
|
-
i18n: i18n
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
export default InformerUIDetails;
|
package/lib/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
10
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
11
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
13
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
14
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
15
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
-
import { createElement } from 'react';
|
|
19
|
-
import { Plugin } from '@scaleflex/widget-core';
|
|
20
|
-
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
21
|
-
import InformerUI from './InformerUI';
|
|
22
|
-
// TODO: find a way to show version of the current plugin
|
|
23
|
-
// why solution below isn't good?
|
|
24
|
-
// first import doesn't work with webpack 5 as it was deprecated
|
|
25
|
-
// second import fixes webpack 5 issue as it was mentioned in their docs
|
|
26
|
-
// but it exposes our package.json to the client and it is mentioned as security rist in mutiple places
|
|
27
|
-
// https://github.com/axelpale/genversion
|
|
28
|
-
// https://stackoverflow.com/questions/64993118/error-should-not-import-the-named-export-version-imported-as-version
|
|
29
|
-
// https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code/10855054#10855054
|
|
30
|
-
// import { version } from '../package.json'
|
|
31
|
-
// import packageInfo from '../package.json'
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Informer
|
|
35
|
-
* Shows rad message bubbles
|
|
36
|
-
* used like this: `filerobot.info('hello world', 'info', 5000)`
|
|
37
|
-
* or for errors: `filerobot.info('Error uploading img.jpg', 'error', 5000)`
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
var Informer = /*#__PURE__*/function (_Plugin) {
|
|
41
|
-
// static VERSION = packageInfo.version
|
|
42
|
-
|
|
43
|
-
function Informer(filerobot) {
|
|
44
|
-
var _this;
|
|
45
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
46
|
-
_classCallCheck(this, Informer);
|
|
47
|
-
_this = _callSuper(this, Informer, [filerobot, opts]);
|
|
48
|
-
_defineProperty(_this, "render", function (props) {
|
|
49
|
-
var _this$filerobot = _this.filerobot,
|
|
50
|
-
i18n = _this$filerobot.i18n,
|
|
51
|
-
hideInfo = _this$filerobot.hideInfo;
|
|
52
|
-
return /*#__PURE__*/createElement(InformerUI, _objectSpread(_objectSpread({}, props), {}, {
|
|
53
|
-
i18n: i18n,
|
|
54
|
-
hideInfo: hideInfo
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
_this.type = 'progressindicator';
|
|
58
|
-
_this.id = opts.id || PLUGINS_IDS.INFORMER;
|
|
59
|
-
_this.title = 'Informer';
|
|
60
|
-
|
|
61
|
-
// set default options
|
|
62
|
-
var defaultOptions = {};
|
|
63
|
-
// merge default options with the ones set by user
|
|
64
|
-
_this.opts = _extends({}, defaultOptions, opts);
|
|
65
|
-
return _this;
|
|
66
|
-
}
|
|
67
|
-
_inherits(Informer, _Plugin);
|
|
68
|
-
return _createClass(Informer, [{
|
|
69
|
-
key: "install",
|
|
70
|
-
value: function install() {
|
|
71
|
-
var target = this.opts.target;
|
|
72
|
-
if (target) {
|
|
73
|
-
this.mount(target, this);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}]);
|
|
77
|
-
}(Plugin);
|
|
78
|
-
export { Informer as default };
|