@bigbinary/neeto-commons-frontend 2.0.37 → 2.0.39

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.
@@ -0,0 +1,49 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const { mergeDeepLeft, mergeLeft, keys } = require("ramda");
5
+
6
+ const rootOfTheProject = path.join(__dirname, "../../../../../../../");
7
+
8
+ const loadJS = jsPath => {
9
+ try {
10
+ return require(path.join(rootOfTheProject, jsPath));
11
+ } catch {
12
+ return {};
13
+ }
14
+ };
15
+
16
+ const doesFileExist = filePath =>
17
+ fs.existsSync(filePath) && fs.lstatSync(filePath).isFile();
18
+
19
+ const buildPathGroupsBasedOnWebpackAliases = ({
20
+ customAliasPath = "resolve.js",
21
+ }) => {
22
+ const projectResolve = loadJS(customAliasPath);
23
+ const commonResolve = loadJS(
24
+ "node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/webpack/resolve.js"
25
+ );
26
+
27
+ const { dependencies = [], devDependencies = [] } = loadJS("package.json");
28
+ const packages = keys(mergeLeft(dependencies, devDependencies));
29
+ const { alias = {}, extensions = [] } = mergeDeepLeft(
30
+ projectResolve,
31
+ commonResolve
32
+ );
33
+
34
+ return Object.entries(alias).flatMap(([pattern, aliasPath]) => {
35
+ const group = packages.includes(aliasPath) ? "external" : "internal";
36
+ const isFile = ["", ...extensions].some(extension =>
37
+ doesFileExist(`${aliasPath}${extension}`)
38
+ );
39
+
40
+ if (isFile) return { pattern, group };
41
+
42
+ return [
43
+ { pattern, group },
44
+ { pattern: `${pattern}/**`, group },
45
+ ];
46
+ });
47
+ };
48
+
49
+ module.exports = { buildPathGroupsBasedOnWebpackAliases };
@@ -0,0 +1,18 @@
1
+ const { assocPath } = require("ramda");
2
+
3
+ const commonConfig = require("../../../eslint/imports/order");
4
+ const { buildPathGroupsBasedOnWebpackAliases } = require("../helpers");
5
+
6
+ const pathGroups = buildPathGroupsBasedOnWebpackAliases({});
7
+ const pathGroupForKeepingReactImportsAtTop = {
8
+ pattern: "react+(-native|)",
9
+ group: "external",
10
+ position: "before",
11
+ };
12
+ pathGroups.push(pathGroupForKeepingReactImportsAtTop);
13
+
14
+ module.exports = assocPath(
15
+ ["rules", "import/order", 1, "pathGroups"],
16
+ pathGroups,
17
+ commonConfig
18
+ );
@@ -0,0 +1,23 @@
1
+ const { mergeLeft } = require("ramda");
2
+
3
+ const commonConfiguration = require("../../eslint");
4
+
5
+ const nanosConfiguration = {
6
+ extends: [
7
+ "plugin:@bigbinary/neeto/recommended",
8
+ "plugin:cypress/recommended",
9
+ "plugin:json/recommended",
10
+ "eslint:recommended",
11
+ "plugin:react/recommended",
12
+ "./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/globals",
13
+ "./node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/eslint/imports/order",
14
+ "./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/overrides",
15
+ "./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/imports/enforced",
16
+ "./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/react",
17
+ "./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/promise",
18
+ "./node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/eslint/neeto",
19
+ "prettier",
20
+ ],
21
+ };
22
+
23
+ module.exports = mergeLeft(nanosConfiguration, commonConfiguration);
@@ -0,0 +1,92 @@
1
+ const path = require("path");
2
+
3
+ const { mergeDeepLeft } = require("ramda");
4
+
5
+ const rootOfTheProject = path.join(__dirname, "../../../../../../");
6
+ const pathToTranslationFile = "src/translations/en.json";
7
+ const pathToResolveFile = "resolve.js";
8
+ const pathToJsConfigFile = "jsconfig.json";
9
+
10
+ const loadJS = jsPath => {
11
+ try {
12
+ return require(path.join(rootOfTheProject, jsPath));
13
+ } catch {
14
+ return {};
15
+ }
16
+ };
17
+
18
+ const commonResolve = loadJS(
19
+ "node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/webpack/resolve.js"
20
+ );
21
+ const projectResolve = loadJS(pathToResolveFile);
22
+ const en = loadJS(pathToTranslationFile);
23
+ const resolve = mergeDeepLeft(projectResolve, commonResolve);
24
+
25
+ module.exports = {
26
+ rules: {
27
+ "@bigbinary/neeto/file-name-and-export-name-standards": [
28
+ "warn",
29
+ {
30
+ basePath: path.join(rootOfTheProject, "src"),
31
+ default: {
32
+ filenameCase: "camelCase",
33
+ exportnameCase: "camelCase",
34
+ },
35
+ configs: [
36
+ {
37
+ filenameCase: "camelCase",
38
+ exportnameCase: "CONSTANT_CASE",
39
+ includes: ["/**/constants.{js,jsx}", "/**/constants/**"],
40
+ },
41
+ {
42
+ filenameCase: "camelCase",
43
+ includes: ["/**/utils.{js,jsx}", "/**/utils/**"],
44
+ },
45
+ {
46
+ filenameCase: "snake_case",
47
+ exportnameCase: "camelCase",
48
+ includes: "/apis/**",
49
+ },
50
+ {
51
+ filenameCase: "camelCase",
52
+ exportnameCase: "camelCase",
53
+ includes: "/channels/**",
54
+ },
55
+ {
56
+ filenameCase: "camelCase",
57
+ exportnameCase: "camelCase",
58
+ includes: "/**/hooks/**",
59
+ },
60
+ {
61
+ filenameCase: "camelCase",
62
+ includes: "/lib/**",
63
+ },
64
+ {
65
+ filenameCase: "camelCase",
66
+ exportnameCase: "camelCase",
67
+ includes: "/**/stores/**",
68
+ },
69
+ {
70
+ filenameCase: "PascalCase",
71
+ exportnameCase: "PascalCase",
72
+ includes: ["/components/**", "/*.jsx"],
73
+ },
74
+ ],
75
+ },
76
+ ],
77
+ "@bigbinary/neeto/no-axios-import-outside-apis": ["error", resolve.alias],
78
+ "@bigbinary/neeto/no-missing-localization": [
79
+ "error",
80
+ { name: "en.json", lng: "en", content: en },
81
+ ],
82
+ "@bigbinary/neeto/prefix-neeto-ui-import-alias": ["error", resolve.alias],
83
+ "@bigbinary/neeto/use-webpack-alias": ["error", resolve.alias],
84
+ "@bigbinary/neeto/webpack-aliases-and-jsconfig-paths-should-be-in-sync": [
85
+ "error",
86
+ {
87
+ jsconfigFilePath: path.join(rootOfTheProject, pathToJsConfigFile),
88
+ aliasFilePath: path.join(rootOfTheProject, pathToResolveFile),
89
+ },
90
+ ],
91
+ },
92
+ };
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ important: true,
3
+ purge: {
4
+ enabled: process.env.NODE_ENV === "production",
5
+ content: [
6
+ "./{src,example}/**/*.{js,jsx}",
7
+ "./node_modules/@bigbinary/**/*.js",
8
+ ],
9
+ defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [],
10
+ },
11
+ };
@@ -0,0 +1,42 @@
1
+ const path = require("path");
2
+
3
+ const absolutePath = basePath =>
4
+ path.join(__dirname, "../../../../../../", basePath);
5
+
6
+ module.exports = {
7
+ alias: {
8
+ apis: absolutePath("src/apis"),
9
+ assets: absolutePath("src/assets"),
10
+ components: absolutePath("src/components"),
11
+ hooks: absolutePath("src/hooks"),
12
+ reducers: absolutePath("src/reducers"),
13
+ routes: absolutePath("src/routes"),
14
+ stores: absolutePath("src/stores"),
15
+ translations: absolutePath("src/translations"),
16
+ utils: absolutePath("src/utils"),
17
+ src: absolutePath("src"),
18
+ neetoui: "@bigbinary/neetoui",
19
+ neetocommons: "@bigbinary/neeto-commons-frontend",
20
+ neetoicons: "@bigbinary/neeto-icons",
21
+ neetoteam: "@bigbinary/neeto-team-members-frontend",
22
+ neetoeditor: "@bigbinary/neeto-editor",
23
+ neetofilters: "@bigbinary/neeto-filters-frontend",
24
+ },
25
+ extensions: [
26
+ ".ts",
27
+ ".mjs",
28
+ ".js",
29
+ ".jsx",
30
+ ".sass",
31
+ ".scss",
32
+ ".css",
33
+ ".module.sass",
34
+ ".module.scss",
35
+ ".module.css",
36
+ ".png",
37
+ ".svg",
38
+ ".gif",
39
+ ".jpeg",
40
+ ".jpg",
41
+ ],
42
+ };
@@ -504,7 +504,8 @@ var neetoCommons = {
504
504
  myOrganization: "My organization",
505
505
  logout: "Log out",
506
506
  help: "Help",
507
- livechat: "Live chat"
507
+ livechat: "Live chat",
508
+ keyboardShortcuts: "Keyboard shortcuts"
508
509
  },
509
510
  common: {
510
511
  actions: {
package/initializers.js CHANGED
@@ -494,7 +494,8 @@ var neetoCommons = {
494
494
  myOrganization: "My organization",
495
495
  logout: "Log out",
496
496
  help: "Help",
497
- livechat: "Live chat"
497
+ livechat: "Live chat",
498
+ keyboardShortcuts: "Keyboard shortcuts"
498
499
  },
499
500
  common: {
500
501
  actions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "2.0.37",
3
+ "version": "2.0.39",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -1701,8 +1701,8 @@ var findIndexBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
1701
1701
  });
1702
1702
 
1703
1703
  var getStorageValue = function getStorageValue(key, defaultValue) {
1704
- var saved = localStorage.getItem(key);
1705
- return JSON.parse(saved) || defaultValue;
1704
+ if (key in localStorage) return JSON.parse(localStorage.getItem(key));
1705
+ return defaultValue;
1706
1706
  };
1707
1707
  var useLocalStorage = function useLocalStorage(key, defaultValue) {
1708
1708
  var _useState = React.useState(function () {
@@ -3572,7 +3572,8 @@ var MODES$1 = {
3572
3572
  };
3573
3573
  var DEFAULT_CONFIG = {
3574
3574
  mode: MODES$1["default"],
3575
- unbindOnUnmount: true
3575
+ unbindOnUnmount: true,
3576
+ enabled: true
3576
3577
  };
3577
3578
 
3578
3579
  var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
@@ -3580,7 +3581,7 @@ var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
3580
3581
  var convertedHotkey = convertHotkeyToUsersPlatform(hotkey);
3581
3582
  var config = ramda.mergeLeft(userConfig, DEFAULT_CONFIG);
3582
3583
  React.useEffect(function () {
3583
- bindHotKey({
3584
+ config.enabled && bindHotKey({
3584
3585
  mode: config.mode,
3585
3586
  hotkey: convertedHotkey,
3586
3587
  handler: handler,
@@ -3646,6 +3647,71 @@ var useIsElementVisibleInDom = function useIsElementVisibleInDom(target) {
3646
3647
  return isIntersecting;
3647
3648
  };
3648
3649
 
3650
+ function shallow(objA, objB) {
3651
+ if (Object.is(objA, objB)) {
3652
+ return true;
3653
+ }
3654
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
3655
+ return false;
3656
+ }
3657
+ if (objA instanceof Map && objB instanceof Map) {
3658
+ if (objA.size !== objB.size)
3659
+ return false;
3660
+ for (const [key, value] of objA) {
3661
+ if (!Object.is(value, objB.get(key))) {
3662
+ return false;
3663
+ }
3664
+ }
3665
+ return true;
3666
+ }
3667
+ if (objA instanceof Set && objB instanceof Set) {
3668
+ if (objA.size !== objB.size)
3669
+ return false;
3670
+ for (const value of objA) {
3671
+ if (!objB.has(value)) {
3672
+ return false;
3673
+ }
3674
+ }
3675
+ return true;
3676
+ }
3677
+ const keysA = Object.keys(objA);
3678
+ if (keysA.length !== Object.keys(objB).length) {
3679
+ return false;
3680
+ }
3681
+ for (let i = 0; i < keysA.length; i++) {
3682
+ if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {
3683
+ return false;
3684
+ }
3685
+ }
3686
+ return true;
3687
+ }
3688
+
3689
+ var useKeyboardShortcutsStore = create$9(function (set) {
3690
+ return {
3691
+ isOpen: false,
3692
+ setIsOpen: function setIsOpen(arg) {
3693
+ if (typeof arg === "function") {
3694
+ set(function (state) {
3695
+ return {
3696
+ isOpen: arg(state.isOpen)
3697
+ };
3698
+ });
3699
+ } else {
3700
+ set({
3701
+ isOpen: arg
3702
+ });
3703
+ }
3704
+ }
3705
+ };
3706
+ });
3707
+ var useKeyboardShortcutsPaneState = function useKeyboardShortcutsPaneState() {
3708
+ return useKeyboardShortcutsStore(function (_ref) {
3709
+ var isOpen = _ref.isOpen,
3710
+ setIsOpen = _ref.setIsOpen;
3711
+ return [isOpen, setIsOpen];
3712
+ }, shallow);
3713
+ };
3714
+
3649
3715
  var useOnClickOutside = function useOnClickOutside(ref, handler) {
3650
3716
  React.useEffect(function () {
3651
3717
  var listener = function listener(event) {
@@ -10496,16 +10562,16 @@ var HotKeyList = function HotKeyList(_ref) {
10496
10562
  var KeyboardShortcutsPane = function KeyboardShortcutsPane(_ref) {
10497
10563
  var _ref$productShortcuts = _ref.productShortcuts,
10498
10564
  productShortcuts = _ref$productShortcuts === void 0 ? {} : _ref$productShortcuts;
10499
- var _useState = React.useState(false),
10500
- _useState2 = _slicedToArray(_useState, 2),
10501
- isOpen = _useState2[0],
10502
- setIsOpen = _useState2[1];
10565
+ var _useKeyboardShortcuts = useKeyboardShortcutsPaneState(),
10566
+ _useKeyboardShortcuts2 = _slicedToArray(_useKeyboardShortcuts, 2),
10567
+ isOpen = _useKeyboardShortcuts2[0],
10568
+ setIsOpen = _useKeyboardShortcuts2[1];
10503
10569
  var hasOverlays = managers.manager.hasOverlays();
10504
10570
  var GLOBAL_SHORTCUTS = getGlobalShortcuts();
10505
10571
  var shortcuts = GLOBAL_SHORTCUTS[i18next__default["default"].t("neetoCommons.keyboardShortcuts.global.categoryName")];
10506
10572
  useHotKeys(shortcuts.openKeyboardShortcutsPane.sequence, function () {
10507
- return setIsOpen(function (prevState) {
10508
- return !prevState;
10573
+ return setIsOpen(function (prevIsOpen) {
10574
+ return !prevIsOpen;
10509
10575
  });
10510
10576
  }, {
10511
10577
  mode: "global"
@@ -95753,6 +95819,9 @@ var Sidebar = function Sidebar(_ref) {
95753
95819
  isAppSwitcherOpen = _useState2[0],
95754
95820
  setIsAppSwitcherOpen = _useState2[1];
95755
95821
  var location = reactRouterDom.useLocation();
95822
+ var _useKeyboardShortcuts = useKeyboardShortcutsPaneState(),
95823
+ _useKeyboardShortcuts2 = _slicedToArray(_useKeyboardShortcuts, 2),
95824
+ setIsOpen = _useKeyboardShortcuts2[1];
95756
95825
  React.useEffect(function () {
95757
95826
  isAppSwitcherOpen && setIsAppSwitcherOpen(false);
95758
95827
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -95776,6 +95845,13 @@ var Sidebar = function Sidebar(_ref) {
95776
95845
  label: i18next__default["default"].t("neetoCommons.sidebar.livechat"),
95777
95846
  onClick: openChatWidget,
95778
95847
  "data-cy": "profile-livechat-button"
95848
+ }, {
95849
+ icon: neetoIcons.Keyboard,
95850
+ label: i18next__default["default"].t("neetoCommons.sidebar.keyboardShortcuts"),
95851
+ onClick: function onClick() {
95852
+ return setIsOpen(true);
95853
+ },
95854
+ "data-cy": "profile-keyboard-shortcuts-button"
95779
95855
  }, {
95780
95856
  icon: neetoIcons.LeftArrow,
95781
95857
  label: i18next__default["default"].t("neetoCommons.sidebar.logout"),
@@ -99627,6 +99703,7 @@ exports.useErrorDisplayStore = useErrorDisplayStore;
99627
99703
  exports.useFuncDebounce = useFuncDebounce;
99628
99704
  exports.useHotKeys = useHotKeys;
99629
99705
  exports.useIsElementVisibleInDom = useIsElementVisibleInDom;
99706
+ exports.useKeyboardShortcutsPaneState = useKeyboardShortcutsPaneState;
99630
99707
  exports.useLocalStorage = useLocalStorage;
99631
99708
  exports.useOnClickOutside = useOnClickOutside;
99632
99709
  exports.usePrevious = usePrevious;
package/react-utils.d.ts CHANGED
@@ -265,9 +265,15 @@ export const KeyboardShortcutsPane: React.FC<{
265
265
  type ConfigType = {
266
266
  mode?: "default" | "global" | "scoped";
267
267
  unbindOnUnmount?: boolean;
268
+ enabled?: boolean;
268
269
  };
269
270
  export function useHotKeys(
270
271
  hotkey: string,
271
272
  handler: () => void,
272
273
  config?: ConfigType
273
274
  ): React.MutableRefObject | null;
275
+
276
+ export function useKeyboardShortcutsPaneState(): [
277
+ boolean,
278
+ React.Dispatch<React.SetStateAction<boolean>>
279
+ ];
package/react-utils.js CHANGED
@@ -4,7 +4,7 @@ import { Button, Callout, Typography, Dropdown, Input, Label, Checkbox, Toastr,
4
4
  import i18next, { t as t$1 } from 'i18next';
5
5
  import { mergeLeft, curryN, isNil, complement as complement$1, isEmpty, either as either$1, curry, includes, __, filter, trim, toLower, identity, without, append, prop as prop$1, toPairs, pipe, omit, fromPairs, keys, values, last as last$1, pluck, any, uniq, intersection, difference, pick, assoc, not as not$2 } from 'ramda';
6
6
  import { Trans, useTranslation } from 'react-i18next';
7
- import { Search, MenuHorizontal, Info as Info$3, Copy, Check, Close, Delete, Edit, Plus, Help, ExternalLink, Undo, MenuVertical, Clock, Facebook, Linkedin, Twitter, QrCode, ChatBubble, LeftArrow as LeftArrow$1, User, Settings } from '@bigbinary/neeto-icons';
7
+ import { Search, MenuHorizontal, Info as Info$3, Copy, Check, Close, Delete, Edit, Plus, Help, ExternalLink, Undo, MenuVertical, Clock, Facebook, Linkedin, Twitter, QrCode, ChatBubble, Keyboard, LeftArrow as LeftArrow$1, User, Settings } from '@bigbinary/neeto-icons';
8
8
  import { Container, Header as Header$1, SubHeader, Sidebar as Sidebar$1, AppSwitcher } from '@bigbinary/neetoui/layouts';
9
9
  import { Input as Input$1, Form as Form$2, Button as Button$1, MultiEmailInput, Select as Select$1, Checkbox as Checkbox$1 } from '@bigbinary/neetoui/formik';
10
10
  import { Formik, Form as Form$1, FieldArray, ErrorMessage, useFormikContext } from 'formik';
@@ -1663,8 +1663,8 @@ var findIndexBy = /*#__PURE__*/curry(function (pattern, array) {
1663
1663
  });
1664
1664
 
1665
1665
  var getStorageValue = function getStorageValue(key, defaultValue) {
1666
- var saved = localStorage.getItem(key);
1667
- return JSON.parse(saved) || defaultValue;
1666
+ if (key in localStorage) return JSON.parse(localStorage.getItem(key));
1667
+ return defaultValue;
1668
1668
  };
1669
1669
  var useLocalStorage = function useLocalStorage(key, defaultValue) {
1670
1670
  var _useState = useState(function () {
@@ -3534,7 +3534,8 @@ var MODES$1 = {
3534
3534
  };
3535
3535
  var DEFAULT_CONFIG = {
3536
3536
  mode: MODES$1["default"],
3537
- unbindOnUnmount: true
3537
+ unbindOnUnmount: true,
3538
+ enabled: true
3538
3539
  };
3539
3540
 
3540
3541
  var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
@@ -3542,7 +3543,7 @@ var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
3542
3543
  var convertedHotkey = convertHotkeyToUsersPlatform(hotkey);
3543
3544
  var config = mergeLeft(userConfig, DEFAULT_CONFIG);
3544
3545
  useEffect(function () {
3545
- bindHotKey({
3546
+ config.enabled && bindHotKey({
3546
3547
  mode: config.mode,
3547
3548
  hotkey: convertedHotkey,
3548
3549
  handler: handler,
@@ -3608,6 +3609,71 @@ var useIsElementVisibleInDom = function useIsElementVisibleInDom(target) {
3608
3609
  return isIntersecting;
3609
3610
  };
3610
3611
 
3612
+ function shallow(objA, objB) {
3613
+ if (Object.is(objA, objB)) {
3614
+ return true;
3615
+ }
3616
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
3617
+ return false;
3618
+ }
3619
+ if (objA instanceof Map && objB instanceof Map) {
3620
+ if (objA.size !== objB.size)
3621
+ return false;
3622
+ for (const [key, value] of objA) {
3623
+ if (!Object.is(value, objB.get(key))) {
3624
+ return false;
3625
+ }
3626
+ }
3627
+ return true;
3628
+ }
3629
+ if (objA instanceof Set && objB instanceof Set) {
3630
+ if (objA.size !== objB.size)
3631
+ return false;
3632
+ for (const value of objA) {
3633
+ if (!objB.has(value)) {
3634
+ return false;
3635
+ }
3636
+ }
3637
+ return true;
3638
+ }
3639
+ const keysA = Object.keys(objA);
3640
+ if (keysA.length !== Object.keys(objB).length) {
3641
+ return false;
3642
+ }
3643
+ for (let i = 0; i < keysA.length; i++) {
3644
+ if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {
3645
+ return false;
3646
+ }
3647
+ }
3648
+ return true;
3649
+ }
3650
+
3651
+ var useKeyboardShortcutsStore = create$9(function (set) {
3652
+ return {
3653
+ isOpen: false,
3654
+ setIsOpen: function setIsOpen(arg) {
3655
+ if (typeof arg === "function") {
3656
+ set(function (state) {
3657
+ return {
3658
+ isOpen: arg(state.isOpen)
3659
+ };
3660
+ });
3661
+ } else {
3662
+ set({
3663
+ isOpen: arg
3664
+ });
3665
+ }
3666
+ }
3667
+ };
3668
+ });
3669
+ var useKeyboardShortcutsPaneState = function useKeyboardShortcutsPaneState() {
3670
+ return useKeyboardShortcutsStore(function (_ref) {
3671
+ var isOpen = _ref.isOpen,
3672
+ setIsOpen = _ref.setIsOpen;
3673
+ return [isOpen, setIsOpen];
3674
+ }, shallow);
3675
+ };
3676
+
3611
3677
  var useOnClickOutside = function useOnClickOutside(ref, handler) {
3612
3678
  useEffect(function () {
3613
3679
  var listener = function listener(event) {
@@ -10458,16 +10524,16 @@ var HotKeyList = function HotKeyList(_ref) {
10458
10524
  var KeyboardShortcutsPane = function KeyboardShortcutsPane(_ref) {
10459
10525
  var _ref$productShortcuts = _ref.productShortcuts,
10460
10526
  productShortcuts = _ref$productShortcuts === void 0 ? {} : _ref$productShortcuts;
10461
- var _useState = useState(false),
10462
- _useState2 = _slicedToArray(_useState, 2),
10463
- isOpen = _useState2[0],
10464
- setIsOpen = _useState2[1];
10527
+ var _useKeyboardShortcuts = useKeyboardShortcutsPaneState(),
10528
+ _useKeyboardShortcuts2 = _slicedToArray(_useKeyboardShortcuts, 2),
10529
+ isOpen = _useKeyboardShortcuts2[0],
10530
+ setIsOpen = _useKeyboardShortcuts2[1];
10465
10531
  var hasOverlays = manager.hasOverlays();
10466
10532
  var GLOBAL_SHORTCUTS = getGlobalShortcuts();
10467
10533
  var shortcuts = GLOBAL_SHORTCUTS[i18next.t("neetoCommons.keyboardShortcuts.global.categoryName")];
10468
10534
  useHotKeys(shortcuts.openKeyboardShortcutsPane.sequence, function () {
10469
- return setIsOpen(function (prevState) {
10470
- return !prevState;
10535
+ return setIsOpen(function (prevIsOpen) {
10536
+ return !prevIsOpen;
10471
10537
  });
10472
10538
  }, {
10473
10539
  mode: "global"
@@ -95715,6 +95781,9 @@ var Sidebar = function Sidebar(_ref) {
95715
95781
  isAppSwitcherOpen = _useState2[0],
95716
95782
  setIsAppSwitcherOpen = _useState2[1];
95717
95783
  var location = useLocation();
95784
+ var _useKeyboardShortcuts = useKeyboardShortcutsPaneState(),
95785
+ _useKeyboardShortcuts2 = _slicedToArray(_useKeyboardShortcuts, 2),
95786
+ setIsOpen = _useKeyboardShortcuts2[1];
95718
95787
  useEffect(function () {
95719
95788
  isAppSwitcherOpen && setIsAppSwitcherOpen(false);
95720
95789
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -95738,6 +95807,13 @@ var Sidebar = function Sidebar(_ref) {
95738
95807
  label: i18next.t("neetoCommons.sidebar.livechat"),
95739
95808
  onClick: openChatWidget,
95740
95809
  "data-cy": "profile-livechat-button"
95810
+ }, {
95811
+ icon: Keyboard,
95812
+ label: i18next.t("neetoCommons.sidebar.keyboardShortcuts"),
95813
+ onClick: function onClick() {
95814
+ return setIsOpen(true);
95815
+ },
95816
+ "data-cy": "profile-keyboard-shortcuts-button"
95741
95817
  }, {
95742
95818
  icon: LeftArrow$1,
95743
95819
  label: i18next.t("neetoCommons.sidebar.logout"),
@@ -99563,4 +99639,4 @@ var zig = /*#__PURE__*/_mergeNamespaces({
99563
99639
  'default': zigExports
99564
99640
  }, [zigExports]);
99565
99641
 
99566
- export { BrowserSupport, Columns, CustomDomain, DateFormat, ErrorPage, HoneybadgerErrorBoundary, IpRestriction, KeyboardShortcutsPane, SignIn as LoginPage, NeetoWidget, PrivateRoute, PublishBlock, Schedule, ShareViaLink, Sidebar, TimeFormat, destroyBrowserSubscription, handleMetaClick, isMetaKeyPressed, registerBrowserNotifications, useDebounce, useDisplayErrorPage, useErrorDisplayStore, useFuncDebounce, useHotKeys, useIsElementVisibleInDom, useLocalStorage, useOnClickOutside, usePrevious, useUpdateEffect, withImmutableActions, withTitle };
99642
+ export { BrowserSupport, Columns, CustomDomain, DateFormat, ErrorPage, HoneybadgerErrorBoundary, IpRestriction, KeyboardShortcutsPane, SignIn as LoginPage, NeetoWidget, PrivateRoute, PublishBlock, Schedule, ShareViaLink, Sidebar, TimeFormat, destroyBrowserSubscription, handleMetaClick, isMetaKeyPressed, registerBrowserNotifications, useDebounce, useDisplayErrorPage, useErrorDisplayStore, useFuncDebounce, useHotKeys, useIsElementVisibleInDom, useKeyboardShortcutsPaneState, useLocalStorage, useOnClickOutside, usePrevious, useUpdateEffect, withImmutableActions, withTitle };