@atlaskit/smart-hooks 0.2.8 → 0.2.10
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 +64 -16
- package/LICENSE +13 -0
- package/dist/cjs/services/use-user-recommendations/analytics.js +1 -1
- package/dist/es2019/services/use-user-recommendations/analytics.js +1 -1
- package/dist/esm/services/use-user-recommendations/analytics.js +1 -1
- package/dist/types/services/use-user-recommendations/analytics.d.ts +3 -3
- package/dist/types/services/use-user-recommendations/index.d.ts +1 -1
- package/dist/types/utils/transform-recommendations-to-options/index.d.ts +3 -3
- package/dist/types-ts4.5/services/use-user-recommendations/analytics.d.ts +3 -3
- package/dist/types-ts4.5/services/use-user-recommendations/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/transform-recommendations-to-options/index.d.ts +3 -3
- package/example-helpers/mock-urs-data.ts +76 -77
- package/example-helpers/use-endpoint-mocks.ts +31 -31
- package/package.json +85 -86
- package/report.api.md +34 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,59 +1,92 @@
|
|
|
1
1
|
# @atlaskit/smart-hooks
|
|
2
2
|
|
|
3
|
+
## 0.2.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 0.2.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#95740](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95740)
|
|
14
|
+
[`a15da04ef56a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a15da04ef56a) -
|
|
15
|
+
license update
|
|
16
|
+
|
|
3
17
|
## 0.2.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
6
20
|
|
|
7
|
-
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
21
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
22
|
+
[`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
|
|
23
|
+
Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
8
24
|
|
|
9
25
|
## 0.2.7
|
|
10
26
|
|
|
11
27
|
### Patch Changes
|
|
12
28
|
|
|
13
|
-
- [#40652](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40652)
|
|
29
|
+
- [#40652](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40652)
|
|
30
|
+
[`097ce4dd212`](https://bitbucket.org/atlassian/atlassian-frontend/commits/097ce4dd212) - Changes
|
|
31
|
+
for remove cyclic dependency in AFE(@atlaskit/smart-hooks,@atlassian/notification-common,
|
|
32
|
+
@atlassian/notification-test-utils)
|
|
14
33
|
|
|
15
34
|
## 0.2.6
|
|
16
35
|
|
|
17
36
|
### Patch Changes
|
|
18
37
|
|
|
19
|
-
- [#38162](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38162)
|
|
38
|
+
- [#38162](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38162)
|
|
39
|
+
[`fd6bb9c9184`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd6bb9c9184) - Delete
|
|
40
|
+
version.json
|
|
20
41
|
- Updated dependencies
|
|
21
42
|
|
|
22
43
|
## 0.2.5
|
|
23
44
|
|
|
24
45
|
### Patch Changes
|
|
25
46
|
|
|
26
|
-
- [#37925](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37925)
|
|
47
|
+
- [#37925](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37925)
|
|
48
|
+
[`f01deb5e6ab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f01deb5e6ab) - Use
|
|
49
|
+
injected env vars instead of version.json
|
|
27
50
|
|
|
28
51
|
## 0.2.4
|
|
29
52
|
|
|
30
53
|
### Patch Changes
|
|
31
54
|
|
|
32
|
-
- [#37101](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37101)
|
|
55
|
+
- [#37101](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37101)
|
|
56
|
+
[`78f0d4b929c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/78f0d4b929c) - [ux]
|
|
57
|
+
Color of guest lozenges in the smartUserPicker changed from purple ('new') to grey ('default')
|
|
33
58
|
|
|
34
59
|
## 0.2.3
|
|
35
60
|
|
|
36
61
|
### Patch Changes
|
|
37
62
|
|
|
38
|
-
- [#34443](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34443)
|
|
63
|
+
- [#34443](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34443)
|
|
64
|
+
[`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing
|
|
65
|
+
unused dependencies and dev dependencies
|
|
39
66
|
|
|
40
67
|
## 0.2.2
|
|
41
68
|
|
|
42
69
|
### Patch Changes
|
|
43
70
|
|
|
44
|
-
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793)
|
|
71
|
+
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793)
|
|
72
|
+
[`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure
|
|
73
|
+
legacy types are published for TS 4.5-4.8
|
|
45
74
|
|
|
46
75
|
## 0.2.1
|
|
47
76
|
|
|
48
77
|
### Patch Changes
|
|
49
78
|
|
|
50
|
-
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649)
|
|
79
|
+
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649)
|
|
80
|
+
[`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade
|
|
81
|
+
Typescript from `4.5.5` to `4.9.5`
|
|
51
82
|
|
|
52
83
|
## 0.2.0
|
|
53
84
|
|
|
54
85
|
### Minor Changes
|
|
55
86
|
|
|
56
|
-
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258)
|
|
87
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258)
|
|
88
|
+
[`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip
|
|
89
|
+
minor dependency bump
|
|
57
90
|
|
|
58
91
|
### Patch Changes
|
|
59
92
|
|
|
@@ -63,7 +96,9 @@
|
|
|
63
96
|
|
|
64
97
|
### Patch Changes
|
|
65
98
|
|
|
66
|
-
- [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424)
|
|
99
|
+
- [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424)
|
|
100
|
+
[`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY
|
|
101
|
+
remove before merging to master; dupe adf-schema via adf-utils
|
|
67
102
|
|
|
68
103
|
## 0.1.8
|
|
69
104
|
|
|
@@ -81,19 +116,25 @@
|
|
|
81
116
|
|
|
82
117
|
### Patch Changes
|
|
83
118
|
|
|
84
|
-
- [#24874](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24874)
|
|
119
|
+
- [#24874](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24874)
|
|
120
|
+
[`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade
|
|
121
|
+
Typescript from `4.3.5` to `4.5.5`
|
|
85
122
|
|
|
86
123
|
## 0.1.5
|
|
87
124
|
|
|
88
125
|
### Patch Changes
|
|
89
126
|
|
|
90
|
-
- [#24492](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24492)
|
|
127
|
+
- [#24492](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24492)
|
|
128
|
+
[`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade
|
|
129
|
+
Typescript from `4.2.4` to `4.3.5`.
|
|
91
130
|
|
|
92
131
|
## 0.1.4
|
|
93
132
|
|
|
94
133
|
### Patch Changes
|
|
95
134
|
|
|
96
|
-
- [#20650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20650)
|
|
135
|
+
- [#20650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20650)
|
|
136
|
+
[`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade
|
|
137
|
+
to TypeScript 4.2.4
|
|
97
138
|
|
|
98
139
|
## 0.1.3
|
|
99
140
|
|
|
@@ -111,14 +152,18 @@
|
|
|
111
152
|
|
|
112
153
|
### Patch Changes
|
|
113
154
|
|
|
114
|
-
- [#18804](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18804)
|
|
155
|
+
- [#18804](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18804)
|
|
156
|
+
[`c7cd471ace6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c7cd471ace6) - [ux] add
|
|
157
|
+
abortcontrollers, replace ufo experience identifier, memoization for search query
|
|
115
158
|
- Updated dependencies
|
|
116
159
|
|
|
117
160
|
## 0.1.0
|
|
118
161
|
|
|
119
162
|
### Minor Changes
|
|
120
163
|
|
|
121
|
-
- [#18662](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18662)
|
|
164
|
+
- [#18662](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18662)
|
|
165
|
+
[`6a3107dd76a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6a3107dd76a) - Adding
|
|
166
|
+
analytics + UFO
|
|
122
167
|
|
|
123
168
|
## 0.0.3
|
|
124
169
|
|
|
@@ -130,5 +175,8 @@
|
|
|
130
175
|
|
|
131
176
|
### Patch Changes
|
|
132
177
|
|
|
133
|
-
- [#18056](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18056)
|
|
178
|
+
- [#18056](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18056)
|
|
179
|
+
[`69325c9dd40`](https://bitbucket.org/atlassian/atlassian-frontend/commits/69325c9dd40) - Initial
|
|
180
|
+
changeset for smart-hooks (hooks library for smart capabilities) and smart-common (shared code
|
|
181
|
+
between smart packages)
|
|
134
182
|
- Updated dependencies
|
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2019 Atlassian Pty Ltd
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
@@ -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: "0.2.
|
|
24
|
+
packageVersion: "0.2.10"
|
|
25
25
|
}, attributes)
|
|
26
26
|
};
|
|
27
27
|
};
|
|
@@ -9,7 +9,7 @@ const createEvent = (eventType, action, actionSubject, attributes = {}) => ({
|
|
|
9
9
|
source: '@atlaskit/smart-hooks/use-user-recommendations',
|
|
10
10
|
attributes: {
|
|
11
11
|
packageName: "@atlaskit/smart-hooks",
|
|
12
|
-
packageVersion: "0.2.
|
|
12
|
+
packageVersion: "0.2.10",
|
|
13
13
|
...attributes
|
|
14
14
|
}
|
|
15
15
|
});
|
|
@@ -14,7 +14,7 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
|
|
|
14
14
|
source: '@atlaskit/smart-hooks/use-user-recommendations',
|
|
15
15
|
attributes: _objectSpread({
|
|
16
16
|
packageName: "@atlaskit/smart-hooks",
|
|
17
|
-
packageVersion: "0.2.
|
|
17
|
+
packageVersion: "0.2.10"
|
|
18
18
|
}, attributes)
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnalyticsEventPayload, CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
-
import { UseUserRecommendationsProps } from '../../types';
|
|
1
|
+
import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { type UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
+
import { type UseUserRecommendationsProps } from '../../types';
|
|
4
4
|
export declare const findUserPosition: (loadedUsers: UserSearchItem[], userId: string) => number;
|
|
5
5
|
export declare const createDefaultAttributes: (props: UseUserRecommendationsProps, renderId: string, sessionId: string, query: string) => {
|
|
6
6
|
context: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityType, UserSearchItem } from '@atlaskit/smart-common';
|
|
1
|
+
import { EntityType, type UserSearchItem } from '@atlaskit/smart-common';
|
|
2
2
|
import type { UseUserRecommendationsProps } from '../../types';
|
|
3
3
|
export declare const instrumentFailureOption: {
|
|
4
4
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IntlShape } from 'react-intl-next';
|
|
2
|
-
import { UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
-
import { OptionData } from '@atlaskit/user-picker';
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import { type UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
+
import { type OptionData } from '@atlaskit/user-picker';
|
|
4
4
|
declare const _default: (recommendations: UserSearchItem[], intl: IntlShape) => OptionData[];
|
|
5
5
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnalyticsEventPayload, CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import { UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
-
import { UseUserRecommendationsProps } from '../../types';
|
|
1
|
+
import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { type UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
+
import { type UseUserRecommendationsProps } from '../../types';
|
|
4
4
|
export declare const findUserPosition: (loadedUsers: UserSearchItem[], userId: string) => number;
|
|
5
5
|
export declare const createDefaultAttributes: (props: UseUserRecommendationsProps, renderId: string, sessionId: string, query: string) => {
|
|
6
6
|
context: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityType, UserSearchItem } from '@atlaskit/smart-common';
|
|
1
|
+
import { EntityType, type UserSearchItem } from '@atlaskit/smart-common';
|
|
2
2
|
import type { UseUserRecommendationsProps } from '../../types';
|
|
3
3
|
export declare const instrumentFailureOption: {
|
|
4
4
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IntlShape } from 'react-intl-next';
|
|
2
|
-
import { UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
-
import { OptionData } from '@atlaskit/user-picker';
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import { type UserSearchItem } from '@atlaskit/smart-common';
|
|
3
|
+
import { type OptionData } from '@atlaskit/user-picker';
|
|
4
4
|
declare const _default: (recommendations: UserSearchItem[], intl: IntlShape) => OptionData[];
|
|
5
5
|
export default _default;
|
|
@@ -1,81 +1,80 @@
|
|
|
1
1
|
export const userSampleAvatarUrl =
|
|
2
|
-
|
|
2
|
+
'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFP/AABEIACAAIAMBIgACEQEDEQH/xAB1AAEAAwEAAAAAAAAAAAAAAAAHAgUGCBAAAQMCBQMDAgcAAAAAAAAAAQIDBAURAAYSIUEHEzEUImEVcSMyQlGBweEBAAMBAAAAAAAAAAAAAAAAAAMEBwURAAICAgMBAQEAAAAAAAAAAAECAxEABBIhIkExgf/aAAwDAQACEQMRAD8AxWVci1ipwmJdT7seKFbIMgLKrGxTYkkH4NsMH1D0UFwsqsAACom1zbxvje9QMoU6BVnnFPswkqBX71JQkj7nnBFmwNx6JJmw5zUtkKUlCmFhaCAkG+21/IxCZ2keQ2KA6/uWzyF5X2cs1T1To62n3jYoWUuDfyLf3gUzhl/MuUI06fDLjdMBGh5EtCyQogBOm2q9+L+MJ1Ep0p1SFd5lptwqSe6sJCRpBvvySQP4xoqZlFt6QluQ4iSUL1eQQP8AcG1pHieqsHFHcVyv8xB6l0hnNOUrzGPUKlsBBXYa0FJ/MkkEbEA253GB/I/SeH0wy1PocFtoU6pOeqbbUjthp3TY8nyPngbADHT1ejCi02LGaShx6GlJKFH2rPlV/ub4H85yI+bSqPGdRSZjThdbYeSUNlRFlAnwQfixGNTZn4zSRq3hjdYprRK0cbyD2ABeBHULpiOo8ymrluBNMpai4lgoU5+MFg6zpULWtbkEXww5Ey/EpFOhoYQtllsDVqPudI5V9/OI0ZNMyahuI4tqsy/euykak90nlXgC9hsNv3xd0xuTMImylLaSE3S3+kE8cYHJslwsQbyvzADXRHaSuz9z/9k=';
|
|
3
3
|
|
|
4
4
|
export const mockUserSearchData = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
5
|
+
{
|
|
6
|
+
id: '2234',
|
|
7
|
+
avatarUrl: userSampleAvatarUrl,
|
|
8
|
+
name: 'Jack Sparrow',
|
|
9
|
+
mentionName: 'captainjack',
|
|
10
|
+
lozenge: 'teammate',
|
|
11
|
+
accessLevel: 'SITE',
|
|
12
|
+
presence: {
|
|
13
|
+
status: 'offline',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: '27',
|
|
18
|
+
avatarUrl: userSampleAvatarUrl,
|
|
19
|
+
name: 'Jean Luc Picard',
|
|
20
|
+
mentionName: 'makeitso',
|
|
21
|
+
lozenge: 'teammate',
|
|
22
|
+
accessLevel: 'APPLICATION',
|
|
23
|
+
presence: {
|
|
24
|
+
status: 'none',
|
|
25
|
+
time: '1:57am',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: '1701',
|
|
30
|
+
avatarUrl: userSampleAvatarUrl,
|
|
31
|
+
name: 'James T. Kirk',
|
|
32
|
+
mentionName: 'wheresmyshirt',
|
|
33
|
+
nickname: 'jim',
|
|
34
|
+
accessLevel: 'NONE',
|
|
35
|
+
presence: {
|
|
36
|
+
status: 'focus',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: '12312412',
|
|
41
|
+
name: "Dude with long name and time that doesn't seem to stop and should overflow",
|
|
42
|
+
mentionName: "Dudewithlongnamethatdoesn'tseemtostopandshouldoverflowwithtime",
|
|
43
|
+
presence: {
|
|
44
|
+
time: '1:57pm',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: '12312428',
|
|
49
|
+
avatarUrl: userSampleAvatarUrl,
|
|
50
|
+
name: 'Monkey Trousers',
|
|
51
|
+
lozenge: 'TEAM',
|
|
52
|
+
mentionName: 'Monkey Trousers',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: '12312594',
|
|
56
|
+
avatarUrl:
|
|
57
|
+
'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/0.svg',
|
|
58
|
+
name: 'The Cool Cats',
|
|
59
|
+
userType: 'TEAM',
|
|
60
|
+
context: {
|
|
61
|
+
members: [],
|
|
62
|
+
includesYou: false,
|
|
63
|
+
memberCount: 10,
|
|
64
|
+
teamLink: 'someLink',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: '12312597',
|
|
69
|
+
avatarUrl:
|
|
70
|
+
'https://ptc-directory-sited-static.us-east-1.prod.public.atl-paas.net/teams/avatars/3.svg',
|
|
71
|
+
name: 'The whole company',
|
|
72
|
+
userType: 'TEAM',
|
|
73
|
+
context: {
|
|
74
|
+
members: [],
|
|
75
|
+
includesYou: true,
|
|
76
|
+
memberCount: 80,
|
|
77
|
+
teamLink: 'someLink',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
81
80
|
];
|
|
@@ -2,46 +2,46 @@ import { useEffect } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import fetchMock from 'fetch-mock/cjs/client';
|
|
4
4
|
|
|
5
|
-
import { EntityType, UserSearchResponse } from '@atlaskit/smart-common';
|
|
5
|
+
import { EntityType, type UserSearchResponse } from '@atlaskit/smart-common';
|
|
6
6
|
|
|
7
7
|
import { mockUserSearchData } from './mock-urs-data';
|
|
8
8
|
|
|
9
9
|
const mockEndpoints = () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// http://www.wheresrhys.co.uk/fetch-mock/#usageconfiguration
|
|
11
|
+
// Unmatched routes will fallback to the network
|
|
12
|
+
fetchMock.config.fallbackToNetwork = true;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const userRecommendationsResponse = (): UserSearchResponse => {
|
|
15
|
+
return {
|
|
16
|
+
recommendedUsers: mockUserSearchData
|
|
17
|
+
.filter(() => Math.random() < 0.7)
|
|
18
|
+
.map(({ id, name, avatarUrl = '', nickname }) => ({
|
|
19
|
+
entityType: EntityType.USER,
|
|
20
|
+
id,
|
|
21
|
+
name,
|
|
22
|
+
avatarUrl,
|
|
23
|
+
nickname,
|
|
24
|
+
})),
|
|
25
|
+
errors: [],
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
fetchMock.mock(
|
|
30
|
+
{
|
|
31
|
+
functionMatcher: (url: string) => {
|
|
32
|
+
return url === '/gateway/api/v1/recommendations';
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
() => userRecommendationsResponse(),
|
|
36
|
+
{ method: 'POST', overwriteRoutes: false },
|
|
37
|
+
);
|
|
38
38
|
};
|
|
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
42
|
export const useEndpointMocks = () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
mockEndpoints();
|
|
45
|
+
return () => fetchMock.reset();
|
|
46
|
+
}, []);
|
|
47
47
|
};
|
package/package.json
CHANGED
|
@@ -1,87 +1,86 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
2
|
+
"name": "@atlaskit/smart-hooks",
|
|
3
|
+
"version": "0.2.10",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"registry": "https://registry.npmjs.org/"
|
|
7
|
+
},
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
|
+
"author": "Atlassian Pty Ltd",
|
|
10
|
+
"main": "dist/cjs/index.js",
|
|
11
|
+
"module": "dist/esm/index.js",
|
|
12
|
+
"module:es2019": "dist/es2019/index.js",
|
|
13
|
+
"types": "dist/types/index.d.ts",
|
|
14
|
+
"typesVersions": {
|
|
15
|
+
">=4.5 <4.9": {
|
|
16
|
+
"*": [
|
|
17
|
+
"dist/types-ts4.5/*",
|
|
18
|
+
"dist/types-ts4.5/index.d.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"atlaskit:src": "src/index.ts",
|
|
24
|
+
"atlassian": {
|
|
25
|
+
"team": "Search Platform: Search Experience",
|
|
26
|
+
"inPublicMirror": false,
|
|
27
|
+
"releaseModel": "continuous"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
31
|
+
"@atlaskit/analytics-listeners": "^8.10.0",
|
|
32
|
+
"@atlaskit/analytics-next": "^9.3.0",
|
|
33
|
+
"@atlaskit/smart-common": "^0.3.0",
|
|
34
|
+
"@atlaskit/ufo": "^0.2.0",
|
|
35
|
+
"@atlaskit/user-picker": "^10.22.0",
|
|
36
|
+
"@babel/runtime": "^7.0.0",
|
|
37
|
+
"lodash": "^4.17.21",
|
|
38
|
+
"memoize-one": "^6.0.0",
|
|
39
|
+
"uuid": "^3.1.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": "^16.8.0",
|
|
43
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@storybook/addon-knobs": "^5.3.18",
|
|
47
|
+
"@testing-library/react": "^12.1.5",
|
|
48
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
49
|
+
"@welldone-software/why-did-you-render": "^6.2.0",
|
|
50
|
+
"enzyme": "^3.10.0",
|
|
51
|
+
"fetch-mock": "^8.0.0",
|
|
52
|
+
"react-dom": "^16.8.0",
|
|
53
|
+
"typescript": "~5.4.2",
|
|
54
|
+
"wait-for-expect": "^1.2.0"
|
|
55
|
+
},
|
|
56
|
+
"techstack": {
|
|
57
|
+
"@atlassian/frontend": {
|
|
58
|
+
"import-structure": [
|
|
59
|
+
"atlassian-conventions"
|
|
60
|
+
],
|
|
61
|
+
"circular-dependencies": [
|
|
62
|
+
"file-and-folder-level"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"@repo/internal": {
|
|
66
|
+
"analytics": [
|
|
67
|
+
"analytics-next"
|
|
68
|
+
],
|
|
69
|
+
"design-tokens": [
|
|
70
|
+
"color"
|
|
71
|
+
],
|
|
72
|
+
"theming": [
|
|
73
|
+
"react-context"
|
|
74
|
+
],
|
|
75
|
+
"ui-components": [
|
|
76
|
+
"lite-mode"
|
|
77
|
+
],
|
|
78
|
+
"deprecation": [
|
|
79
|
+
"no-deprecated-imports"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"af:exports": {
|
|
84
|
+
".": "./src/index.ts"
|
|
85
|
+
}
|
|
86
|
+
}
|
package/report.api.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/smart-hooks"
|
|
4
4
|
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
5
|
+
> Do not edit this file. This report is auto-generated using
|
|
6
|
+
> [API Extractor](https://api-extractor.com/).
|
|
6
7
|
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
8
|
|
|
8
9
|
### Table of contents
|
|
@@ -25,44 +26,44 @@ import type { UserSearchQuery } from '@atlaskit/smart-common';
|
|
|
25
26
|
|
|
26
27
|
// @public (undocumented)
|
|
27
28
|
export const transformRecommendationsToOptions: (
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
recommendations: UserSearchItem[],
|
|
30
|
+
intl: IntlShape,
|
|
30
31
|
) => OptionData[];
|
|
31
32
|
|
|
32
33
|
// @public (undocumented)
|
|
33
34
|
export const useUserRecommendations: (props: UseUserRecommendationsProps) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
// @public (undocumented)
|
|
49
50
|
type UseUserRecommendationsProps = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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;
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
// (No @packageDocumentation comment for this package)
|
|
@@ -76,8 +77,8 @@ type UseUserRecommendationsProps = {
|
|
|
76
77
|
|
|
77
78
|
```json
|
|
78
79
|
{
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
"react": "^16.8.0",
|
|
81
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
81
82
|
}
|
|
82
83
|
```
|
|
83
84
|
|