@bigbinary/neeto-commons-frontend 2.0.103 → 2.0.105

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/react-utils.d.ts CHANGED
@@ -653,42 +653,34 @@ export function useHotKeys(hotkey: string | string[], handler: (event: React.Key
653
653
  export function useStateWithDependency<T>(defaultValue: T, dependencies?: any[]): T;
654
654
  /**
655
655
  *
656
- * This hook returns a function that can be used to register navigation checkpoint
656
+ * This hook will store the path as the value for the key in a Zustand store. This
657
657
  *
658
- * to a Zustand store.
659
- *
660
- * The function returned by this hook accepts key and path as arguments. It
661
- *
662
- * will store the path as the value for the key in a Zustand store. This
663
- *
664
- * registered checkpoint can be retrieved using the useNavigationCheckpoint hook.
658
+ * registered checkpoint can be retrieved using the useNavigationCheckpoints hook.
665
659
  *
666
660
  * @example
667
661
  *
668
- * const registerNavigationCheckpoint = useRegisterNavigationCheckpoint();
669
- *
670
- * useEffect(() => {
671
- * registerNavigationCheckpoint(CHECKPOINT_KEY, CHECKPOINT_PATH);
672
- * }, []);
662
+ * useRegisterNavigationCheckpoint(CHECKPOINT_KEY, CHECKPOINT_PATH);
673
663
  * @endexample
674
664
  */
675
- export function useRegisterNavigationCheckpoint(): (key: string, path: string) => void;
665
+ export function useRegisterNavigationCheckpoint(key: string, path: string): void;
676
666
  /**
677
667
  *
678
- * This hook returns the registered navigation checkpoint.
668
+ * This function returns the specified navigation checkpoints.
679
669
  *
680
670
  * @example
681
671
  *
682
- * const navigationCheckpoint = useRegisterNavigationCheckpoint(CHECK_POINT_KEY);
672
+ * const navigationCheckpoints = useNavigationCheckpoints(checkpointKey1, checkpointKey2);
683
673
  *
684
674
  * return (
685
675
  * <>
686
- * <Link to={navigationCheckpoint}>Navigate</Link>
676
+ * <Link to={navigationCheckpoints[checkpointKey1]}>Navigate</Link>
687
677
  * </>
688
678
  * );
689
679
  * @endexample
690
680
  */
691
- export function useNavigationCheckpoint(key: string): string;
681
+ export function useNavigationCheckpoints(...keys: string[]): {
682
+ [key: string]: string;
683
+ };
692
684
  /**
693
685
  *
694
686
  * An HOC which provides the t function from react-i18next to the wrapped
package/react-utils.js CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import React__default, { useEffect, useState, useDebugValue, useRef, useMemo } from 'react';
3
3
  import { Honeybadger, HoneybadgerErrorBoundary as HoneybadgerErrorBoundary$1 } from '@honeybadger-io/react';
4
4
  import { Typography, Button } from '@bigbinary/neetoui';
5
- import { isNil, includes, __, prop, toPairs, mergeLeft, curry, keys, isEmpty, mergeDeepLeft, path, omit } from 'ramda';
5
+ import { isNil, includes, __, prop, toPairs, mergeLeft, curry, keys, isEmpty, mergeDeepLeft, pick, omit } from 'ramda';
6
6
  import { useTranslation, Trans, withTranslation } from 'react-i18next';
7
7
  import ErrorPage from '@bigbinary/neeto-molecules/ErrorPage';
8
8
  import { Route, Redirect } from 'react-router-dom';
@@ -4161,11 +4161,19 @@ var useCheckpointStore = create$1(withImmutableActions(function (set) {
4161
4161
  }
4162
4162
  };
4163
4163
  }));
4164
- var useRegisterNavigationCheckpoint = function useRegisterNavigationCheckpoint() {
4165
- return useCheckpointStore(prop("setCheckpoint"));
4164
+ var useRegisterNavigationCheckpoint = function useRegisterNavigationCheckpoint(key, path) {
4165
+ var setCheckpoint = useCheckpointStore(prop("setCheckpoint"));
4166
+ useEffect(function () {
4167
+ setCheckpoint(key, path);
4168
+ }, [key, path]);
4166
4169
  };
4167
- var useNavigationCheckpoint = function useNavigationCheckpoint(key) {
4168
- return useCheckpointStore(path(["checkpoints", key]));
4170
+ var useNavigationCheckpoints = function useNavigationCheckpoints() {
4171
+ for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
4172
+ keys[_key] = arguments[_key];
4173
+ }
4174
+ return useCheckpointStore(function (store) {
4175
+ return pick(keys, store.checkpoints);
4176
+ }, shallow);
4169
4177
  };
4170
4178
 
4171
4179
  var useStateWithDependency = function useStateWithDependency(defaultValue) {
@@ -4709,5 +4717,5 @@ var useUpdateEffect = function useUpdateEffect(callback) {
4709
4717
  }, dependencies);
4710
4718
  };
4711
4719
 
4712
- export { HoneybadgerErrorBoundary, PrivateRoute, destroyBrowserSubscription, handleMetaClick, isMetaKeyPressed, registerBrowserNotifications, useDebounce, useDisplayErrorPage, useErrorDisplayStore, useFuncDebounce, useHotKeys, useIsElementVisibleInDom, useKeyboardShortcutsPaneState, useLocalStorage, useNavigationCheckpoint, useOnClickOutside, usePrevious, useRegisterNavigationCheckpoint, useStateWithDependency, useTimer, useUpdateEffect, withImmutableActions, withT, withTitle };
4720
+ export { HoneybadgerErrorBoundary, PrivateRoute, destroyBrowserSubscription, handleMetaClick, isMetaKeyPressed, registerBrowserNotifications, useDebounce, useDisplayErrorPage, useErrorDisplayStore, useFuncDebounce, useHotKeys, useIsElementVisibleInDom, useKeyboardShortcutsPaneState, useLocalStorage, useNavigationCheckpoints, useOnClickOutside, usePrevious, useRegisterNavigationCheckpoint, useStateWithDependency, useTimer, useUpdateEffect, withImmutableActions, withT, withTitle };
4713
4721
  //# sourceMappingURL=react-utils.js.map