@atlaskit/smart-hooks 0.3.4 → 0.3.5

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/smart-hooks
2
2
 
3
+ ## 0.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d3ed1b65a2181`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d3ed1b65a2181) -
8
+ Add @atlassian/a11y-jest-testing to devDependencies.
9
+
3
10
  ## 0.3.4
4
11
 
5
12
  ### Patch Changes
@@ -19,7 +19,7 @@ var _useFunctionUsageTracking = _interopRequireDefault(require("../use-function-
19
19
  var _analytics = require("./analytics");
20
20
  var _ufoExperiences = require("./ufoExperiences");
21
21
  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; }
22
- 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) { (0, _defineProperty2.default)(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; }
22
+ 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) { (0, _defineProperty2.default)(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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
23
23
  var MAX_NUMBER_RESULTS = 25;
24
24
  var DEFAULT_DEBOUNCE_TIME_MS = 150;
25
25
  var defaultProps = {
@@ -64,6 +64,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
64
64
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
65
65
  error = _useState6[0],
66
66
  setError = _useState6[1];
67
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
67
68
  var _useState7 = (0, _react.useState)(function () {
68
69
  return (0, _uuid.v4)();
69
70
  }),
@@ -96,6 +97,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
96
97
  case 0:
97
98
  setIsLoading(true);
98
99
  // restart session
100
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
99
101
  sessionId.current = (0, _uuid.v4)();
100
102
  _ufoExperiences.UsersFetchedUfoExperience.getInstance(fieldId).start();
101
103
  _context.prev = 3;
@@ -1,6 +1,7 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import debounce from 'lodash/debounce';
3
3
  import memoizeOne from 'memoize-one';
4
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
5
  import { v4 as uuid } from 'uuid';
5
6
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
7
  import { EntityType, fetchUserRecommendations } from '@atlaskit/smart-common';
@@ -46,6 +47,7 @@ const useUserRecommendations = props => {
46
47
  const [recommendations, setRecommendations] = useState([]);
47
48
  const [isLoading, setIsLoading] = useState(false);
48
49
  const [error, setError] = useState();
50
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
49
51
  const [renderId] = useState(() => uuid());
50
52
  const sessionId = useRef('');
51
53
  const currentQuery = useRef('');
@@ -70,6 +72,7 @@ const useUserRecommendations = props => {
70
72
  const fetchRecommendations = useCallback(async query => {
71
73
  setIsLoading(true);
72
74
  // restart session
75
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
73
76
  sessionId.current = uuid();
74
77
  UsersFetchedUfoExperience.getInstance(fieldId).start();
75
78
  try {
@@ -7,6 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
8
  import debounce from 'lodash/debounce';
9
9
  import memoizeOne from 'memoize-one';
10
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
10
11
  import { v4 as uuid } from 'uuid';
11
12
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
12
13
  import { EntityType, fetchUserRecommendations } from '@atlaskit/smart-common';
@@ -57,6 +58,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
57
58
  _useState6 = _slicedToArray(_useState5, 2),
58
59
  error = _useState6[0],
59
60
  setError = _useState6[1];
61
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
60
62
  var _useState7 = useState(function () {
61
63
  return uuid();
62
64
  }),
@@ -89,6 +91,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
89
91
  case 0:
90
92
  setIsLoading(true);
91
93
  // restart session
94
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
92
95
  sessionId.current = uuid();
93
96
  UsersFetchedUfoExperience.getInstance(fieldId).start();
94
97
  _context.prev = 3;
@@ -1,3 +1,4 @@
1
+ import { type MemoizedFn } from 'memoize-one';
1
2
  import { EntityType, type UserSearchItem } from '@atlaskit/smart-common';
2
3
  import type { UseUserRecommendationsProps } from '../../types';
3
4
  export declare const instrumentFailureOption: {
@@ -7,14 +8,14 @@ export declare const instrumentFailureOption: {
7
8
  avatarUrl: string;
8
9
  }[];
9
10
  declare const useUserRecommendations: (props: UseUserRecommendationsProps) => {
10
- recommendations: UserSearchItem[] | {
11
+ recommendations: {
11
12
  id: string;
12
13
  name: string;
13
14
  entityType: EntityType;
14
15
  avatarUrl: string;
15
- }[];
16
- triggerSearchFactory: import("memoize-one").MemoizedFn<() => (query?: string) => void>;
17
- selectUserFactory: import("memoize-one").MemoizedFn<() => (userId: string) => void>;
16
+ }[] | UserSearchItem[];
17
+ triggerSearchFactory: MemoizedFn<() => (query?: string) => void>;
18
+ selectUserFactory: MemoizedFn<() => (userId: string) => void>;
18
19
  isLoading: boolean;
19
20
  error: any;
20
21
  };
@@ -1,3 +1,4 @@
1
+ import { type MemoizedFn } from 'memoize-one';
1
2
  import { EntityType, type UserSearchItem } from '@atlaskit/smart-common';
2
3
  import type { UseUserRecommendationsProps } from '../../types';
3
4
  export declare const instrumentFailureOption: {
@@ -7,14 +8,14 @@ export declare const instrumentFailureOption: {
7
8
  avatarUrl: string;
8
9
  }[];
9
10
  declare const useUserRecommendations: (props: UseUserRecommendationsProps) => {
10
- recommendations: UserSearchItem[] | {
11
+ recommendations: {
11
12
  id: string;
12
13
  name: string;
13
14
  entityType: EntityType;
14
15
  avatarUrl: string;
15
- }[];
16
- triggerSearchFactory: import("memoize-one").MemoizedFn<() => (query?: string) => void>;
17
- selectUserFactory: import("memoize-one").MemoizedFn<() => (userId: string) => void>;
16
+ }[] | UserSearchItem[];
17
+ triggerSearchFactory: MemoizedFn<() => (query?: string) => void>;
18
+ selectUserFactory: MemoizedFn<() => (userId: string) => void>;
18
19
  isLoading: boolean;
19
20
  error: any;
20
21
  };
@@ -39,7 +39,7 @@ const mockEndpoints = () => {
39
39
 
40
40
  // Simple hook for using inside example pages, which sets up the mock API responses, and then
41
41
  // un-sets the mock API responses when the example is exited.
42
- export const useEndpointMocks = () => {
42
+ export const useEndpointMocks = (): void => {
43
43
  useEffect(() => {
44
44
  mockEndpoints();
45
45
  return () => fetchMock.reset();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-hooks",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,11 +27,11 @@
27
27
  "dependencies": {
28
28
  "@atlaskit/afm-i18n-platform-smart-experiences-smart-hooks": "2.7.0",
29
29
  "@atlaskit/analytics-gas-types": "^5.1.0",
30
- "@atlaskit/analytics-listeners": "^9.0.0",
30
+ "@atlaskit/analytics-listeners": "^9.3.0",
31
31
  "@atlaskit/analytics-next": "^11.1.0",
32
32
  "@atlaskit/smart-common": "^2.0.0",
33
33
  "@atlaskit/ufo": "^0.4.0",
34
- "@atlaskit/user-picker": "^11.7.0",
34
+ "@atlaskit/user-picker": "^11.20.0",
35
35
  "@babel/runtime": "^7.0.0",
36
36
  "lodash": "^4.17.21",
37
37
  "memoize-one": "^6.0.0",
@@ -42,9 +42,9 @@
42
42
  "react-intl-next": "npm:react-intl@^5.18.1"
43
43
  },
44
44
  "devDependencies": {
45
+ "@atlassian/a11y-jest-testing": "^0.8.0",
45
46
  "@storybook/addon-knobs": "^6.4.0",
46
- "@testing-library/react": "^13.4.0",
47
- "@testing-library/react-hooks": "^8.0.1",
47
+ "@testing-library/react": "^16.3.0",
48
48
  "@welldone-software/why-did-you-render": "^6.2.0",
49
49
  "enzyme": "^3.10.0",
50
50
  "fetch-mock": "^8.0.0",