@atlaskit/smart-hooks 0.2.9 → 0.2.11
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 +74 -62
- 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 -87
- package/report.api.md +34 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,176 +1,188 @@
|
|
|
1
1
|
# @atlaskit/smart-hooks
|
|
2
2
|
|
|
3
|
+
## 0.2.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 0.2.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 0.2.9
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
6
18
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
19
|
+
- [#95740](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95740)
|
|
20
|
+
[`a15da04ef56a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a15da04ef56a) -
|
|
21
|
+
license update
|
|
10
22
|
|
|
11
23
|
## 0.2.8
|
|
12
24
|
|
|
13
25
|
### Patch Changes
|
|
14
26
|
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116)
|
|
28
|
+
[`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) -
|
|
29
|
+
Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
18
30
|
|
|
19
31
|
## 0.2.7
|
|
20
32
|
|
|
21
33
|
### Patch Changes
|
|
22
34
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
- [#40652](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40652)
|
|
36
|
+
[`097ce4dd212`](https://bitbucket.org/atlassian/atlassian-frontend/commits/097ce4dd212) - Changes
|
|
37
|
+
for remove cyclic dependency in AFE(@atlaskit/smart-hooks,@atlassian/notification-common,
|
|
38
|
+
@atlassian/notification-test-utils)
|
|
27
39
|
|
|
28
40
|
## 0.2.6
|
|
29
41
|
|
|
30
42
|
### Patch Changes
|
|
31
43
|
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
44
|
+
- [#38162](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38162)
|
|
45
|
+
[`fd6bb9c9184`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd6bb9c9184) - Delete
|
|
46
|
+
version.json
|
|
47
|
+
- Updated dependencies
|
|
36
48
|
|
|
37
49
|
## 0.2.5
|
|
38
50
|
|
|
39
51
|
### Patch Changes
|
|
40
52
|
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
- [#37925](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37925)
|
|
54
|
+
[`f01deb5e6ab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f01deb5e6ab) - Use
|
|
55
|
+
injected env vars instead of version.json
|
|
44
56
|
|
|
45
57
|
## 0.2.4
|
|
46
58
|
|
|
47
59
|
### Patch Changes
|
|
48
60
|
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
- [#37101](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37101)
|
|
62
|
+
[`78f0d4b929c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/78f0d4b929c) - [ux]
|
|
63
|
+
Color of guest lozenges in the smartUserPicker changed from purple ('new') to grey ('default')
|
|
52
64
|
|
|
53
65
|
## 0.2.3
|
|
54
66
|
|
|
55
67
|
### Patch Changes
|
|
56
68
|
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
- [#34443](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34443)
|
|
70
|
+
[`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing
|
|
71
|
+
unused dependencies and dev dependencies
|
|
60
72
|
|
|
61
73
|
## 0.2.2
|
|
62
74
|
|
|
63
75
|
### Patch Changes
|
|
64
76
|
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793)
|
|
78
|
+
[`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure
|
|
79
|
+
legacy types are published for TS 4.5-4.8
|
|
68
80
|
|
|
69
81
|
## 0.2.1
|
|
70
82
|
|
|
71
83
|
### Patch Changes
|
|
72
84
|
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649)
|
|
86
|
+
[`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade
|
|
87
|
+
Typescript from `4.5.5` to `4.9.5`
|
|
76
88
|
|
|
77
89
|
## 0.2.0
|
|
78
90
|
|
|
79
91
|
### Minor Changes
|
|
80
92
|
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258)
|
|
94
|
+
[`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip
|
|
95
|
+
minor dependency bump
|
|
84
96
|
|
|
85
97
|
### Patch Changes
|
|
86
98
|
|
|
87
|
-
-
|
|
99
|
+
- Updated dependencies
|
|
88
100
|
|
|
89
101
|
## 0.1.9
|
|
90
102
|
|
|
91
103
|
### Patch Changes
|
|
92
104
|
|
|
93
|
-
-
|
|
94
|
-
|
|
95
|
-
|
|
105
|
+
- [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424)
|
|
106
|
+
[`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY
|
|
107
|
+
remove before merging to master; dupe adf-schema via adf-utils
|
|
96
108
|
|
|
97
109
|
## 0.1.8
|
|
98
110
|
|
|
99
111
|
### Patch Changes
|
|
100
112
|
|
|
101
|
-
-
|
|
113
|
+
- Updated dependencies
|
|
102
114
|
|
|
103
115
|
## 0.1.7
|
|
104
116
|
|
|
105
117
|
### Patch Changes
|
|
106
118
|
|
|
107
|
-
-
|
|
119
|
+
- Updated dependencies
|
|
108
120
|
|
|
109
121
|
## 0.1.6
|
|
110
122
|
|
|
111
123
|
### Patch Changes
|
|
112
124
|
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
- [#24874](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24874)
|
|
126
|
+
[`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade
|
|
127
|
+
Typescript from `4.3.5` to `4.5.5`
|
|
116
128
|
|
|
117
129
|
## 0.1.5
|
|
118
130
|
|
|
119
131
|
### Patch Changes
|
|
120
132
|
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
- [#24492](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24492)
|
|
134
|
+
[`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade
|
|
135
|
+
Typescript from `4.2.4` to `4.3.5`.
|
|
124
136
|
|
|
125
137
|
## 0.1.4
|
|
126
138
|
|
|
127
139
|
### Patch Changes
|
|
128
140
|
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
- [#20650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20650)
|
|
142
|
+
[`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade
|
|
143
|
+
to TypeScript 4.2.4
|
|
132
144
|
|
|
133
145
|
## 0.1.3
|
|
134
146
|
|
|
135
147
|
### Patch Changes
|
|
136
148
|
|
|
137
|
-
-
|
|
149
|
+
- Updated dependencies
|
|
138
150
|
|
|
139
151
|
## 0.1.2
|
|
140
152
|
|
|
141
153
|
### Patch Changes
|
|
142
154
|
|
|
143
|
-
-
|
|
155
|
+
- Updated dependencies
|
|
144
156
|
|
|
145
157
|
## 0.1.1
|
|
146
158
|
|
|
147
159
|
### Patch Changes
|
|
148
160
|
|
|
149
|
-
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
-
|
|
161
|
+
- [#18804](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18804)
|
|
162
|
+
[`c7cd471ace6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c7cd471ace6) - [ux] add
|
|
163
|
+
abortcontrollers, replace ufo experience identifier, memoization for search query
|
|
164
|
+
- Updated dependencies
|
|
153
165
|
|
|
154
166
|
## 0.1.0
|
|
155
167
|
|
|
156
168
|
### Minor Changes
|
|
157
169
|
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
|
|
170
|
+
- [#18662](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18662)
|
|
171
|
+
[`6a3107dd76a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6a3107dd76a) - Adding
|
|
172
|
+
analytics + UFO
|
|
161
173
|
|
|
162
174
|
## 0.0.3
|
|
163
175
|
|
|
164
176
|
### Patch Changes
|
|
165
177
|
|
|
166
|
-
-
|
|
178
|
+
- Updated dependencies
|
|
167
179
|
|
|
168
180
|
## 0.0.2
|
|
169
181
|
|
|
170
182
|
### Patch Changes
|
|
171
183
|
|
|
172
|
-
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
-
|
|
184
|
+
- [#18056](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/18056)
|
|
185
|
+
[`69325c9dd40`](https://bitbucket.org/atlassian/atlassian-frontend/commits/69325c9dd40) - Initial
|
|
186
|
+
changeset for smart-hooks (hooks library for smart capabilities) and smart-common (shared code
|
|
187
|
+
between smart packages)
|
|
188
|
+
- Updated dependencies
|
|
@@ -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.11"
|
|
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.11",
|
|
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.11"
|
|
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,88 +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
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
88
|
-
}
|
|
2
|
+
"name": "@atlaskit/smart-hooks",
|
|
3
|
+
"version": "0.2.11",
|
|
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.4.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
|
|