@atlaskit/smart-user-picker 12.2.0 → 12.3.1
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 +15 -0
- package/dist/cjs/UfoErrorBoundary.js +29 -2
- package/dist/cjs/components/SmartUserPicker.js +12 -3
- package/dist/cjs/packageVersion.js +1 -1
- package/dist/es2019/UfoErrorBoundary.js +22 -1
- package/dist/es2019/components/SmartUserPicker.js +12 -4
- package/dist/es2019/packageVersion.js +1 -1
- package/dist/esm/UfoErrorBoundary.js +29 -2
- package/dist/esm/components/SmartUserPicker.js +11 -4
- package/dist/esm/packageVersion.js +1 -1
- package/dist/types/UfoErrorBoundary.d.ts +11 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlassian/smart-user-picker
|
|
2
2
|
|
|
3
|
+
## 12.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5ea0eed463aca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5ea0eed463aca) -
|
|
8
|
+
Use hook-based analytics and an explicit error-boundary fallback, preserving UFO failure reporting
|
|
9
|
+
and retries on parent updates.
|
|
10
|
+
|
|
11
|
+
## 12.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`725211e3dd6b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/725211e3dd6b0) -
|
|
16
|
+
Update i18n NPM package versions for linking-platform,smart-experiences (Group 15)
|
|
17
|
+
|
|
3
18
|
## 12.2.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -10,14 +10,24 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
10
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
14
|
var _react = _interopRequireDefault(require("react"));
|
|
14
15
|
var _ufoExperiences = require("./ufoExperiences");
|
|
15
16
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
16
17
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
18
|
var UfoErrorBoundary = exports.UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
18
19
|
function UfoErrorBoundary() {
|
|
20
|
+
var _this;
|
|
19
21
|
(0, _classCallCheck2.default)(this, UfoErrorBoundary);
|
|
20
|
-
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
_this = _callSuper(this, UfoErrorBoundary, [].concat(args));
|
|
26
|
+
(0, _defineProperty2.default)(_this, "state", {
|
|
27
|
+
hasError: false,
|
|
28
|
+
previousProps: _this.props
|
|
29
|
+
});
|
|
30
|
+
return _this;
|
|
21
31
|
}
|
|
22
32
|
(0, _inherits2.default)(UfoErrorBoundary, _React$Component);
|
|
23
33
|
return (0, _createClass2.default)(UfoErrorBoundary, [{
|
|
@@ -28,7 +38,24 @@ var UfoErrorBoundary = exports.UfoErrorBoundary = /*#__PURE__*/function (_React$
|
|
|
28
38
|
}, {
|
|
29
39
|
key: "render",
|
|
30
40
|
value: function render() {
|
|
31
|
-
return this.props.children;
|
|
41
|
+
return this.state.hasError ? null : this.props.children;
|
|
42
|
+
}
|
|
43
|
+
}], [{
|
|
44
|
+
key: "getDerivedStateFromProps",
|
|
45
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
46
|
+
// Preserve the original boundary's retry on parent updates, even when children are memoized.
|
|
47
|
+
// Error recovery uses the same props, so it must retain the fallback instead of retrying.
|
|
48
|
+
return props !== state.previousProps ? {
|
|
49
|
+
hasError: false,
|
|
50
|
+
previousProps: props
|
|
51
|
+
} : null;
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "getDerivedStateFromError",
|
|
55
|
+
value: function getDerivedStateFromError() {
|
|
56
|
+
return {
|
|
57
|
+
hasError: true
|
|
58
|
+
};
|
|
32
59
|
}
|
|
33
60
|
}]);
|
|
34
61
|
}(_react.default.Component);
|
|
@@ -22,7 +22,7 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
|
22
22
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
23
23
|
var _reactIntl = require("react-intl");
|
|
24
24
|
var _uuid = require("uuid");
|
|
25
|
-
var
|
|
25
|
+
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
26
26
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
27
27
|
var _experienceState = require("@atlaskit/ufo/experience-state");
|
|
28
28
|
var _emailValidation = require("@atlaskit/user-picker/components/email-validation");
|
|
@@ -639,7 +639,7 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
|
|
|
639
639
|
})));
|
|
640
640
|
}
|
|
641
641
|
}]);
|
|
642
|
-
}(_react.default.Component);
|
|
642
|
+
}(_react.default.Component);
|
|
643
643
|
(0, _defineProperty2.default)(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
644
644
|
baseUrl: '',
|
|
645
645
|
includeUsers: true,
|
|
@@ -656,4 +656,13 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
|
|
|
656
656
|
allowEmailSelectionWhenEmailMatched: true,
|
|
657
657
|
verifiedTeams: false
|
|
658
658
|
});
|
|
659
|
-
var
|
|
659
|
+
var SmartUserPickerWithIntl = (0, _reactIntl.injectIntl)(SmartUserPickerWithoutAnalytics);
|
|
660
|
+
// TODO: Smart User picker team will have to add a type annotation here
|
|
661
|
+
var SmartUserPicker = exports.SmartUserPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
662
|
+
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
663
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
664
|
+
return /*#__PURE__*/_react.default.createElement(SmartUserPickerWithIntl, (0, _extends2.default)({}, props, {
|
|
665
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
666
|
+
ref: ref
|
|
667
|
+
}));
|
|
668
|
+
});
|
|
@@ -1,10 +1,31 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { smartUserPickerRenderedUfoExperience } from './ufoExperiences';
|
|
3
4
|
export class UfoErrorBoundary extends React.Component {
|
|
5
|
+
constructor(...args) {
|
|
6
|
+
super(...args);
|
|
7
|
+
_defineProperty(this, "state", {
|
|
8
|
+
hasError: false,
|
|
9
|
+
previousProps: this.props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
static getDerivedStateFromProps(props, state) {
|
|
13
|
+
// Preserve the original boundary's retry on parent updates, even when children are memoized.
|
|
14
|
+
// Error recovery uses the same props, so it must retain the fallback instead of retrying.
|
|
15
|
+
return props !== state.previousProps ? {
|
|
16
|
+
hasError: false,
|
|
17
|
+
previousProps: props
|
|
18
|
+
} : null;
|
|
19
|
+
}
|
|
20
|
+
static getDerivedStateFromError() {
|
|
21
|
+
return {
|
|
22
|
+
hasError: true
|
|
23
|
+
};
|
|
24
|
+
}
|
|
4
25
|
componentDidCatch() {
|
|
5
26
|
smartUserPickerRenderedUfoExperience.getInstance(this.props.id).failure();
|
|
6
27
|
}
|
|
7
28
|
render() {
|
|
8
|
-
return this.props.children;
|
|
29
|
+
return this.state.hasError ? null : this.props.children;
|
|
9
30
|
}
|
|
10
31
|
}
|
|
@@ -6,7 +6,7 @@ import memoizeOne from 'memoize-one';
|
|
|
6
6
|
import { injectIntl } from 'react-intl';
|
|
7
7
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
8
8
|
import { v4 as uuidV4 } from 'uuid';
|
|
9
|
-
import
|
|
9
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
11
|
import { UFOExperienceState } from '@atlaskit/ufo/experience-state';
|
|
12
12
|
import { isValidEmail } from '@atlaskit/user-picker/components/email-validation';
|
|
@@ -493,8 +493,6 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
493
493
|
})));
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
|
|
497
|
-
// TODO: Smart User picker team will have to add a type annotation here
|
|
498
496
|
_defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
499
497
|
baseUrl: '',
|
|
500
498
|
includeUsers: true,
|
|
@@ -511,4 +509,14 @@ _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
|
511
509
|
allowEmailSelectionWhenEmailMatched: true,
|
|
512
510
|
verifiedTeams: false
|
|
513
511
|
});
|
|
514
|
-
|
|
512
|
+
const SmartUserPickerWithIntl = injectIntl(SmartUserPickerWithoutAnalytics);
|
|
513
|
+
// TODO: Smart User picker team will have to add a type annotation here
|
|
514
|
+
export const SmartUserPicker = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
515
|
+
const {
|
|
516
|
+
createAnalyticsEvent
|
|
517
|
+
} = useAnalyticsEvents();
|
|
518
|
+
return /*#__PURE__*/React.createElement(SmartUserPickerWithIntl, _extends({}, props, {
|
|
519
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
520
|
+
ref: ref
|
|
521
|
+
}));
|
|
522
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = "12.
|
|
1
|
+
export const packageVersion = "12.3.0";
|
|
@@ -3,14 +3,24 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
7
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
9
|
import React from 'react';
|
|
9
10
|
import { smartUserPickerRenderedUfoExperience } from './ufoExperiences';
|
|
10
11
|
export var UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
11
12
|
function UfoErrorBoundary() {
|
|
13
|
+
var _this;
|
|
12
14
|
_classCallCheck(this, UfoErrorBoundary);
|
|
13
|
-
|
|
15
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
|
+
args[_key] = arguments[_key];
|
|
17
|
+
}
|
|
18
|
+
_this = _callSuper(this, UfoErrorBoundary, [].concat(args));
|
|
19
|
+
_defineProperty(_this, "state", {
|
|
20
|
+
hasError: false,
|
|
21
|
+
previousProps: _this.props
|
|
22
|
+
});
|
|
23
|
+
return _this;
|
|
14
24
|
}
|
|
15
25
|
_inherits(UfoErrorBoundary, _React$Component);
|
|
16
26
|
return _createClass(UfoErrorBoundary, [{
|
|
@@ -21,7 +31,24 @@ export var UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
21
31
|
}, {
|
|
22
32
|
key: "render",
|
|
23
33
|
value: function render() {
|
|
24
|
-
return this.props.children;
|
|
34
|
+
return this.state.hasError ? null : this.props.children;
|
|
35
|
+
}
|
|
36
|
+
}], [{
|
|
37
|
+
key: "getDerivedStateFromProps",
|
|
38
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
39
|
+
// Preserve the original boundary's retry on parent updates, even when children are memoized.
|
|
40
|
+
// Error recovery uses the same props, so it must retain the fallback instead of retrying.
|
|
41
|
+
return props !== state.previousProps ? {
|
|
42
|
+
hasError: false,
|
|
43
|
+
previousProps: props
|
|
44
|
+
} : null;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getDerivedStateFromError",
|
|
48
|
+
value: function getDerivedStateFromError() {
|
|
49
|
+
return {
|
|
50
|
+
hasError: true
|
|
51
|
+
};
|
|
25
52
|
}
|
|
26
53
|
}]);
|
|
27
54
|
}(React.Component);
|
|
@@ -24,7 +24,7 @@ import memoizeOne from 'memoize-one';
|
|
|
24
24
|
import { injectIntl } from 'react-intl';
|
|
25
25
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
26
26
|
import { v4 as uuidV4 } from 'uuid';
|
|
27
|
-
import
|
|
27
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
28
28
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
29
29
|
import { UFOExperienceState } from '@atlaskit/ufo/experience-state';
|
|
30
30
|
import { isValidEmail } from '@atlaskit/user-picker/components/email-validation';
|
|
@@ -634,8 +634,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
634
634
|
}
|
|
635
635
|
}]);
|
|
636
636
|
}(React.Component);
|
|
637
|
-
|
|
638
|
-
// TODO: Smart User picker team will have to add a type annotation here
|
|
639
637
|
_defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
640
638
|
baseUrl: '',
|
|
641
639
|
includeUsers: true,
|
|
@@ -652,4 +650,13 @@ _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
|
652
650
|
allowEmailSelectionWhenEmailMatched: true,
|
|
653
651
|
verifiedTeams: false
|
|
654
652
|
});
|
|
655
|
-
|
|
653
|
+
var SmartUserPickerWithIntl = injectIntl(SmartUserPickerWithoutAnalytics);
|
|
654
|
+
// TODO: Smart User picker team will have to add a type annotation here
|
|
655
|
+
export var SmartUserPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
656
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
657
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
658
|
+
return /*#__PURE__*/React.createElement(SmartUserPickerWithIntl, _extends({}, props, {
|
|
659
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
660
|
+
ref: ref
|
|
661
|
+
}));
|
|
662
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var packageVersion = "12.
|
|
1
|
+
export var packageVersion = "12.3.0";
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type Props = React.PropsWithChildren<{
|
|
3
3
|
id: string;
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
5
|
+
type State = {
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
previousProps: Props;
|
|
8
|
+
};
|
|
9
|
+
export declare class UfoErrorBoundary extends React.Component<Props, State> {
|
|
10
|
+
state: State;
|
|
11
|
+
static getDerivedStateFromProps(props: Props, state: State): State | null;
|
|
12
|
+
static getDerivedStateFromError(): Partial<State>;
|
|
5
13
|
componentDidCatch(): void;
|
|
6
14
|
render(): React.ReactNode;
|
|
7
15
|
}
|
|
16
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-user-picker",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/afm-i18n-platform-smart-experiences-smart-user-picker": "2.
|
|
35
|
-
"@atlaskit/analytics-next": "^12.
|
|
34
|
+
"@atlaskit/afm-i18n-platform-smart-experiences-smart-user-picker": "2.272.0",
|
|
35
|
+
"@atlaskit/analytics-next": "^12.6.0",
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
37
37
|
"@atlaskit/ufo": "^2.0.0",
|
|
38
|
-
"@atlaskit/user-picker": "^14.
|
|
38
|
+
"@atlaskit/user-picker": "^14.1.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
40
|
"lodash": "^4.17.21",
|
|
41
41
|
"memoize-one": "^6.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/util-data-test": "^19.1.0",
|
|
54
54
|
"@atlassian/a11y-jest-testing": "^0.17.0",
|
|
55
55
|
"@atlassian/feature-flags-test-utils": "^1.3.0",
|
|
56
|
-
"@atlassian/integrations": "^34.
|
|
56
|
+
"@atlassian/integrations": "^34.5.0",
|
|
57
57
|
"@atlassian/workbench": "workspace:*",
|
|
58
58
|
"@testing-library/dom": "^10.1.0",
|
|
59
59
|
"@testing-library/react": "^16.3.0",
|