@atlaskit/smart-hooks 2.9.0 → 2.11.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 +14 -0
- package/dist/cjs/services/use-user-recommendations/analytics.js +1 -1
- package/dist/cjs/services/use-user-recommendations/index.js +4 -3
- package/dist/cjs/utils/transform-recommendations-to-options/index.js +9 -9
- package/dist/es2019/services/use-user-recommendations/analytics.js +1 -1
- package/dist/es2019/services/use-user-recommendations/index.js +2 -1
- package/dist/es2019/utils/transform-recommendations-to-options/index.js +1 -1
- package/dist/esm/services/use-user-recommendations/analytics.js +1 -1
- package/dist/esm/services/use-user-recommendations/index.js +2 -1
- package/dist/esm/utils/transform-recommendations-to-options/index.js +1 -1
- package/dist/types/services/use-user-recommendations/analytics.d.ts +1 -1
- package/dist/types/services/use-user-recommendations/index.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/utils/transform-recommendations-to-options/index.d.ts +1 -1
- package/example-helpers/use-endpoint-mocks.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/smart-hooks
|
|
2
2
|
|
|
3
|
+
## 2.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`366c86f823ba6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/366c86f823ba6) -
|
|
8
|
+
Update i18n NPM package versions for linking-platform,smart-experiences (Group 15)
|
|
9
|
+
|
|
10
|
+
## 2.10.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`4b09602a4596a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4b09602a4596a) -
|
|
15
|
+
Update i18n NPM package versions for linking-platform,smart-experiences (Group 15)
|
|
16
|
+
|
|
3
17
|
## 2.9.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -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.10.0"
|
|
25
25
|
}, attributes)
|
|
26
26
|
};
|
|
27
27
|
};
|
|
@@ -14,7 +14,8 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
|
14
14
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
15
15
|
var _uuid = require("uuid");
|
|
16
16
|
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
17
|
-
var
|
|
17
|
+
var _recommendationsClient = require("@atlaskit/smart-common/recommendations-client");
|
|
18
|
+
var _types = require("@atlaskit/smart-common/types");
|
|
18
19
|
var _useFunctionUsageTracking = _interopRequireDefault(require("../use-function-usage-tracking"));
|
|
19
20
|
var _analytics = require("./analytics");
|
|
20
21
|
var _ufoExperiences = require("./ufoExperiences");
|
|
@@ -31,7 +32,7 @@ var defaultProps = {
|
|
|
31
32
|
var instrumentFailureOption = exports.instrumentFailureOption = [{
|
|
32
33
|
id: 'not-used',
|
|
33
34
|
name: 'User Picker is not instrumented correctly',
|
|
34
|
-
entityType:
|
|
35
|
+
entityType: _types.EntityType.USER,
|
|
35
36
|
avatarUrl: ''
|
|
36
37
|
}];
|
|
37
38
|
var useUserRecommendations = function useUserRecommendations(props) {
|
|
@@ -109,7 +110,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
|
|
|
109
110
|
currentController = typeof AbortController !== 'undefined' ? new AbortController() : null;
|
|
110
111
|
lastAbortController.current = currentController;
|
|
111
112
|
_context.next = 2;
|
|
112
|
-
return (0,
|
|
113
|
+
return (0, _recommendationsClient.fetchUserRecommendations)({
|
|
113
114
|
baseUrl: baseUrl,
|
|
114
115
|
context: {
|
|
115
116
|
childObjectId: childObjectId,
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _types = require("@atlaskit/smart-common/types");
|
|
8
|
+
var _types2 = require("@atlaskit/user-picker/types");
|
|
9
9
|
var _messages = require("../../messages");
|
|
10
10
|
var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
11
11
|
var _entity$attributes, _entity$attributes2;
|
|
@@ -13,7 +13,7 @@ var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
|
13
13
|
return intl.formatMessage(_messages.messages.memberLozengeText);
|
|
14
14
|
}
|
|
15
15
|
if ((_entity$attributes2 = entity.attributes) !== null && _entity$attributes2 !== void 0 && _entity$attributes2.isConfluenceExternalCollaborator) {
|
|
16
|
-
var lozengeTooltipMessage = entity.entityType ===
|
|
16
|
+
var lozengeTooltipMessage = entity.entityType === _types.EntityType.GROUP ? _messages.messages.guestGroupLozengeTooltip : _messages.messages.guestUserLozengeTooltip;
|
|
17
17
|
return {
|
|
18
18
|
text: intl.formatMessage(_messages.messages.guestLozengeText),
|
|
19
19
|
tooltip: intl.formatMessage(lozengeTooltipMessage),
|
|
@@ -24,23 +24,23 @@ var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
|
24
24
|
};
|
|
25
25
|
var transformRecommendation = function transformRecommendation(item, intl) {
|
|
26
26
|
var type = item.entityType;
|
|
27
|
-
if (type ===
|
|
27
|
+
if (type === _types.EntityType.USER) {
|
|
28
28
|
var user = item;
|
|
29
29
|
var lozenge = getLozenzeProperties(user, intl);
|
|
30
30
|
return {
|
|
31
31
|
id: user.id,
|
|
32
|
-
type:
|
|
32
|
+
type: _types2.UserType,
|
|
33
33
|
avatarUrl: user.avatarUrl,
|
|
34
34
|
name: user.name,
|
|
35
35
|
email: user.email,
|
|
36
36
|
lozenge: lozenge
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
if (type ===
|
|
39
|
+
if (type === _types.EntityType.TEAM) {
|
|
40
40
|
var team = item;
|
|
41
41
|
return {
|
|
42
42
|
id: team.id,
|
|
43
|
-
type:
|
|
43
|
+
type: _types2.TeamType,
|
|
44
44
|
description: team.description || '',
|
|
45
45
|
name: team.displayName || '',
|
|
46
46
|
memberCount: team.memberCount,
|
|
@@ -48,12 +48,12 @@ var transformRecommendation = function transformRecommendation(item, intl) {
|
|
|
48
48
|
avatarUrl: team.largeAvatarImageUrl || team.smallAvatarImageUrl
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
if (type ===
|
|
51
|
+
if (type === _types.EntityType.GROUP) {
|
|
52
52
|
var group = item;
|
|
53
53
|
var _lozenge = getLozenzeProperties(group, intl);
|
|
54
54
|
return {
|
|
55
55
|
id: group.id,
|
|
56
|
-
type:
|
|
56
|
+
type: _types2.GroupType,
|
|
57
57
|
name: group.name || '',
|
|
58
58
|
lozenge: _lozenge
|
|
59
59
|
};
|
|
@@ -11,7 +11,7 @@ const createEvent = (eventType, action, actionSubject, attributes = {}) => ({
|
|
|
11
11
|
source: '@atlaskit/smart-hooks/use-user-recommendations',
|
|
12
12
|
attributes: {
|
|
13
13
|
packageName: "@atlaskit/smart-hooks",
|
|
14
|
-
packageVersion: "2.
|
|
14
|
+
packageVersion: "2.10.0",
|
|
15
15
|
...attributes
|
|
16
16
|
}
|
|
17
17
|
});
|
|
@@ -4,7 +4,8 @@ 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
6
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
7
|
-
import {
|
|
7
|
+
import { fetchUserRecommendations } from '@atlaskit/smart-common/recommendations-client';
|
|
8
|
+
import { EntityType } from '@atlaskit/smart-common/types';
|
|
8
9
|
import useFunctionUsageTracking from '../use-function-usage-tracking';
|
|
9
10
|
import { createDefaultAttributes, findUserPosition, fireUserSelectedEvent } from './analytics';
|
|
10
11
|
import { UsersFetchedUfoExperience } from './ufoExperiences';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityType } from '@atlaskit/smart-common';
|
|
1
|
+
import { EntityType } from '@atlaskit/smart-common/types';
|
|
2
2
|
import { GroupType, TeamType, UserType } from '@atlaskit/user-picker/types';
|
|
3
3
|
import { messages } from '../../messages';
|
|
4
4
|
const getLozenzeProperties = (entity, intl) => {
|
|
@@ -16,7 +16,7 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
|
|
|
16
16
|
source: '@atlaskit/smart-hooks/use-user-recommendations',
|
|
17
17
|
attributes: _objectSpread({
|
|
18
18
|
packageName: "@atlaskit/smart-hooks",
|
|
19
|
-
packageVersion: "2.
|
|
19
|
+
packageVersion: "2.10.0"
|
|
20
20
|
}, attributes)
|
|
21
21
|
};
|
|
22
22
|
};
|
|
@@ -10,7 +10,8 @@ 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
12
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
13
|
-
import {
|
|
13
|
+
import { fetchUserRecommendations } from '@atlaskit/smart-common/recommendations-client';
|
|
14
|
+
import { EntityType } from '@atlaskit/smart-common/types';
|
|
14
15
|
import useFunctionUsageTracking from '../use-function-usage-tracking';
|
|
15
16
|
import { createDefaultAttributes, findUserPosition, fireUserSelectedEvent } from './analytics';
|
|
16
17
|
import { UsersFetchedUfoExperience } from './ufoExperiences';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityType } from '@atlaskit/smart-common';
|
|
1
|
+
import { EntityType } from '@atlaskit/smart-common/types';
|
|
2
2
|
import { GroupType, TeamType, UserType } from '@atlaskit/user-picker/types';
|
|
3
3
|
import { messages } from '../../messages';
|
|
4
4
|
var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnalyticsEventPayload } from '@atlaskit/analytics-next/AnalyticsEvent';
|
|
2
2
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
3
|
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
4
|
-
import {
|
|
4
|
+
import type { UserSearchItem } from '@atlaskit/smart-common/types';
|
|
5
5
|
import { type UseUserRecommendationsProps } from '../../types';
|
|
6
6
|
export declare const findUserPosition: (loadedUsers: UserSearchItem[], userId: string) => number;
|
|
7
7
|
export declare const createDefaultAttributes: (props: UseUserRecommendationsProps, renderId: string, sessionId: string, query: string) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MemoizedFn } from 'memoize-one';
|
|
2
|
-
import { EntityType, type UserSearchItem } from '@atlaskit/smart-common';
|
|
2
|
+
import { EntityType, type UserSearchItem } from '@atlaskit/smart-common/types';
|
|
3
3
|
import type { UseUserRecommendationsProps } from '../../types';
|
|
4
4
|
export declare const instrumentFailureOption: {
|
|
5
5
|
id: string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UserSearchProductAttributes, UserSearchQuery } from '@atlaskit/smart-common';
|
|
1
|
+
import type { UserSearchProductAttributes, UserSearchQuery } from '@atlaskit/smart-common/types';
|
|
2
2
|
export type UseUserRecommendationsProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Base url override for downstream APIs.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IntlShape } from 'react-intl';
|
|
2
|
-
import { type UserSearchItem } from '@atlaskit/smart-common';
|
|
2
|
+
import { type UserSearchItem } from '@atlaskit/smart-common/types';
|
|
3
3
|
import { type OptionData } from '@atlaskit/user-picker/types';
|
|
4
4
|
export default _default;
|
|
5
5
|
declare function _default(recommendations: UserSearchItem[], intl: IntlShape): OptionData[];
|
|
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import fetchMock from 'fetch-mock/cjs/client';
|
|
4
4
|
|
|
5
|
-
import { EntityType, type UserSearchResponse } from '@atlaskit/smart-common';
|
|
5
|
+
import { EntityType, type UserSearchResponse } from '@atlaskit/smart-common/types';
|
|
6
6
|
|
|
7
7
|
import { mockUserSearchData } from './mock-urs-data';
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-hooks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"team": "Search Platform: Search Experience"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@atlaskit/afm-i18n-platform-smart-experiences-smart-hooks": "2.
|
|
20
|
+
"@atlaskit/afm-i18n-platform-smart-experiences-smart-hooks": "2.289.0",
|
|
21
21
|
"@atlaskit/analytics-gas-types": "^6.2.0",
|
|
22
22
|
"@atlaskit/analytics-listeners": "^11.4.0",
|
|
23
|
-
"@atlaskit/analytics-next": "^12.
|
|
23
|
+
"@atlaskit/analytics-next": "^12.6.0",
|
|
24
24
|
"@atlaskit/smart-common": "^3.1.0",
|
|
25
25
|
"@atlaskit/ufo": "^2.0.0",
|
|
26
|
-
"@atlaskit/user-picker": "^14.
|
|
26
|
+
"@atlaskit/user-picker": "^14.3.0",
|
|
27
27
|
"@babel/runtime": "^7.0.0",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
29
29
|
"memoize-one": "^6.0.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@atlaskit/textfield": "^10.2.0",
|
|
38
38
|
"@atlassian/a11y-jest-testing": "^0.17.0",
|
|
39
|
-
"@atlassian/ufo": "^1.
|
|
39
|
+
"@atlassian/ufo": "^1.1.0",
|
|
40
40
|
"@atlassian/workbench": "workspace:*",
|
|
41
41
|
"@testing-library/react": "^16.3.0",
|
|
42
42
|
"@welldone-software/why-did-you-render": "^6.2.0",
|