@atlaskit/smart-hooks 0.2.9 → 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 +68 -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,182 @@
|
|
|
1
1
|
# @atlaskit/smart-hooks
|
|
2
2
|
|
|
3
|
+
## 0.2.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
3
9
|
## 0.2.9
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
10
16
|
|
|
11
17
|
## 0.2.8
|
|
12
18
|
|
|
13
19
|
### Patch Changes
|
|
14
20
|
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
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`
|
|
18
24
|
|
|
19
25
|
## 0.2.7
|
|
20
26
|
|
|
21
27
|
### Patch Changes
|
|
22
28
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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)
|
|
27
33
|
|
|
28
34
|
## 0.2.6
|
|
29
35
|
|
|
30
36
|
### Patch Changes
|
|
31
37
|
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
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
|
|
41
|
+
- Updated dependencies
|
|
36
42
|
|
|
37
43
|
## 0.2.5
|
|
38
44
|
|
|
39
45
|
### Patch Changes
|
|
40
46
|
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
44
50
|
|
|
45
51
|
## 0.2.4
|
|
46
52
|
|
|
47
53
|
### Patch Changes
|
|
48
54
|
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
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')
|
|
52
58
|
|
|
53
59
|
## 0.2.3
|
|
54
60
|
|
|
55
61
|
### Patch Changes
|
|
56
62
|
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
|
60
66
|
|
|
61
67
|
## 0.2.2
|
|
62
68
|
|
|
63
69
|
### Patch Changes
|
|
64
70
|
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
|
68
74
|
|
|
69
75
|
## 0.2.1
|
|
70
76
|
|
|
71
77
|
### Patch Changes
|
|
72
78
|
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
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`
|
|
76
82
|
|
|
77
83
|
## 0.2.0
|
|
78
84
|
|
|
79
85
|
### Minor Changes
|
|
80
86
|
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
|
84
90
|
|
|
85
91
|
### Patch Changes
|
|
86
92
|
|
|
87
|
-
-
|
|
93
|
+
- Updated dependencies
|
|
88
94
|
|
|
89
95
|
## 0.1.9
|
|
90
96
|
|
|
91
97
|
### Patch Changes
|
|
92
98
|
|
|
93
|
-
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
96
102
|
|
|
97
103
|
## 0.1.8
|
|
98
104
|
|
|
99
105
|
### Patch Changes
|
|
100
106
|
|
|
101
|
-
-
|
|
107
|
+
- Updated dependencies
|
|
102
108
|
|
|
103
109
|
## 0.1.7
|
|
104
110
|
|
|
105
111
|
### Patch Changes
|
|
106
112
|
|
|
107
|
-
-
|
|
113
|
+
- Updated dependencies
|
|
108
114
|
|
|
109
115
|
## 0.1.6
|
|
110
116
|
|
|
111
117
|
### Patch Changes
|
|
112
118
|
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
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`
|
|
116
122
|
|
|
117
123
|
## 0.1.5
|
|
118
124
|
|
|
119
125
|
### Patch Changes
|
|
120
126
|
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
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`.
|
|
124
130
|
|
|
125
131
|
## 0.1.4
|
|
126
132
|
|
|
127
133
|
### Patch Changes
|
|
128
134
|
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
|
132
138
|
|
|
133
139
|
## 0.1.3
|
|
134
140
|
|
|
135
141
|
### Patch Changes
|
|
136
142
|
|
|
137
|
-
-
|
|
143
|
+
- Updated dependencies
|
|
138
144
|
|
|
139
145
|
## 0.1.2
|
|
140
146
|
|
|
141
147
|
### Patch Changes
|
|
142
148
|
|
|
143
|
-
-
|
|
149
|
+
- Updated dependencies
|
|
144
150
|
|
|
145
151
|
## 0.1.1
|
|
146
152
|
|
|
147
153
|
### Patch Changes
|
|
148
154
|
|
|
149
|
-
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
-
|
|
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
|
|
158
|
+
- Updated dependencies
|
|
153
159
|
|
|
154
160
|
## 0.1.0
|
|
155
161
|
|
|
156
162
|
### Minor Changes
|
|
157
163
|
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
|
161
167
|
|
|
162
168
|
## 0.0.3
|
|
163
169
|
|
|
164
170
|
### Patch Changes
|
|
165
171
|
|
|
166
|
-
-
|
|
172
|
+
- Updated dependencies
|
|
167
173
|
|
|
168
174
|
## 0.0.2
|
|
169
175
|
|
|
170
176
|
### Patch Changes
|
|
171
177
|
|
|
172
|
-
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
-
|
|
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)
|
|
182
|
+
- 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.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,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.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
|
|