@atlaskit/smart-user-picker 9.0.1 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/components/SmartUserPicker.js +9 -18
- package/dist/cjs/service/users-transformer.js +6 -1
- package/dist/es2019/components/SmartUserPicker.js +7 -16
- package/dist/es2019/service/users-transformer.js +6 -1
- package/dist/esm/components/SmartUserPicker.js +9 -18
- package/dist/esm/service/users-transformer.js +6 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +7 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +7 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlassian/smart-user-picker
|
|
2
2
|
|
|
3
|
+
## 9.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`bdbcc02f31ffe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bdbcc02f31ffe) -
|
|
8
|
+
[ux] Block viewers adding followers that don't have access to private projects
|
|
9
|
+
|
|
10
|
+
## 9.1.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`cd870c596ec95`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cd870c596ec95) -
|
|
15
|
+
Add support for Jira guest user lozenges via user_picker_guest_lozenges feature flag
|
|
16
|
+
|
|
3
17
|
## 9.0.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -261,15 +261,11 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
|
|
|
261
261
|
|
|
262
262
|
// Track if email search found matches for conditional allowEmail logic
|
|
263
263
|
if (isEmail) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
_this.lastEmailSearchFoundMatches = userMatches.length > 0;
|
|
270
|
-
} else {
|
|
271
|
-
_this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
|
|
272
|
-
}
|
|
264
|
+
// Only count user/external user matches, not teams or groups
|
|
265
|
+
userMatches = recommendedUsers.filter(function (user) {
|
|
266
|
+
return (0, _userPicker.isUser)(user) || (0, _userPicker.isExternalUser)(user);
|
|
267
|
+
});
|
|
268
|
+
_this.lastEmailSearchFoundMatches = userMatches.length > 0;
|
|
273
269
|
} else {
|
|
274
270
|
_this.lastEmailSearchFoundMatches = false;
|
|
275
271
|
}
|
|
@@ -586,15 +582,10 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
|
|
|
586
582
|
var shouldAllowEmail = allowEmail;
|
|
587
583
|
if (allowEmail && enableEmailSearch && !allowEmailSelectionWhenEmailMatched) {
|
|
588
584
|
var isCurrentQueryEmail = isEmailQuery(this.state.query);
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
shouldAllowEmail = isCurrentQueryEmail && !this.lastEmailSearchFoundMatches;
|
|
594
|
-
} else {
|
|
595
|
-
// Only allow email selection if we're in an email search that found no matches
|
|
596
|
-
shouldAllowEmail = !isCurrentQueryEmail || !this.lastEmailSearchFoundMatches;
|
|
597
|
-
}
|
|
585
|
+
// Only allow email selection when:
|
|
586
|
+
// 1. The query matches email format (validated by regex)
|
|
587
|
+
// 2. No user/external user matches were found (only teams/groups suggested)
|
|
588
|
+
shouldAllowEmail = isCurrentQueryEmail && !this.lastEmailSearchFoundMatches;
|
|
598
589
|
}
|
|
599
590
|
return /*#__PURE__*/_react.default.createElement(_MessagesIntlProvider.default, null, /*#__PURE__*/_react.default.createElement(_userPicker.default, (0, _extends2.default)({}, restProps, {
|
|
600
591
|
allowEmail: shouldAllowEmail,
|
|
@@ -7,8 +7,9 @@ exports.transformUsers = void 0;
|
|
|
7
7
|
var _userPicker = require("@atlaskit/user-picker");
|
|
8
8
|
var _i18n = require("../i18n");
|
|
9
9
|
var _types = require("../types");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
11
|
-
var _entity$attributes, _entity$attributes2;
|
|
12
|
+
var _entity$attributes, _entity$attributes2, _entity$attributes3;
|
|
12
13
|
if ((_entity$attributes = entity.attributes) !== null && _entity$attributes !== void 0 && _entity$attributes.workspaceMember) {
|
|
13
14
|
return intl.formatMessage(_i18n.messages.memberLozengeText);
|
|
14
15
|
}
|
|
@@ -20,6 +21,10 @@ var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
|
20
21
|
appearance: 'default'
|
|
21
22
|
};
|
|
22
23
|
}
|
|
24
|
+
var isJiraGuestUser = (0, _platformFeatureFlags.fg)('user_picker_guest_lozenges') && ((_entity$attributes3 = entity.attributes) === null || _entity$attributes3 === void 0 ? void 0 : _entity$attributes3.isJiraGuest);
|
|
25
|
+
if (isJiraGuestUser) {
|
|
26
|
+
return intl.formatMessage(_i18n.messages.guestLozengeText);
|
|
27
|
+
}
|
|
23
28
|
return undefined;
|
|
24
29
|
};
|
|
25
30
|
var transformUser = function transformUser(item, intl) {
|
|
@@ -212,13 +212,9 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
212
212
|
|
|
213
213
|
// Track if email search found matches for conditional allowEmail logic
|
|
214
214
|
if (isEmail) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this.lastEmailSearchFoundMatches = userMatches.length > 0;
|
|
219
|
-
} else {
|
|
220
|
-
this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
|
|
221
|
-
}
|
|
215
|
+
// Only count user/external user matches, not teams or groups
|
|
216
|
+
const userMatches = recommendedUsers.filter(user => isUser(user) || isExternalUser(user));
|
|
217
|
+
this.lastEmailSearchFoundMatches = userMatches.length > 0;
|
|
222
218
|
} else {
|
|
223
219
|
this.lastEmailSearchFoundMatches = false;
|
|
224
220
|
}
|
|
@@ -430,15 +426,10 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
430
426
|
let shouldAllowEmail = allowEmail;
|
|
431
427
|
if (allowEmail && enableEmailSearch && !allowEmailSelectionWhenEmailMatched) {
|
|
432
428
|
const isCurrentQueryEmail = isEmailQuery(this.state.query);
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
shouldAllowEmail = isCurrentQueryEmail && !this.lastEmailSearchFoundMatches;
|
|
438
|
-
} else {
|
|
439
|
-
// Only allow email selection if we're in an email search that found no matches
|
|
440
|
-
shouldAllowEmail = !isCurrentQueryEmail || !this.lastEmailSearchFoundMatches;
|
|
441
|
-
}
|
|
429
|
+
// Only allow email selection when:
|
|
430
|
+
// 1. The query matches email format (validated by regex)
|
|
431
|
+
// 2. No user/external user matches were found (only teams/groups suggested)
|
|
432
|
+
shouldAllowEmail = isCurrentQueryEmail && !this.lastEmailSearchFoundMatches;
|
|
442
433
|
}
|
|
443
434
|
return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(UserPicker, _extends({}, restProps, {
|
|
444
435
|
allowEmail: shouldAllowEmail,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ExternalUserType, GroupType, TeamType, UserType } from '@atlaskit/user-picker';
|
|
2
2
|
import { messages } from '../i18n';
|
|
3
3
|
import { EntityType } from '../types';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
const getLozenzeProperties = (entity, intl) => {
|
|
5
|
-
var _entity$attributes, _entity$attributes2;
|
|
6
|
+
var _entity$attributes, _entity$attributes2, _entity$attributes3;
|
|
6
7
|
if ((_entity$attributes = entity.attributes) !== null && _entity$attributes !== void 0 && _entity$attributes.workspaceMember) {
|
|
7
8
|
return intl.formatMessage(messages.memberLozengeText);
|
|
8
9
|
}
|
|
@@ -14,6 +15,10 @@ const getLozenzeProperties = (entity, intl) => {
|
|
|
14
15
|
appearance: 'default'
|
|
15
16
|
};
|
|
16
17
|
}
|
|
18
|
+
const isJiraGuestUser = fg('user_picker_guest_lozenges') && ((_entity$attributes3 = entity.attributes) === null || _entity$attributes3 === void 0 ? void 0 : _entity$attributes3.isJiraGuest);
|
|
19
|
+
if (isJiraGuestUser) {
|
|
20
|
+
return intl.formatMessage(messages.guestLozengeText);
|
|
21
|
+
}
|
|
17
22
|
return undefined;
|
|
18
23
|
};
|
|
19
24
|
const transformUser = (item, intl) => {
|
|
@@ -253,15 +253,11 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
253
253
|
|
|
254
254
|
// Track if email search found matches for conditional allowEmail logic
|
|
255
255
|
if (isEmail) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
_this.lastEmailSearchFoundMatches = userMatches.length > 0;
|
|
262
|
-
} else {
|
|
263
|
-
_this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
|
|
264
|
-
}
|
|
256
|
+
// Only count user/external user matches, not teams or groups
|
|
257
|
+
userMatches = recommendedUsers.filter(function (user) {
|
|
258
|
+
return isUser(user) || isExternalUser(user);
|
|
259
|
+
});
|
|
260
|
+
_this.lastEmailSearchFoundMatches = userMatches.length > 0;
|
|
265
261
|
} else {
|
|
266
262
|
_this.lastEmailSearchFoundMatches = false;
|
|
267
263
|
}
|
|
@@ -578,15 +574,10 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
578
574
|
var shouldAllowEmail = allowEmail;
|
|
579
575
|
if (allowEmail && enableEmailSearch && !allowEmailSelectionWhenEmailMatched) {
|
|
580
576
|
var isCurrentQueryEmail = isEmailQuery(this.state.query);
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
shouldAllowEmail = isCurrentQueryEmail && !this.lastEmailSearchFoundMatches;
|
|
586
|
-
} else {
|
|
587
|
-
// Only allow email selection if we're in an email search that found no matches
|
|
588
|
-
shouldAllowEmail = !isCurrentQueryEmail || !this.lastEmailSearchFoundMatches;
|
|
589
|
-
}
|
|
577
|
+
// Only allow email selection when:
|
|
578
|
+
// 1. The query matches email format (validated by regex)
|
|
579
|
+
// 2. No user/external user matches were found (only teams/groups suggested)
|
|
580
|
+
shouldAllowEmail = isCurrentQueryEmail && !this.lastEmailSearchFoundMatches;
|
|
590
581
|
}
|
|
591
582
|
return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(UserPicker, _extends({}, restProps, {
|
|
592
583
|
allowEmail: shouldAllowEmail,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ExternalUserType, GroupType, TeamType, UserType } from '@atlaskit/user-picker';
|
|
2
2
|
import { messages } from '../i18n';
|
|
3
3
|
import { EntityType } from '../types';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
5
|
-
var _entity$attributes, _entity$attributes2;
|
|
6
|
+
var _entity$attributes, _entity$attributes2, _entity$attributes3;
|
|
6
7
|
if ((_entity$attributes = entity.attributes) !== null && _entity$attributes !== void 0 && _entity$attributes.workspaceMember) {
|
|
7
8
|
return intl.formatMessage(messages.memberLozengeText);
|
|
8
9
|
}
|
|
@@ -14,6 +15,10 @@ var getLozenzeProperties = function getLozenzeProperties(entity, intl) {
|
|
|
14
15
|
appearance: 'default'
|
|
15
16
|
};
|
|
16
17
|
}
|
|
18
|
+
var isJiraGuestUser = fg('user_picker_guest_lozenges') && ((_entity$attributes3 = entity.attributes) === null || _entity$attributes3 === void 0 ? void 0 : _entity$attributes3.isJiraGuest);
|
|
19
|
+
if (isJiraGuestUser) {
|
|
20
|
+
return intl.formatMessage(messages.guestLozengeText);
|
|
21
|
+
}
|
|
17
22
|
return undefined;
|
|
18
23
|
};
|
|
19
24
|
var transformUser = function transformUser(item, intl) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default } from './components';
|
|
2
2
|
export { getUserRecommendations, hydrateDefaultValues } from './service';
|
|
3
|
-
export type { RecommendationRequest, Props, State } from './types';
|
|
3
|
+
export type { RecommendationRequest, Props, State, RestrictionFilter } from './types';
|
|
4
4
|
export { isEmail, isTeam, isUser, isExternalUser, isValidEmail, isGroup, EmailType, GroupType, TeamType, UserType, } from '@atlaskit/user-picker';
|
|
5
5
|
export type { ActionTypes, Appearance, AtlasKitSelectChange, AtlaskitSelectValue, DefaultValue, EmailValidationResponse, EmailValidator, InputActionTypes, LozengeProps, OnChange, OnInputChange, OnOption, OnPicker, Option, OptionData, OptionIdentifier, PopupUserPickerProps, Promisable, Target, UserPickerProps, UserPickerState, Value, Email, Group, GroupHighlight, HighlightRange, LoadOptions, Team, TeamHighlight, TeamMember, User, UserHighlight, ExternalUser, UserSource, } from '@atlaskit/user-picker';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface State {
|
|
|
49
49
|
defaultValue?: DefaultValue;
|
|
50
50
|
bootstrapOptions: OptionData[];
|
|
51
51
|
}
|
|
52
|
-
export type ProductAttributes = BitbucketAttributes | ConfluenceAttributes;
|
|
52
|
+
export type ProductAttributes = BitbucketAttributes | ConfluenceAttributes | JiraAttributes;
|
|
53
53
|
export type FilterOptions = (options: OptionData[], query: string) => OptionData[];
|
|
54
54
|
export interface BitbucketAttributes {
|
|
55
55
|
/**
|
|
@@ -71,6 +71,12 @@ export interface ConfluenceAttributes {
|
|
|
71
71
|
*/
|
|
72
72
|
isEntitledConfluenceExternalCollaborator?: boolean;
|
|
73
73
|
}
|
|
74
|
+
export interface JiraAttributes {
|
|
75
|
+
/**
|
|
76
|
+
* Identifies whether this user is part of a Jira site that is entitled for guests
|
|
77
|
+
*/
|
|
78
|
+
isEntitledJiraGuest?: boolean;
|
|
79
|
+
}
|
|
74
80
|
export declare enum EntityType {
|
|
75
81
|
USER = "USER",
|
|
76
82
|
TEAM = "TEAM",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default } from './components';
|
|
2
2
|
export { getUserRecommendations, hydrateDefaultValues } from './service';
|
|
3
|
-
export type { RecommendationRequest, Props, State } from './types';
|
|
3
|
+
export type { RecommendationRequest, Props, State, RestrictionFilter } from './types';
|
|
4
4
|
export { isEmail, isTeam, isUser, isExternalUser, isValidEmail, isGroup, EmailType, GroupType, TeamType, UserType, } from '@atlaskit/user-picker';
|
|
5
5
|
export type { ActionTypes, Appearance, AtlasKitSelectChange, AtlaskitSelectValue, DefaultValue, EmailValidationResponse, EmailValidator, InputActionTypes, LozengeProps, OnChange, OnInputChange, OnOption, OnPicker, Option, OptionData, OptionIdentifier, PopupUserPickerProps, Promisable, Target, UserPickerProps, UserPickerState, Value, Email, Group, GroupHighlight, HighlightRange, LoadOptions, Team, TeamHighlight, TeamMember, User, UserHighlight, ExternalUser, UserSource, } from '@atlaskit/user-picker';
|
|
@@ -49,7 +49,7 @@ export interface State {
|
|
|
49
49
|
defaultValue?: DefaultValue;
|
|
50
50
|
bootstrapOptions: OptionData[];
|
|
51
51
|
}
|
|
52
|
-
export type ProductAttributes = BitbucketAttributes | ConfluenceAttributes;
|
|
52
|
+
export type ProductAttributes = BitbucketAttributes | ConfluenceAttributes | JiraAttributes;
|
|
53
53
|
export type FilterOptions = (options: OptionData[], query: string) => OptionData[];
|
|
54
54
|
export interface BitbucketAttributes {
|
|
55
55
|
/**
|
|
@@ -71,6 +71,12 @@ export interface ConfluenceAttributes {
|
|
|
71
71
|
*/
|
|
72
72
|
isEntitledConfluenceExternalCollaborator?: boolean;
|
|
73
73
|
}
|
|
74
|
+
export interface JiraAttributes {
|
|
75
|
+
/**
|
|
76
|
+
* Identifies whether this user is part of a Jira site that is entitled for guests
|
|
77
|
+
*/
|
|
78
|
+
isEntitledJiraGuest?: boolean;
|
|
79
|
+
}
|
|
74
80
|
export declare enum EntityType {
|
|
75
81
|
USER = "USER",
|
|
76
82
|
TEAM = "TEAM",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-user-picker",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@atlaskit/select": "^21.7.0",
|
|
54
54
|
"@atlaskit/util-data-test": "^18.5.0",
|
|
55
|
-
"@atlassian/a11y-jest-testing": "^0.
|
|
55
|
+
"@atlassian/a11y-jest-testing": "^0.11.0",
|
|
56
56
|
"@testing-library/dom": "^10.1.0",
|
|
57
57
|
"@testing-library/react": "^16.3.0",
|
|
58
58
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"smart-user-picker-restrict-to-gate": {
|
|
72
72
|
"type": "boolean"
|
|
73
73
|
},
|
|
74
|
-
"
|
|
74
|
+
"smart-user-picker-attribution-header": {
|
|
75
75
|
"type": "boolean"
|
|
76
76
|
},
|
|
77
|
-
"
|
|
77
|
+
"user_picker_guest_lozenges": {
|
|
78
78
|
"type": "boolean"
|
|
79
79
|
}
|
|
80
80
|
}
|