@atlaskit/smart-user-picker 10.1.0 → 11.0.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/components/package.json +1 -8
  3. package/default-value-hydration-client/package.json +1 -8
  4. package/dist/cjs/analytics.js +1 -1
  5. package/dist/cjs/components/SmartUserPicker.js +91 -91
  6. package/dist/cjs/service/default-value-hydration-client.js +30 -30
  7. package/dist/cjs/service/users-client.js +4 -4
  8. package/dist/cjs/util/i18n-util.js +38 -38
  9. package/dist/es2019/analytics.js +1 -1
  10. package/dist/esm/analytics.js +1 -1
  11. package/dist/esm/components/SmartUserPicker.js +90 -90
  12. package/dist/esm/service/default-value-hydration-client.js +30 -30
  13. package/dist/esm/service/users-client.js +4 -4
  14. package/dist/esm/util/i18n-util.js +37 -37
  15. package/option/package.json +1 -8
  16. package/package.json +11 -17
  17. package/recommendation-client/package.json +1 -8
  18. package/types/package.json +1 -8
  19. package/dist/types-ts4.5/analytics.d.ts +0 -22
  20. package/dist/types-ts4.5/components/MessagesIntlProvider.d.ts +0 -9
  21. package/dist/types-ts4.5/components/SmartUserPicker.d.ts +0 -43
  22. package/dist/types-ts4.5/components/index.d.ts +0 -4
  23. package/dist/types-ts4.5/config/index.d.ts +0 -6
  24. package/dist/types-ts4.5/i18n/cs.d.ts +0 -8
  25. package/dist/types-ts4.5/i18n/da.d.ts +0 -8
  26. package/dist/types-ts4.5/i18n/de.d.ts +0 -8
  27. package/dist/types-ts4.5/i18n/en.d.ts +0 -8
  28. package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -8
  29. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -8
  30. package/dist/types-ts4.5/i18n/es.d.ts +0 -8
  31. package/dist/types-ts4.5/i18n/et.d.ts +0 -8
  32. package/dist/types-ts4.5/i18n/fi.d.ts +0 -8
  33. package/dist/types-ts4.5/i18n/fr.d.ts +0 -8
  34. package/dist/types-ts4.5/i18n/hr.d.ts +0 -8
  35. package/dist/types-ts4.5/i18n/hu.d.ts +0 -8
  36. package/dist/types-ts4.5/i18n/is.d.ts +0 -7
  37. package/dist/types-ts4.5/i18n/it.d.ts +0 -8
  38. package/dist/types-ts4.5/i18n/ja.d.ts +0 -8
  39. package/dist/types-ts4.5/i18n/ko.d.ts +0 -8
  40. package/dist/types-ts4.5/i18n/languages.d.ts +0 -27
  41. package/dist/types-ts4.5/i18n/nb.d.ts +0 -8
  42. package/dist/types-ts4.5/i18n/nl.d.ts +0 -8
  43. package/dist/types-ts4.5/i18n/pl.d.ts +0 -8
  44. package/dist/types-ts4.5/i18n/pt_BR.d.ts +0 -8
  45. package/dist/types-ts4.5/i18n/pt_PT.d.ts +0 -8
  46. package/dist/types-ts4.5/i18n/ro.d.ts +0 -7
  47. package/dist/types-ts4.5/i18n/ru.d.ts +0 -8
  48. package/dist/types-ts4.5/i18n/sk.d.ts +0 -8
  49. package/dist/types-ts4.5/i18n/sl.d.ts +0 -8
  50. package/dist/types-ts4.5/i18n/sr_RS.d.ts +0 -8
  51. package/dist/types-ts4.5/i18n/sr_YR.d.ts +0 -8
  52. package/dist/types-ts4.5/i18n/sv.d.ts +0 -8
  53. package/dist/types-ts4.5/i18n/th.d.ts +0 -8
  54. package/dist/types-ts4.5/i18n/tr.d.ts +0 -8
  55. package/dist/types-ts4.5/i18n/uk.d.ts +0 -8
  56. package/dist/types-ts4.5/i18n/vi.d.ts +0 -8
  57. package/dist/types-ts4.5/i18n/zh.d.ts +0 -8
  58. package/dist/types-ts4.5/i18n/zh_TW.d.ts +0 -8
  59. package/dist/types-ts4.5/i18n.d.ts +0 -47
  60. package/dist/types-ts4.5/index.d.ts +0 -5
  61. package/dist/types-ts4.5/option.d.ts +0 -2
  62. package/dist/types-ts4.5/service/atl-attribution.d.ts +0 -20
  63. package/dist/types-ts4.5/service/constants.d.ts +0 -4
  64. package/dist/types-ts4.5/service/default-value-hydration-client.d.ts +0 -11
  65. package/dist/types-ts4.5/service/graphqlUtils.d.ts +0 -16
  66. package/dist/types-ts4.5/service/index.d.ts +0 -2
  67. package/dist/types-ts4.5/service/recommendation-client.d.ts +0 -9
  68. package/dist/types-ts4.5/service/teams-client.d.ts +0 -15
  69. package/dist/types-ts4.5/service/users-client.d.ts +0 -12
  70. package/dist/types-ts4.5/service/users-transformer.d.ts +0 -19
  71. package/dist/types-ts4.5/types.d.ts +0 -320
  72. package/dist/types-ts4.5/ufoExperiences.d.ts +0 -11
  73. package/dist/types-ts4.5/util/i18n-util.d.ts +0 -11
@@ -1,320 +0,0 @@
1
- import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
- import { type DefaultValue, type ExternalUser, type OptionData, type Team, type User, type UserPickerProps } from '@atlaskit/user-picker';
3
- export interface Context {
4
- containerId?: string;
5
- contextType: string;
6
- objectId?: string;
7
- sessionId?: string;
8
- principalId?: string;
9
- childObjectId?: string;
10
- productKey: string;
11
- siteId: string;
12
- organizationId?: string;
13
- userbaseId?: string;
14
- productAttributes?: ProductAttributes;
15
- }
16
- export interface RestrictionFilter {
17
- userIds?: string[];
18
- groupIds?: string[];
19
- }
20
- export interface RecommendationRequest {
21
- baseUrl?: string;
22
- context: Context;
23
- maxNumberOfResults: number;
24
- query?: string;
25
- searchQueryFilter?: string;
26
- includeUsers?: boolean;
27
- includeGroups?: boolean;
28
- includeTeams?: boolean;
29
- includeNonLicensedUsers?: boolean;
30
- searchEmail?: boolean;
31
- verifiedTeams?: boolean;
32
- restrictTo?: RestrictionFilter;
33
- /**
34
- * When true, URS returns only userbase-aligned teams (teams synced to Identity).
35
- * Confluence uses this for teams-as-principals to avoid errors when users select teams
36
- * that are not yet mirrored to Identity (e.g. old org-scoped teams in NonVortex orgs).
37
- */
38
- isTeamSyncedToGroupDirectoryFilter?: boolean;
39
- }
40
- type OnError = (error: any, request: RecommendationRequest) => Promise<OptionData[]> | void;
41
- type OnValueError = (error: any, defaultValue: DefaultValue) => Promise<OptionData[]> | void;
42
- type OnEmpty = (query: string) => Promise<OptionData[]>;
43
- type TransformOptions = (options: OptionData[], query?: string) => Promise<OptionData[]>;
44
- export interface State {
45
- users: OptionData[];
46
- loading: boolean;
47
- closed: boolean;
48
- query: string;
49
- sessionId?: string;
50
- defaultValue?: DefaultValue;
51
- bootstrapOptions: OptionData[];
52
- }
53
- export type ProductAttributes = BitbucketAttributes | ConfluenceAttributes | JiraAttributes;
54
- export type FilterOptions = (options: OptionData[], query: string) => OptionData[];
55
- export interface BitbucketAttributes {
56
- /**
57
- * Identifies whether this is a public repository or not.
58
- */
59
- isPublicRepo?: boolean;
60
- /**
61
- * A list of bitbucket workspace Ids used within container result set and noted in analytics.
62
- */
63
- workspaceIds?: string[];
64
- /**
65
- * The users current email domain which may be used to boost the results for relevant users.
66
- */
67
- emailDomain?: string;
68
- }
69
- export interface ConfluenceAttributes {
70
- /**
71
- * Identifies whether this user is part of a Confluence site that is entitled for guests
72
- */
73
- isEntitledConfluenceExternalCollaborator?: boolean;
74
- }
75
- export interface JiraAttributes {
76
- /**
77
- * Identifies whether this user is part of a Jira site that is entitled for guests
78
- */
79
- isEntitledJiraGuest?: boolean;
80
- }
81
- export declare enum EntityType {
82
- USER = "USER",
83
- TEAM = "TEAM",
84
- GROUP = "GROUP"
85
- }
86
- export declare enum UserEntityType {
87
- DEFAULT = "DEFAULT",
88
- APP = "APP",
89
- CUSTOMER = "CUSTOMER",
90
- SYSTEM = "SYSTEM"
91
- }
92
- export interface RecommendationItem {
93
- id: string;
94
- name?: string;
95
- email?: string;
96
- entityType: EntityType;
97
- userType?: UserEntityType;
98
- avatarUrl: string;
99
- description?: string;
100
- teamAri?: string;
101
- displayName?: string;
102
- nonLicensedUser?: boolean;
103
- }
104
- export interface RecommendationResponse {
105
- errors?: any[];
106
- recommendedUsers: RecommendationItem[];
107
- }
108
- export type OverrideByline = (option: User | ExternalUser | Team) => string;
109
- export interface SmartProps {
110
- /**
111
- * The base URL of the site eg: hello.atlassian.net
112
- */
113
- baseUrl?: string;
114
- /**
115
- * Hydrated user suggestions to show when the query is blank. If not provided, smart user picker
116
- * will still provide a smart-ranked list of suggestions for blank queries. Please refer to @atlaskit/user-picker
117
- * for OptionData type.
118
- */
119
- bootstrapOptions?: OptionData[];
120
- /**
121
- * Context information for analytics. Eg: if a user picker was put inside a comment, the childObjectId would be
122
- * the ID of the comment. Optional, but please provide if available.
123
- */
124
- childObjectId?: string;
125
- /**
126
- * The container Id to identify context.
127
- *
128
- * e.g. Jira: projectId. Confluence: spaceId. Bitbucket: repositoryId.
129
- */
130
- containerId?: string;
131
- /**
132
- * Time to debounce the suggestions fetching (in milliseconds). Defaults to 150ms.
133
- */
134
- debounceTime?: number;
135
- /**
136
- * Function to transform options suggested by the server before showing to the user. Can be used to filter out suggestions.
137
- * The results of filterOptions are the results displayed in the suggestions UI.
138
- */
139
- filterOptions?: FilterOptions;
140
- /**
141
- * Whether to include groups in the resultset. Only supported for Confluence. @default false
142
- */
143
- includeGroups?: boolean;
144
- /**
145
- * Whether to include teams in the resultset. @default false
146
- */
147
- includeTeams?: boolean;
148
- /**
149
- * When set to true, only returns verified teams. Only applies when includeTeams is true. @default false
150
- */
151
- verifiedTeams?: boolean;
152
- /**
153
- * Whether to include users in the resultset. @default true
154
- */
155
- includeUsers?: boolean;
156
- /**
157
- * Whether to include non licensed users in the resultset. @default false
158
- */
159
- includeNonLicensedUsers?: boolean;
160
- /**
161
- * An identifier of the closest context object, e.g. issueId, pageId, pullRequestId.
162
- * Used for analytics. Optional, but please include if available.
163
- */
164
- objectId?: string;
165
- /**
166
- * Custom handler to give opportunity for caller to return list of options when server returns empty list.
167
- * this is called if server returns empty list. This will NOT be called if props.filterOptions returns empty list.
168
- */
169
- onEmpty?: OnEmpty;
170
- /**
171
- * Error handler for when the server fails to suggest users and returns with an error response.
172
- * `error`: the error.
173
- * `RecommendationRequest`: the original recommendationRequest containing the query and other search parameters.
174
- * This may be used to provide a fail over search direct to the product backend.
175
- * Helper fail over clients exist under /helpers.
176
- * Note that OnError results are filtered.
177
- */
178
- onError?: OnError;
179
- /**
180
- * Error handler used to provide OptionData[] values when the server fails to hydrate the `defaultValue` prop's values.
181
- */
182
- onValueError?: OnValueError;
183
- /**
184
- * Function to generate the byline of each option. The server response is
185
- * provided as an argument to the function.
186
- */
187
- overrideByline?: OverrideByline;
188
- /**
189
- * When enabled, displays email addresses for users in the byline of each option, if available.
190
- * Note - overrideByline will take precedent over displayEmailInByline.
191
- * Note - only certain user types will have their email displayed.
192
- * @default false
193
- */
194
- displayEmailInByline?: boolean;
195
- /**
196
- * Prefetch the list of suggested assignees before the user picker is focused.
197
- * WARNING: please consider carefully before deciding to prefetch your suggestions
198
- * as this will increase the load on the recommendations services (has caused HOTs).
199
- * Please give #help-search-plex a ballpark on the expected request volume.
200
- */
201
- prefetch?: boolean;
202
- /**
203
- * Id of the user interacting with the component.
204
- * If principalId is not provided, server will extract principalId from the context header, assuming that the user is logged in
205
- * when making the request. @default “context”
206
- */
207
- principalId?: string;
208
- /**
209
- * Product-specific Attributes - you should pass in the attribute type that matches your current SupportedProduct.
210
- * Currently we support additional attributes (BitbucketAttributes) for bitbucket and (ConfluenceAttributes) for Confluence.
211
- */
212
- productAttributes?: ProductAttributes;
213
- /**
214
- * Product identifier. If you are an NPF, please ensure your product has been onboarded with
215
- * Cross-product user-search @see https://developer.atlassian.com/cloud/cross-product-user-search/
216
- * If you are still waiting for CPUS, you can use the `people` productKey in the interim.
217
- */
218
- productKey: string;
219
- /**
220
- * When enabled, allows searching by email address.
221
- * @default false
222
- */
223
- enableEmailSearch?: boolean;
224
- /**
225
- * When both allowEmail and enableEmailSearch are true, this controls whether both email entry
226
- * and matched user entries can be selected simultaneously.
227
- * If false, only allows email selection when:
228
- * 1. The query matches email format (validated by regex)
229
- * 2. No user/external user matches are found (teams/groups don't suppress email entry)
230
- * @default true
231
- */
232
- allowEmailSelectionWhenEmailMatched?: boolean;
233
- /**
234
- * Filter to be applied to the eventual query to CPUS for user suggestions.
235
- * Example:`account_status:"active" AND (NOT email_domain:"connect.atlassian.com")`
236
- * will remove inactive users from the list of suggestions.
237
- */
238
- searchQueryFilter?: string;
239
- /**
240
- * Identifier for the product's tenant, also known as tenantId or cloudId
241
- */
242
- siteId: string;
243
- /**
244
- * Identifier for the product activation.
245
- */
246
- activationId?: string;
247
- /**
248
- * Identifier for the organization in which to search for teams.
249
- */
250
- orgId?: string;
251
- /**
252
- * Identifier for the userbase scope.
253
- * Currently, this is supported for team fetching only.
254
- * When provided, team search uses this scope. Otherwise team search falls back to `orgId` and `siteId`.
255
- */
256
- userbaseId?: string;
257
- /**
258
- * Optional callback to customize the options shown to the user.
259
- * Called after options are loaded.
260
- */
261
- transformOptions?: TransformOptions;
262
- /**
263
- * Optional callback to provide additional user resolvers, such as for fetching and adding users from third party sources
264
- */
265
- userResolvers?: Array<(query: string) => Promise<OptionData[]>>;
266
- /**
267
- * Custom fetcher function to load options. When provided, this function will be called
268
- * instead of the default recommendation API. The function receives the search term
269
- * and should return a Promise that resolves to an array of OptionData.
270
- */
271
- fetchOptions?: (query: string) => Promise<OptionData[]>;
272
- /**
273
- * Whether to include teams UI updates in the resultset. @default false
274
- */
275
- includeTeamsUpdates?: boolean;
276
- /** Checks if the footer is focused or not. This is needed to keep the menu open when the footer is focused */
277
- isFooterFocused?: boolean;
278
- /** Sets if the footer is focused or not. This is needed to keep the menu open when the footer is focused */
279
- setIsFooterFocused?: React.Dispatch<React.SetStateAction<boolean>>;
280
- /**
281
- * Restricts the recommendations to specific users and/or groups.
282
- * If provided, only users matching the provided user IDs and/or groups matching the provided group IDs will be included in the results.
283
- * @example { userIds: ["123", "456"], groupIds: ["789"] }
284
- */
285
- restrictTo?: RestrictionFilter;
286
- /**
287
- * When true, URS returns only userbase-aligned teams (teams synced to Identity).
288
- * Confluence uses this for teams-as-principals to avoid errors when users select teams
289
- * that are not yet mirrored to Identity (e.g. old org-scoped teams in NonVortex orgs).
290
- */
291
- isTeamSyncedToGroupDirectoryFilter?: boolean;
292
- }
293
- export interface Props extends SmartProps, UserPickerProps, WithAnalyticsEventsProps {
294
- /**
295
- * The pre-selected values for the smart user picker. Supports only Users and Teams default value hydration.
296
- * If the `DefaultValue` contains only an `id` and `type` (it conforms to an `OptionIdentifier`)
297
- * then the values will be automatically hydrated.
298
- * If the value has a `name` then it is considered hydrated and will be ignored.
299
- * Uses Confluence and Jira if called from there, else uses Identity or Legion for teams. If a value could not be found, or there was
300
- * a network failure during the hydration, the value will be rendered with the label 'Unknown'. Else, if there were any other error
301
- * during default value hydration, no default values will be rendered, use `onValueError` to handle this.
302
- * `defaultValue` differs from `value` in that it sets the initial value then leaves the component 'uncontrolled'
303
- * whereas setting the `value` prop delegates responsibility for maintaining the value to the caller
304
- * (i.e. listen to `onChange`)
305
- */
306
- defaultValue?: DefaultValue;
307
- /**
308
- * Identifier for informing the server on where the user picker has been mounted.
309
- * Unlike User Picker, the fieldId in Smart User Picker is mandatory.
310
- * The server uses the fieldId to determine which model to utilize when
311
- * generating suggestions.
312
- * All fieldId's will be bucketed into a model that provides generic smart results,
313
- * except "assignee", "mentions" which are specifically trained for Jira Assignee and
314
- * @Mentions. For specifically trained models, please contact #help-search-plex.
315
- */
316
- fieldId: string;
317
- /** Whether the menu is open or not. */
318
- menuIsOpen?: boolean;
319
- }
320
- export {};
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { ConcurrentExperience } from '@atlaskit/ufo';
3
- export declare const smartUserPickerRenderedUfoExperience: ConcurrentExperience;
4
- export declare const smartUserPickerOptionsShownUfoExperience: ConcurrentExperience;
5
- export declare const useUFOConcurrentExperience: (experience: ConcurrentExperience, id: string) => void;
6
- export declare class UfoErrorBoundary extends React.Component<React.PropsWithChildren<{
7
- id: string;
8
- }>> {
9
- componentDidCatch(): void;
10
- render(): React.ReactNode;
11
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Tries to get the most specific messages bundle for a given locale.
3
- *
4
- * Strategy:
5
- * 1. Try to find messages with the exact string (i.e. 'fr_FR')
6
- * 2. If that doesn't work, try to find messages for the country locale (i.e. 'fr')
7
- * 3. If that doesn't work, return english messages as a fallback.
8
- *
9
- * @param locale string specifying the locale like 'en_GB', or 'fr'.
10
- */
11
- export declare const getMessagesForLocale: (locale: string) => Promise<Record<string, string>>;