@bigbinary/neeto-molecules 1.12.1 → 1.13.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/dist/AdaptiveInput.js +84 -0
- package/dist/AdaptiveInput.js.map +1 -0
- package/dist/FloatingActionMenu.js +81 -94
- package/dist/FloatingActionMenu.js.map +1 -1
- package/dist/NeetoWidget.js +35 -45
- package/dist/NeetoWidget.js.map +1 -1
- package/dist/cjs/AdaptiveInput.js +94 -0
- package/dist/cjs/AdaptiveInput.js.map +1 -0
- package/dist/cjs/FloatingActionMenu.js +79 -92
- package/dist/cjs/FloatingActionMenu.js.map +1 -1
- package/dist/cjs/NeetoWidget.js +35 -45
- package/dist/cjs/NeetoWidget.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +10 -7
- package/types/AdaptiveInput.d.ts +51 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { _ as _defineProperty } from './defineProperty-549061a7.js';
|
|
2
|
+
import { _ as _extends } from './extends-093996c9.js';
|
|
3
|
+
import { _ as _objectWithoutProperties } from './objectWithoutProperties-a0edb288.js';
|
|
4
|
+
import React__default, { forwardRef } from 'react';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import { Textarea } from '@bigbinary/neetoui';
|
|
7
|
+
import { n } from './inject-css-c86de496.js';
|
|
8
|
+
import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
|
|
9
|
+
import { useField } from 'formik';
|
|
10
|
+
|
|
11
|
+
var css = ".neeto-molecules-adaptive-input textarea{resize:none}.neeto-molecules-adaptive-input .neeto-ui-input.neeto-ui-input--small{--neeto-ui-textarea-padding-x:8px;--neeto-ui-textarea-padding-y:4px}.neeto-molecules-adaptive-input .neeto-ui-input.neeto-ui-input--medium{--neeto-ui-textarea-padding-x:8px;--neeto-ui-textarea-padding-y:5px}.neeto-molecules-adaptive-input .neeto-ui-input.neeto-ui-input--large{--neeto-ui-textarea-padding-x:12px;--neeto-ui-textarea-padding-y:8px}.neeto-molecules-adaptive-input__suffix{bottom:0;position:absolute;right:0}";
|
|
12
|
+
n(css,{});
|
|
13
|
+
|
|
14
|
+
var _excluded$1 = ["label", "className", "size", "required", "disabled", "suffix"];
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
|
|
17
|
+
var SIZES = {
|
|
18
|
+
small: "small",
|
|
19
|
+
medium: "medium",
|
|
20
|
+
large: "large"
|
|
21
|
+
};
|
|
22
|
+
var AdaptiveInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
23
|
+
var _ref$label = _ref.label,
|
|
24
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
25
|
+
_ref$className = _ref.className,
|
|
26
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
27
|
+
_ref$size = _ref.size,
|
|
28
|
+
size = _ref$size === void 0 ? SIZES.medium : _ref$size,
|
|
29
|
+
_ref$required = _ref.required,
|
|
30
|
+
required = _ref$required === void 0 ? false : _ref$required,
|
|
31
|
+
_ref$disabled = _ref.disabled,
|
|
32
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
33
|
+
_ref$suffix = _ref.suffix,
|
|
34
|
+
suffix = _ref$suffix === void 0 ? null : _ref$suffix,
|
|
35
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
36
|
+
var handleFocus = function handleFocus(element) {
|
|
37
|
+
var end = element.value.length;
|
|
38
|
+
element.setSelectionRange(end, end);
|
|
39
|
+
};
|
|
40
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
41
|
+
var _otherProps$onSubmit;
|
|
42
|
+
if (event.key !== "Enter") return;
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
(_otherProps$onSubmit = otherProps.onSubmit) === null || _otherProps$onSubmit === void 0 ? void 0 : _otherProps$onSubmit.call(otherProps);
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
47
|
+
className: "relative w-full"
|
|
48
|
+
}, /*#__PURE__*/React__default.createElement(Textarea, _extends(_defineProperty(_defineProperty(_defineProperty({
|
|
49
|
+
disabled: disabled,
|
|
50
|
+
label: label,
|
|
51
|
+
ref: ref,
|
|
52
|
+
required: required,
|
|
53
|
+
size: size,
|
|
54
|
+
"data-cy": "neeto-molecules-adaptive-input",
|
|
55
|
+
"data-testid": "neeto-molecules-adaptive-input",
|
|
56
|
+
rows: 1
|
|
57
|
+
}, "size", "small"), "className", classnames("neeto-molecules-adaptive-input", {
|
|
58
|
+
"neeto-ui-input--disabled": !!disabled
|
|
59
|
+
}, className)), "onKeyDown", handleKeyDown), otherProps, {
|
|
60
|
+
onFocus: function onFocus(_ref2) {
|
|
61
|
+
var target = _ref2.target;
|
|
62
|
+
return handleFocus(target);
|
|
63
|
+
}
|
|
64
|
+
})), suffix && /*#__PURE__*/React__default.createElement("div", {
|
|
65
|
+
className: "neeto-molecules-adaptive-input__suffix"
|
|
66
|
+
}, suffix));
|
|
67
|
+
});
|
|
68
|
+
AdaptiveInput.displayName = "AdaptiveInput";
|
|
69
|
+
|
|
70
|
+
var _excluded = ["name"];
|
|
71
|
+
var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
72
|
+
var name = _ref.name,
|
|
73
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
74
|
+
var _useField = useField(name),
|
|
75
|
+
_useField2 = _slicedToArray(_useField, 2),
|
|
76
|
+
field = _useField2[0],
|
|
77
|
+
meta = _useField2[1];
|
|
78
|
+
return /*#__PURE__*/React__default.createElement(AdaptiveInput, _extends({}, field, {
|
|
79
|
+
error: meta.touched ? meta.error : ""
|
|
80
|
+
}, props));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { AdaptiveInput, FormikAdaptiveInput };
|
|
84
|
+
//# sourceMappingURL=AdaptiveInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdaptiveInput.js","sources":["../src/components/AdaptiveInput/AdaptiveInput.jsx","../src/components/AdaptiveInput/FormikAdaptiveInput.jsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { Textarea } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport \"./adaptiveInput.scss\";\n\n// eslint-disable-next-line @bigbinary/neeto/no-dangling-constants\nconst SIZES = { small: \"small\", medium: \"medium\", large: \"large\" };\n\nconst AdaptiveInput = forwardRef(\n (\n {\n label = \"\",\n className = \"\",\n size = SIZES.medium,\n required = false,\n disabled = false,\n suffix = null,\n ...otherProps\n },\n ref\n ) => {\n const handleFocus = element => {\n const end = element.value.length;\n element.setSelectionRange(end, end);\n };\n\n const handleKeyDown = event => {\n if (event.key !== \"Enter\") return;\n\n event.preventDefault();\n otherProps.onSubmit?.();\n };\n\n return (\n <div className=\"relative w-full\">\n <Textarea\n {...{ disabled, label, ref, required, size }}\n data-cy=\"neeto-molecules-adaptive-input\"\n data-testid=\"neeto-molecules-adaptive-input\"\n rows={1}\n size=\"small\"\n className={classnames(\n \"neeto-molecules-adaptive-input\",\n { \"neeto-ui-input--disabled\": !!disabled },\n className\n )}\n onKeyDown={handleKeyDown}\n {...otherProps}\n onFocus={({ target }) => handleFocus(target)}\n />\n {suffix && (\n <div className=\"neeto-molecules-adaptive-input__suffix\">{suffix}</div>\n )}\n </div>\n );\n }\n);\n\nAdaptiveInput.displayName = \"AdaptiveInput\";\n\nAdaptiveInput.propTypes = {\n /**\n * To provide additional classes to the component.\n */\n className: PropTypes.string,\n /**\n * To specify the text to be displayed above the input.\n */\n label: PropTypes.string,\n /**\n * To specify the size of the input field\n */\n size: PropTypes.oneOf(Object.values(SIZES)),\n /**\n * To specify whether the input field is required or not.\n */\n required: PropTypes.bool,\n /**\n * To specify whether the input field is disabled or not.\n */\n disabled: PropTypes.bool,\n /**\n * To specify the content to be added at the end of the input field.\n */\n suffix: PropTypes.node,\n};\n\nexport default AdaptiveInput;\n","import React from \"react\";\n\nimport { useField } from \"formik\";\n\nimport AdaptiveInput from \"./AdaptiveInput\";\n\nconst FormikAdaptiveInput = ({ name, ...props }) => {\n const [field, meta] = useField(name);\n\n return (\n <AdaptiveInput\n {...field}\n error={meta.touched ? meta.error : \"\"}\n {...props}\n />\n );\n};\n\nexport default FormikAdaptiveInput;\n"],"names":["SIZES","small","medium","large","AdaptiveInput","forwardRef","_ref","ref","_ref$label","label","_ref$className","className","_ref$size","size","_ref$required","required","_ref$disabled","disabled","_ref$suffix","suffix","otherProps","_objectWithoutProperties","_excluded","handleFocus","element","end","value","length","setSelectionRange","handleKeyDown","event","_otherProps$onSubmit","key","preventDefault","onSubmit","call","React","createElement","Textarea","_extends","_defineProperty","rows","classnames","onFocus","_ref2","target","displayName","FormikAdaptiveInput","name","props","_useField","useField","_useField2","_slicedToArray","field","meta","error","touched"],"mappings":";;;;;;;;;;;;;;;AAQA;AACA,IAAMA,KAAK,GAAG;AAAEC,EAAAA,KAAK,EAAE,OAAO;AAAEC,EAAAA,MAAM,EAAE,QAAQ;AAAEC,EAAAA,KAAK,EAAE,OAAA;AAAQ,CAAC,CAAA;AAE5DC,IAAAA,aAAa,gBAAGC,UAAU,CAC9B,UAAAC,IAAA,EAUEC,GAAG,EACA;AAAA,EAAA,IAAAC,UAAA,GAAAF,IAAA,CATDG,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,UAAA;IAAAE,cAAA,GAAAJ,IAAA,CACVK,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,cAAA;IAAAE,SAAA,GAAAN,IAAA,CACdO,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,KAAA,CAAA,GAAGZ,KAAK,CAACE,MAAM,GAAAU,SAAA;IAAAE,aAAA,GAAAR,IAAA,CACnBS,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA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AAA,CAACjC,aAAa,EAAAmC,QAAA,KACRe,KAAK,EAAA;IACTE,KAAK,EAAED,IAAI,CAACE,OAAO,GAAGF,IAAI,CAACC,KAAK,GAAG,EAAA;GAC/BP,EAAAA,KAAK,CACV,CAAC,CAAA;AAEN;;;;"}
|
|
@@ -8,12 +8,12 @@ import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
|
|
|
8
8
|
import { isNotPresent, isPresent, truncate, noop } from '@bigbinary/neeto-cist';
|
|
9
9
|
import useFetchNeetoApps from '@bigbinary/neeto-commons-frontend/react-utils/useFetchNeetoApps';
|
|
10
10
|
import { Profile } from '@bigbinary/neeto-team-members-frontend';
|
|
11
|
-
import { Typography, Input, Modal,
|
|
11
|
+
import { Typography, Input, Modal, Dropdown, Avatar } from '@bigbinary/neetoui';
|
|
12
12
|
import KeyboardShortcuts from './KeyboardShortcuts.js';
|
|
13
13
|
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
14
14
|
import { n } from './inject-css-c86de496.js';
|
|
15
15
|
import classnames from 'classnames';
|
|
16
|
-
import { NeetoIcon, Search,
|
|
16
|
+
import { NeetoIcon, Search, Right, Book, Help } from '@bigbinary/neeto-icons';
|
|
17
17
|
import { useTranslation } from 'react-i18next';
|
|
18
18
|
import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
|
|
19
19
|
import useBreakpoints from '@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints';
|
|
@@ -158,32 +158,12 @@ function _objectDestructuringEmpty(obj) {
|
|
|
158
158
|
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
var _excluded$2 = ["showLoading"];
|
|
162
|
-
var ProductSwitcherIcon = function ProductSwitcherIcon(_ref) {
|
|
163
|
-
var showLoading = _ref.showLoading,
|
|
164
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$2);
|
|
165
|
-
return showLoading ? /*#__PURE__*/React__default.createElement("span", {
|
|
166
|
-
"data-testid": "app-switcher-button-loader"
|
|
167
|
-
}, /*#__PURE__*/React__default.createElement(Spinner, _extends({
|
|
168
|
-
size: 18
|
|
169
|
-
}, otherProps))) : /*#__PURE__*/React__default.createElement(AppSwitcher$1, _extends({
|
|
170
|
-
size: 18
|
|
171
|
-
}, otherProps));
|
|
172
|
-
};
|
|
173
|
-
|
|
174
161
|
var MenuItemButton = function MenuItemButton(_ref) {
|
|
175
162
|
var otherProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
176
163
|
var _useTranslation = useTranslation(),
|
|
177
164
|
t = _useTranslation.t;
|
|
178
|
-
var _useState = useState(false),
|
|
179
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
180
|
-
hasHovered = _useState2[0],
|
|
181
|
-
setHasHovered = _useState2[1];
|
|
182
165
|
var MenuItem = Dropdown.MenuItem;
|
|
183
|
-
var _useFetchNeetoApps = useFetchNeetoApps(
|
|
184
|
-
enabled: false
|
|
185
|
-
}),
|
|
186
|
-
data = _useFetchNeetoApps.data,
|
|
166
|
+
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
187
167
|
refetchNeetoApps = _useFetchNeetoApps.refetch,
|
|
188
168
|
isStale = _useFetchNeetoApps.isStale;
|
|
189
169
|
return /*#__PURE__*/React__default.createElement(MenuItem.Button, _extends({
|
|
@@ -195,14 +175,9 @@ var MenuItemButton = function MenuItemButton(_ref) {
|
|
|
195
175
|
suffix: /*#__PURE__*/React__default.createElement(Right, {
|
|
196
176
|
size: 18
|
|
197
177
|
}),
|
|
198
|
-
prefix: /*#__PURE__*/React__default.createElement(ProductSwitcherIcon, {
|
|
199
|
-
showLoading: !data && hasHovered,
|
|
200
|
-
size: 18
|
|
201
|
-
}),
|
|
202
178
|
onMouseEnter: function onMouseEnter() {
|
|
203
179
|
if (!isStale) return;
|
|
204
180
|
refetchNeetoApps();
|
|
205
|
-
setHasHovered(true);
|
|
206
181
|
}
|
|
207
182
|
}, otherProps), t("neetoMolecules.sidebar.productSwitcher"));
|
|
208
183
|
};
|
|
@@ -213,14 +188,13 @@ var AppSwitcherDropdown = function AppSwitcherDropdown() {
|
|
|
213
188
|
var _useBreakpoints = useBreakpoints(),
|
|
214
189
|
isSize = _useBreakpoints.isSize;
|
|
215
190
|
var isMobile = isSize("mobile");
|
|
216
|
-
var _useFetchNeetoApps = useFetchNeetoApps(
|
|
217
|
-
enabled: false
|
|
218
|
-
}),
|
|
191
|
+
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
219
192
|
data = _useFetchNeetoApps.data;
|
|
220
193
|
return /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
221
194
|
className: "neeto-molecules-app-switcher-menu-popup-wrapper",
|
|
222
195
|
closeOnSelect: false,
|
|
223
196
|
customTarget: /*#__PURE__*/React__default.createElement(MenuItemButton, null),
|
|
197
|
+
delay: 500,
|
|
224
198
|
disabled: !data,
|
|
225
199
|
interactiveDebounce: 30,
|
|
226
200
|
isOpen: !data ? false : undefined,
|
|
@@ -240,18 +214,62 @@ var AppSwitcherMenu = function AppSwitcherMenu(_ref) {
|
|
|
240
214
|
isSize = _useBreakpoints.isSize;
|
|
241
215
|
var isMobile = isSize("mobile");
|
|
242
216
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isMobile ? /*#__PURE__*/React__default.createElement(MenuItemButton, {
|
|
217
|
+
"data-cy": "app-switcher-button",
|
|
218
|
+
"data-testid": "app-switcher-button",
|
|
243
219
|
onClick: function onClick() {
|
|
244
220
|
return toggleModal(true);
|
|
245
221
|
}
|
|
246
222
|
}) : /*#__PURE__*/React__default.createElement(AppSwitcherDropdown, null));
|
|
247
223
|
};
|
|
248
224
|
|
|
225
|
+
var shouldShowWhatsNew = function shouldShowWhatsNew() {
|
|
226
|
+
var _window$globalProps, _window$globalProps$u;
|
|
227
|
+
var currentUserEmail = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : (_window$globalProps$u = _window$globalProps.user) === null || _window$globalProps$u === void 0 ? void 0 : _window$globalProps$u.email;
|
|
228
|
+
return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
|
|
229
|
+
};
|
|
230
|
+
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
231
|
+
var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
|
|
232
|
+
var MENU_ITEMS_WITH_ICONS = ["Chat with support", "Help articles"];
|
|
233
|
+
var DEFAULT_HELP_LINK_PROPS = {
|
|
234
|
+
helpCenterProps: {
|
|
235
|
+
label: t("neetoMolecules.sidebar.helpLinks.helpArticles"),
|
|
236
|
+
icon: Book,
|
|
237
|
+
"data-cy": "help-link-help-center-button",
|
|
238
|
+
"data-btn-weight": "bold",
|
|
239
|
+
href: "https://help.".concat(toLower(globalProps.appName), ".com/"),
|
|
240
|
+
target: "_blank"
|
|
241
|
+
},
|
|
242
|
+
liveChatProps: {
|
|
243
|
+
label: t("neetoMolecules.sidebar.helpLinks.liveChat"),
|
|
244
|
+
icon: Help,
|
|
245
|
+
"data-cy": "help-link-live-chat-button",
|
|
246
|
+
"data-btn-weight": "bold",
|
|
247
|
+
onClick: function onClick() {
|
|
248
|
+
var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
|
|
249
|
+
(_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 ? void 0 : (_window$NeetoChat$con = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat$con === void 0 ? void 0 : _window$NeetoChat$con.maximizeWidget();
|
|
250
|
+
(_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 ? void 0 : (_window$NeetoChat2$co = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2$co === void 0 ? void 0 : _window$NeetoChat2$co.openWidget();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var DEFAULT_MENU_LINK_PROPS = {
|
|
255
|
+
changelogProps: {
|
|
256
|
+
id: CHANGELOG_WIDGET_TRIGGER_ID,
|
|
257
|
+
label: t("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
258
|
+
"data-cy": "help-link-changelog-button",
|
|
259
|
+
isVisible: shouldShowWhatsNew
|
|
260
|
+
},
|
|
261
|
+
keyboardShortcutProps: {
|
|
262
|
+
label: t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
263
|
+
"data-cy": "help-link-keyboard-shortcut-button"
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
249
267
|
var _excluded$1 = ["label", "icon", "changesCount"];
|
|
250
268
|
var LinkSection = function LinkSection(_ref) {
|
|
251
269
|
var links = _ref.links;
|
|
252
270
|
var MenuItem = Dropdown.MenuItem;
|
|
253
271
|
if (isNotPresent(links)) return null;
|
|
254
|
-
return links.map(function (_ref2, idx) {
|
|
272
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, links.map(function (_ref2, idx) {
|
|
255
273
|
var label = _ref2.label,
|
|
256
274
|
Icon = _ref2.icon,
|
|
257
275
|
changesCount = _ref2.changesCount,
|
|
@@ -260,16 +278,16 @@ var LinkSection = function LinkSection(_ref) {
|
|
|
260
278
|
className: "neeto-molecules-menu-sublist__item-btn",
|
|
261
279
|
"data-cy": "floating-action-menu-link-section",
|
|
262
280
|
key: idx,
|
|
263
|
-
|
|
281
|
+
style: "text",
|
|
282
|
+
prefix: MENU_ITEMS_WITH_ICONS.includes(label) ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
264
283
|
size: 18
|
|
265
|
-
})
|
|
266
|
-
style: "text"
|
|
284
|
+
}) : undefined
|
|
267
285
|
}, otherProps), label, isPresent(changesCount) && /*#__PURE__*/React__default.createElement("span", {
|
|
268
286
|
className: "neeto-molecules-menu-list__item-btn-count",
|
|
269
287
|
"data-cy": "help-section-menu-changes-count",
|
|
270
288
|
"data-testid": "help-section-menu-changes-count"
|
|
271
289
|
}, changesCount));
|
|
272
|
-
});
|
|
290
|
+
}));
|
|
273
291
|
};
|
|
274
292
|
|
|
275
293
|
var ProfileHeader = function ProfileHeader(_ref) {
|
|
@@ -307,6 +325,7 @@ var ProfileMenu = function ProfileMenu(_ref) {
|
|
|
307
325
|
var profileInfo = _ref.profileInfo,
|
|
308
326
|
showAppSwitcher = _ref.showAppSwitcher,
|
|
309
327
|
helpLinks = _ref.helpLinks,
|
|
328
|
+
defaultLinks = _ref.defaultLinks,
|
|
310
329
|
topLinks = _ref.topLinks,
|
|
311
330
|
bottomLinks = _ref.bottomLinks,
|
|
312
331
|
customContent = _ref.customContent,
|
|
@@ -322,58 +341,21 @@ var ProfileMenu = function ProfileMenu(_ref) {
|
|
|
322
341
|
"data-testid": "profile-popup"
|
|
323
342
|
}, /*#__PURE__*/React__default.createElement(ProfileHeader, {
|
|
324
343
|
profileInfo: profileInfo
|
|
325
|
-
})),
|
|
326
|
-
toggleModal: toggleModal
|
|
327
|
-
}), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
|
|
344
|
+
})), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
|
|
328
345
|
links: topLinks
|
|
346
|
+
}), /*#__PURE__*/React__default.createElement(Divider, null), showAppSwitcher && /*#__PURE__*/React__default.createElement(AppSwitcherMenu, {
|
|
347
|
+
toggleModal: toggleModal
|
|
329
348
|
}), isPresent(customContent) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
330
349
|
className: "neeto-molecules-floating-action-button__profile-wrapper-custom-content"
|
|
331
350
|
}, customContent)), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
|
|
351
|
+
links: defaultLinks
|
|
352
|
+
}), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
|
|
332
353
|
links: helpLinks
|
|
333
354
|
}), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
|
|
334
355
|
links: bottomLinks
|
|
335
356
|
}));
|
|
336
357
|
};
|
|
337
358
|
|
|
338
|
-
var shouldShowWhatsNew = function shouldShowWhatsNew() {
|
|
339
|
-
var _window$globalProps, _window$globalProps$u;
|
|
340
|
-
var currentUserEmail = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : (_window$globalProps$u = _window$globalProps.user) === null || _window$globalProps$u === void 0 ? void 0 : _window$globalProps$u.email;
|
|
341
|
-
return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
|
|
342
|
-
};
|
|
343
|
-
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
344
|
-
var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
|
|
345
|
-
var DEFAULT_HELP_LINK_PROPS = {
|
|
346
|
-
liveChatProps: {
|
|
347
|
-
label: t("neetoMolecules.sidebar.helpLinks.liveChat"),
|
|
348
|
-
icon: ChatEmpty,
|
|
349
|
-
"data-cy": "help-link-live-chat-button",
|
|
350
|
-
onClick: function onClick() {
|
|
351
|
-
var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
|
|
352
|
-
(_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 ? void 0 : (_window$NeetoChat$con = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat$con === void 0 ? void 0 : _window$NeetoChat$con.maximizeWidget();
|
|
353
|
-
(_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 ? void 0 : (_window$NeetoChat2$co = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2$co === void 0 ? void 0 : _window$NeetoChat2$co.openWidget();
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
helpCenterProps: {
|
|
357
|
-
label: t("neetoMolecules.sidebar.helpLinks.helpArticles"),
|
|
358
|
-
icon: Book,
|
|
359
|
-
"data-cy": "help-link-help-center-button",
|
|
360
|
-
href: "https://help.".concat(toLower(globalProps.appName), ".com/"),
|
|
361
|
-
target: "_blank"
|
|
362
|
-
},
|
|
363
|
-
changelogProps: {
|
|
364
|
-
id: CHANGELOG_WIDGET_TRIGGER_ID,
|
|
365
|
-
label: t("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
366
|
-
icon: Gift,
|
|
367
|
-
"data-cy": "help-link-changelog-button",
|
|
368
|
-
isVisible: shouldShowWhatsNew
|
|
369
|
-
},
|
|
370
|
-
keyboardShortcutProps: {
|
|
371
|
-
label: t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
372
|
-
icon: Keyboard,
|
|
373
|
-
"data-cy": "help-link-keyboard-shortcut-button"
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
|
|
377
359
|
var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
|
|
378
360
|
var _globalProps$user, _globalProps$user2;
|
|
379
361
|
var user = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || ((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.phoneNumber);
|
|
@@ -382,7 +364,6 @@ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
|
|
|
382
364
|
var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen) {
|
|
383
365
|
return [{
|
|
384
366
|
label: t("neetoMolecules.sidebar.myProfile"),
|
|
385
|
-
icon: User,
|
|
386
367
|
onClick: function onClick() {
|
|
387
368
|
return setIsProfilePaneOpen(true);
|
|
388
369
|
},
|
|
@@ -390,7 +371,6 @@ var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOp
|
|
|
390
371
|
"data-testid": "my-profile-button"
|
|
391
372
|
}, isOwner && {
|
|
392
373
|
label: t("neetoMolecules.sidebar.myOrganization"),
|
|
393
|
-
icon: Settings,
|
|
394
374
|
onClick: function onClick() {
|
|
395
375
|
return window.open(MY_ORGANIZATION_URL, "_blank");
|
|
396
376
|
},
|
|
@@ -399,7 +379,6 @@ var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOp
|
|
|
399
379
|
};
|
|
400
380
|
var getDefaultBottomLinks = function getDefaultBottomLinks() {
|
|
401
381
|
return [{
|
|
402
|
-
icon: LeftArrow,
|
|
403
382
|
label: t("neetoMolecules.sidebar.logout"),
|
|
404
383
|
onClick: function onClick() {
|
|
405
384
|
resetAuthTokens();
|
|
@@ -438,9 +417,7 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
438
417
|
var _Profile$usePaneState = Profile.usePaneState(),
|
|
439
418
|
_Profile$usePaneState2 = _slicedToArray(_Profile$usePaneState, 2),
|
|
440
419
|
setIsProfilePaneOpen = _Profile$usePaneState2[1];
|
|
441
|
-
var _useFetchNeetoApps = useFetchNeetoApps(
|
|
442
|
-
enabled: false
|
|
443
|
-
}),
|
|
420
|
+
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
444
421
|
data = _useFetchNeetoApps.data;
|
|
445
422
|
var profileInfo = getProfileInfo(profileInfoOverrides);
|
|
446
423
|
var newTopLinks = globalProps.appName !== "neetoAuth" ? [].concat(_toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner, setIsProfilePaneOpen)), _toConsumableArray(topLinks)) : topLinks;
|
|
@@ -461,11 +438,17 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
461
438
|
};
|
|
462
439
|
window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
|
|
463
440
|
}, []);
|
|
464
|
-
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).
|
|
465
|
-
|
|
466
|
-
|
|
441
|
+
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).map(function (key) {
|
|
442
|
+
return _objectSpread({}, DEFAULT_HELP_LINK_PROPS[key]);
|
|
443
|
+
}).filter(function (_ref2) {
|
|
444
|
+
var hide = _ref2.hide;
|
|
445
|
+
return !hide;
|
|
446
|
+
});
|
|
447
|
+
var defaultLinks = Object.keys(DEFAULT_MENU_LINK_PROPS).filter(function (key) {
|
|
448
|
+
var _DEFAULT_MENU_LINK_PR, _DEFAULT_MENU_LINK_PR2, _DEFAULT_MENU_LINK_PR3;
|
|
449
|
+
return (_DEFAULT_MENU_LINK_PR = (_DEFAULT_MENU_LINK_PR2 = (_DEFAULT_MENU_LINK_PR3 = DEFAULT_MENU_LINK_PROPS[key]).isVisible) === null || _DEFAULT_MENU_LINK_PR2 === void 0 ? void 0 : _DEFAULT_MENU_LINK_PR2.call(_DEFAULT_MENU_LINK_PR3)) !== null && _DEFAULT_MENU_LINK_PR !== void 0 ? _DEFAULT_MENU_LINK_PR : true;
|
|
467
450
|
}).map(function (key) {
|
|
468
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({},
|
|
451
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, DEFAULT_MENU_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
|
|
469
452
|
onClick: function onClick() {
|
|
470
453
|
return setIsOpen(function (prev) {
|
|
471
454
|
return !prev;
|
|
@@ -474,8 +457,8 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
474
457
|
}), key === "changelogProps" && changesCount && {
|
|
475
458
|
changesCount: changesCount
|
|
476
459
|
});
|
|
477
|
-
}).filter(function (
|
|
478
|
-
var hide =
|
|
460
|
+
}).filter(function (_ref3) {
|
|
461
|
+
var hide = _ref3.hide;
|
|
479
462
|
return !hide;
|
|
480
463
|
});
|
|
481
464
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Profile.Pane, null), /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
@@ -495,18 +478,22 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
495
478
|
theme: "light",
|
|
496
479
|
trigger: "hover",
|
|
497
480
|
zIndex: 99999,
|
|
498
|
-
customTarget: /*#__PURE__*/React__default.createElement(
|
|
481
|
+
customTarget: /*#__PURE__*/React__default.createElement("button", {
|
|
482
|
+
className: "neeto-molecules-floating-action-button",
|
|
483
|
+
type: "button"
|
|
484
|
+
}, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
499
485
|
className: "neeto-ui-flex-shrink-0 neeto-molecules-floating-action-button__profile-avatar",
|
|
500
486
|
"data-cy": "profile-avatar",
|
|
501
487
|
"data-testid": "profile-avatar",
|
|
502
488
|
size: "medium",
|
|
503
489
|
user: profileInfo
|
|
504
|
-
}),
|
|
490
|
+
})),
|
|
505
491
|
dropdownProps: {
|
|
506
492
|
classNames: "neeto-molecules-floating-action-button__dropdown"
|
|
507
493
|
}
|
|
508
494
|
}, /*#__PURE__*/React__default.createElement(ProfileMenu, {
|
|
509
495
|
customContent: customContent,
|
|
496
|
+
defaultLinks: defaultLinks,
|
|
510
497
|
helpLinks: helpLinks,
|
|
511
498
|
profileInfo: profileInfo,
|
|
512
499
|
showAppSwitcher: showAppSwitcher,
|
|
@@ -525,7 +512,7 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
525
512
|
}));
|
|
526
513
|
};
|
|
527
514
|
|
|
528
|
-
var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{
|
|
515
|
+
var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{background-color:rgb(var(--neeto-ui-white));border-bottom-right-radius:30px;border-top-right-radius:30px;bottom:16px;left:0;position:fixed;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button{align-items:center;background-color:rgba(var(--neeto-ui-primary-500),.6);border-bottom-right-radius:30px;border-color:rgba(var(--neeto-ui-primary-500),.6);border-top-right-radius:30px;display:flex;justify-content:center;padding:4px}.neeto-molecules-floating-action-button__profile-avatar{border:2px solid #fff;border-radius:100px}.neeto-molecules-floating-action-button__profile-avatar .neeto-ui-avatar{height:100%!important;width:100%!important}.neeto-molecules-floating-action-button__dropdown{box-shadow:0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12),0 5px 5px -3px rgba(0,0,0,.2)!important;flex-shrink:0;max-height:none!important;max-width:none;width:256px;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button__dropdown ul{padding-top:0!important}.neeto-molecules-app-switcher-menu-popup__dropdown{max-height:none!important;max-width:none}.neeto-molecules-menu__notif-count{position:absolute;right:3px;top:3px;z-index:1}.neeto-molecules-menu-list__item-btn-count,.neeto-molecules-menu__notif-count{align-items:center;background-color:rgb(var(--neeto-ui-primary-500));border-radius:var(--neeto-ui-rounded-full);color:rgb(var(--neeto-ui-white));display:flex;flex-shrink:0;font-size:var(--neeto-ui-text-xxs);height:15px;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:15px}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-popup-wrapper{border:1px solid rgb(var(--neeto-ui-gray-400));border-radius:var(--neeto-ui-rounded)!important;box-shadow:0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12),0 5px 5px -3px rgba(0,0,0,.2)!important;min-width:240px}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-popup-wrapper .tippy-content{padding:0}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-popup-wrapper .tippy-svg-arrow{display:none!important}.neeto-molecules-profile-popup__top-section{border-top-left-radius:var(--neeto-ui-rounded);border-top-right-radius:var(--neeto-ui-rounded)}.neeto-molecules-menu-sublist__item-btn{font-weight:500!important;height:40px}.neeto-molecules-menu-sublist__item-btn[data-btn-weight=bold]{font-weight:700!important}.neeto-molecules-menu-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-menu-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-menu-sublist__item-btn span{align-items:center;display:flex;gap:8px}.neeto-molecules-app-switcher-menu-popup-wrapper{height:95vh;overflow-y:auto;width:calc(100vw - 400px)}.neeto-molecules-floating-action-button__profile-wrapper-custom-content:hover{background-color:rgb(var(--neeto-ui-white))!important}";
|
|
529
516
|
n(css,{});
|
|
530
517
|
|
|
531
518
|
var _excluded = ["profileInfoOverrides", "helpLinkOverrides", "topLinks", "bottomLinks", "showAppSwitcher", "customContent"];
|
|
@@ -544,7 +531,7 @@ var FloatingActionMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
544
531
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
545
532
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
546
533
|
ref: ref,
|
|
547
|
-
className: "neeto-molecules-floating-action-menu__container
|
|
534
|
+
className: "neeto-molecules-floating-action-menu__container",
|
|
548
535
|
"data-cy": "floating-action-menu-container",
|
|
549
536
|
"data-testid": "floating-action-menu-container"
|
|
550
537
|
}, otherProps), /*#__PURE__*/React__default.createElement(ProfileButton, {
|