@atlaskit/smart-hooks 2.2.0 → 2.3.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 +11 -0
- package/dist/cjs/services/use-user-recommendations/analytics.js +4 -4
- package/dist/cjs/services/use-user-recommendations/index.js +2 -2
- package/dist/cjs/services/use-user-recommendations/ufoExperiences.js +5 -4
- package/dist/es2019/services/use-user-recommendations/analytics.js +4 -3
- package/dist/es2019/services/use-user-recommendations/index.js +1 -1
- package/dist/es2019/services/use-user-recommendations/ufoExperiences.js +2 -1
- package/dist/esm/services/use-user-recommendations/analytics.js +4 -3
- package/dist/esm/services/use-user-recommendations/index.js +1 -1
- package/dist/esm/services/use-user-recommendations/ufoExperiences.js +2 -1
- package/dist/types/services/use-user-recommendations/analytics.d.ts +3 -1
- package/dist/types/services/use-user-recommendations/ufoExperiences.d.ts +1 -1
- package/package.json +10 -8
- package/report.api.md +0 -85
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/smart-hooks
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`bd2c5b0112185`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd2c5b0112185) -
|
|
8
|
+
Remove stale API report artifacts from published Platform packages.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 2.2.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.fireUserSelectedEvent = exports.findUserPosition = exports.createDefaultAttributes = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _types = require("@atlaskit/analytics-listeners/types");
|
|
11
|
+
var _createAndFireEvents = _interopRequireDefault(require("@atlaskit/analytics-next/createAndFireEvents"));
|
|
12
12
|
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; }
|
|
13
13
|
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 @typescript-eslint/consistent-type-imports
|
|
14
|
-
var createAndFireEventInElementsChannel = (0,
|
|
14
|
+
var createAndFireEventInElementsChannel = (0, _createAndFireEvents.default)(_types.FabricChannel.elements);
|
|
15
15
|
var createEvent = function createEvent(eventType, action, actionSubject) {
|
|
16
16
|
var attributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
17
17
|
return {
|
|
@@ -21,7 +21,7 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
|
|
|
21
21
|
source: '@atlaskit/smart-hooks/use-user-recommendations',
|
|
22
22
|
attributes: _objectSpread({
|
|
23
23
|
packageName: "@atlaskit/smart-hooks",
|
|
24
|
-
packageVersion: "2.
|
|
24
|
+
packageVersion: "2.2.0"
|
|
25
25
|
}, attributes)
|
|
26
26
|
};
|
|
27
27
|
};
|
|
@@ -13,7 +13,7 @@ var _react = require("react");
|
|
|
13
13
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
14
14
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
15
15
|
var _uuid = require("uuid");
|
|
16
|
-
var
|
|
16
|
+
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
17
17
|
var _smartCommon = require("@atlaskit/smart-common");
|
|
18
18
|
var _useFunctionUsageTracking = _interopRequireDefault(require("../use-function-usage-tracking"));
|
|
19
19
|
var _analytics = require("./analytics");
|
|
@@ -73,7 +73,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
|
|
|
73
73
|
var sessionId = (0, _react.useRef)('');
|
|
74
74
|
var currentQuery = (0, _react.useRef)('');
|
|
75
75
|
var lastAbortController = (0, _react.useRef)();
|
|
76
|
-
var _useAnalyticsEvents = (0,
|
|
76
|
+
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
77
77
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
78
78
|
var getAnalyticsAttributes = (0, _react.useCallback)(function () {
|
|
79
79
|
return _objectSpread({}, (0, _analytics.createDefaultAttributes)({
|
|
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.UsersFetchedUfoExperience = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _concurrentExperience = require("@atlaskit/ufo/concurrent-experience");
|
|
8
|
+
var _experienceTypes = require("@atlaskit/ufo/experience-types");
|
|
8
9
|
var COMPONENT_NAME = 'smart-hooks.use-user-recommendations';
|
|
9
|
-
var UsersFetchedUfoExperience = exports.UsersFetchedUfoExperience = new
|
|
10
|
+
var UsersFetchedUfoExperience = exports.UsersFetchedUfoExperience = new _concurrentExperience.ConcurrentExperience('users-fetched', {
|
|
10
11
|
platform: {
|
|
11
12
|
component: COMPONENT_NAME
|
|
12
13
|
},
|
|
13
|
-
type:
|
|
14
|
-
performanceType:
|
|
14
|
+
type: _experienceTypes.ExperienceTypes.Load,
|
|
15
|
+
performanceType: _experienceTypes.ExperiencePerformanceTypes.InlineResult
|
|
15
16
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { TRACK_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
2
|
-
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
2
|
+
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import createAndFireEvent from '@atlaskit/analytics-next/createAndFireEvents';
|
|
5
6
|
const createAndFireEventInElementsChannel = createAndFireEvent(FabricChannel.elements);
|
|
6
7
|
const createEvent = (eventType, action, actionSubject, attributes = {}) => ({
|
|
7
8
|
eventType,
|
|
@@ -10,7 +11,7 @@ const createEvent = (eventType, action, actionSubject, attributes = {}) => ({
|
|
|
10
11
|
source: '@atlaskit/smart-hooks/use-user-recommendations',
|
|
11
12
|
attributes: {
|
|
12
13
|
packageName: "@atlaskit/smart-hooks",
|
|
13
|
-
packageVersion: "2.
|
|
14
|
+
packageVersion: "2.2.0",
|
|
14
15
|
...attributes
|
|
15
16
|
}
|
|
16
17
|
});
|
|
@@ -3,7 +3,7 @@ import debounce from 'lodash/debounce';
|
|
|
3
3
|
import memoizeOne from 'memoize-one';
|
|
4
4
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
5
|
import { v4 as uuid } from 'uuid';
|
|
6
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
7
7
|
import { EntityType, fetchUserRecommendations } from '@atlaskit/smart-common';
|
|
8
8
|
import useFunctionUsageTracking from '../use-function-usage-tracking';
|
|
9
9
|
import { createDefaultAttributes, findUserPosition, fireUserSelectedEvent } from './analytics';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ConcurrentExperience
|
|
1
|
+
import { ConcurrentExperience } from '@atlaskit/ufo/concurrent-experience';
|
|
2
|
+
import { ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo/experience-types';
|
|
2
3
|
const COMPONENT_NAME = 'smart-hooks.use-user-recommendations';
|
|
3
4
|
export const UsersFetchedUfoExperience = new ConcurrentExperience('users-fetched', {
|
|
4
5
|
platform: {
|
|
@@ -2,9 +2,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
4
|
import { TRACK_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
|
|
5
|
-
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
5
|
+
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import createAndFireEvent from '@atlaskit/analytics-next/createAndFireEvents';
|
|
8
9
|
var createAndFireEventInElementsChannel = createAndFireEvent(FabricChannel.elements);
|
|
9
10
|
var createEvent = function createEvent(eventType, action, actionSubject) {
|
|
10
11
|
var attributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -15,7 +16,7 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
|
|
|
15
16
|
source: '@atlaskit/smart-hooks/use-user-recommendations',
|
|
16
17
|
attributes: _objectSpread({
|
|
17
18
|
packageName: "@atlaskit/smart-hooks",
|
|
18
|
-
packageVersion: "2.
|
|
19
|
+
packageVersion: "2.2.0"
|
|
19
20
|
}, attributes)
|
|
20
21
|
};
|
|
21
22
|
};
|
|
@@ -9,7 +9,7 @@ import debounce from 'lodash/debounce';
|
|
|
9
9
|
import memoizeOne from 'memoize-one';
|
|
10
10
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
11
11
|
import { v4 as uuid } from 'uuid';
|
|
12
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
13
13
|
import { EntityType, fetchUserRecommendations } from '@atlaskit/smart-common';
|
|
14
14
|
import useFunctionUsageTracking from '../use-function-usage-tracking';
|
|
15
15
|
import { createDefaultAttributes, findUserPosition, fireUserSelectedEvent } from './analytics';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ConcurrentExperience
|
|
1
|
+
import { ConcurrentExperience } from '@atlaskit/ufo/concurrent-experience';
|
|
2
|
+
import { ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo/experience-types';
|
|
2
3
|
var COMPONENT_NAME = 'smart-hooks.use-user-recommendations';
|
|
3
4
|
export var UsersFetchedUfoExperience = new ConcurrentExperience('users-fetched', {
|
|
4
5
|
platform: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AnalyticsEventPayload } from '@atlaskit/analytics-next/AnalyticsEvent';
|
|
2
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
|
+
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
2
4
|
import { type UserSearchItem } from '@atlaskit/smart-common';
|
|
3
5
|
import { type UseUserRecommendationsProps } from '../../types';
|
|
4
6
|
export declare const findUserPosition: (loadedUsers: UserSearchItem[], userId: string) => number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ConcurrentExperience } from '@atlaskit/ufo';
|
|
1
|
+
import { ConcurrentExperience } from '@atlaskit/ufo/concurrent-experience';
|
|
2
2
|
export declare const UsersFetchedUfoExperience: ConcurrentExperience;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-hooks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@atlaskit/afm-i18n-platform-smart-experiences-smart-hooks": "2.202.0",
|
|
21
|
-
"@atlaskit/analytics-gas-types": "^6.
|
|
22
|
-
"@atlaskit/analytics-listeners": "^11.
|
|
23
|
-
"@atlaskit/analytics-next": "^12.
|
|
24
|
-
"@atlaskit/smart-common": "^3.
|
|
25
|
-
"@atlaskit/ufo": "^1.
|
|
26
|
-
"@atlaskit/user-picker": "^13.
|
|
21
|
+
"@atlaskit/analytics-gas-types": "^6.2.0",
|
|
22
|
+
"@atlaskit/analytics-listeners": "^11.3.0",
|
|
23
|
+
"@atlaskit/analytics-next": "^12.5.0",
|
|
24
|
+
"@atlaskit/smart-common": "^3.1.0",
|
|
25
|
+
"@atlaskit/ufo": "^1.1.0",
|
|
26
|
+
"@atlaskit/user-picker": "^13.12.0",
|
|
27
27
|
"@babel/runtime": "^7.0.0",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
29
29
|
"memoize-one": "^6.0.0",
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@
|
|
37
|
+
"@atlaskit/textfield": "^10.2.0",
|
|
38
|
+
"@atlassian/a11y-jest-testing": "^0.17.0",
|
|
39
|
+
"@atlassian/ufo": "^0.10.0",
|
|
38
40
|
"@testing-library/react": "^16.3.0",
|
|
39
41
|
"@welldone-software/why-did-you-render": "^6.2.0",
|
|
40
42
|
"enzyme": "^3.10.0",
|
package/report.api.md
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<!-- API Report Version: 2.3 -->
|
|
2
|
-
|
|
3
|
-
## API Report File for "@atlaskit/smart-hooks"
|
|
4
|
-
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
6
|
-
> [API Extractor](https://api-extractor.com/).
|
|
7
|
-
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
8
|
-
|
|
9
|
-
### Table of contents
|
|
10
|
-
|
|
11
|
-
- [Main Entry Types](#main-entry-types)
|
|
12
|
-
- [Peer Dependencies](#peer-dependencies)
|
|
13
|
-
|
|
14
|
-
### Main Entry Types
|
|
15
|
-
|
|
16
|
-
<!--SECTION START: Main Entry Types-->
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
import { EntityType } from '@atlaskit/smart-common';
|
|
20
|
-
import { IntlShape } from 'react-intl';
|
|
21
|
-
import { MemoizedFn } from 'memoize-one';
|
|
22
|
-
import { OptionData } from '@atlaskit/user-picker';
|
|
23
|
-
import { UserSearchItem } from '@atlaskit/smart-common';
|
|
24
|
-
import type { UserSearchProductAttributes } from '@atlaskit/smart-common';
|
|
25
|
-
import type { UserSearchQuery } from '@atlaskit/smart-common';
|
|
26
|
-
|
|
27
|
-
// @public (undocumented)
|
|
28
|
-
export const transformRecommendationsToOptions: (
|
|
29
|
-
recommendations: UserSearchItem[],
|
|
30
|
-
intl: IntlShape,
|
|
31
|
-
) => OptionData[];
|
|
32
|
-
|
|
33
|
-
// @public (undocumented)
|
|
34
|
-
export const useUserRecommendations: (props: UseUserRecommendationsProps) => {
|
|
35
|
-
recommendations:
|
|
36
|
-
| UserSearchItem[]
|
|
37
|
-
| {
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
entityType: EntityType;
|
|
41
|
-
avatarUrl: string;
|
|
42
|
-
}[];
|
|
43
|
-
triggerSearchFactory: MemoizedFn<() => (query?: string) => void>;
|
|
44
|
-
selectUserFactory: MemoizedFn<() => (userId: string) => void>;
|
|
45
|
-
isLoading: boolean;
|
|
46
|
-
error: any;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// @public (undocumented)
|
|
50
|
-
type UseUserRecommendationsProps = {
|
|
51
|
-
baseUrl?: string;
|
|
52
|
-
childObjectId?: string;
|
|
53
|
-
containerId?: string;
|
|
54
|
-
debounceTimeMs?: number;
|
|
55
|
-
fieldId: string;
|
|
56
|
-
includeUsers?: boolean;
|
|
57
|
-
includeGroups?: boolean;
|
|
58
|
-
includeTeams?: boolean;
|
|
59
|
-
maxNumberOfResults?: number;
|
|
60
|
-
objectId?: string;
|
|
61
|
-
preload?: boolean;
|
|
62
|
-
principalId?: string;
|
|
63
|
-
productAttributes?: UserSearchProductAttributes;
|
|
64
|
-
productKey: string;
|
|
65
|
-
cpusSearchQuery?: UserSearchQuery;
|
|
66
|
-
tenantId: string;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// (No @packageDocumentation comment for this package)
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
<!--SECTION END: Main Entry Types-->
|
|
73
|
-
|
|
74
|
-
### Peer Dependencies
|
|
75
|
-
|
|
76
|
-
<!--SECTION START: Peer Dependencies-->
|
|
77
|
-
|
|
78
|
-
```json
|
|
79
|
-
{
|
|
80
|
-
"react": "^16.8.0",
|
|
81
|
-
"react-intl": "npm:react-intl@^5.18.1"
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
<!--SECTION END: Peer Dependencies-->
|