@atlaskit/link-create 1.5.0 → 1.5.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 +8 -0
- package/analytics.spec.yaml +14 -0
- package/dist/cjs/common/ui/Button/index.js +37 -0
- package/dist/cjs/common/ui/error-boundary-modal/index.js +30 -0
- package/dist/cjs/common/utils/analytics/analytics.codegen.js +1 -1
- package/dist/cjs/common/utils/analytics/components.js +20 -0
- package/dist/cjs/ui/link-create/confirm-dismiss-dialog/main.js +18 -5
- package/dist/cjs/ui/link-create/error-boundary/error-boundary-base/index.js +4 -7
- package/dist/cjs/ui/link-create/error-boundary/index.js +4 -3
- package/dist/cjs/ui/main.js +12 -1
- package/dist/es2019/common/ui/Button/index.js +27 -0
- package/dist/es2019/common/ui/error-boundary-modal/index.js +22 -0
- package/dist/es2019/common/utils/analytics/analytics.codegen.js +1 -1
- package/dist/es2019/common/utils/analytics/components.js +15 -0
- package/dist/es2019/ui/link-create/confirm-dismiss-dialog/main.js +17 -4
- package/dist/es2019/ui/link-create/error-boundary/error-boundary-base/index.js +4 -4
- package/dist/es2019/ui/link-create/error-boundary/index.js +4 -3
- package/dist/es2019/ui/main.js +12 -1
- package/dist/esm/common/ui/Button/index.js +27 -0
- package/dist/esm/common/ui/error-boundary-modal/index.js +21 -0
- package/dist/esm/common/utils/analytics/analytics.codegen.js +1 -1
- package/dist/esm/common/utils/analytics/components.js +13 -0
- package/dist/esm/ui/link-create/confirm-dismiss-dialog/main.js +17 -4
- package/dist/esm/ui/link-create/error-boundary/error-boundary-base/index.js +4 -4
- package/dist/esm/ui/link-create/error-boundary/index.js +4 -3
- package/dist/esm/ui/main.js +12 -1
- package/dist/types/common/ui/Button/index.d.ts +5 -0
- package/dist/types/common/ui/error-boundary-modal/index.d.ts +11 -0
- package/dist/types/common/utils/analytics/analytics.codegen.d.ts +6 -2
- package/dist/types/common/utils/analytics/components.d.ts +8 -0
- package/dist/types/ui/link-create/error-boundary/error-boundary-base/index.d.ts +3 -3
- package/dist/types/ui/link-create/error-boundary/index.d.ts +5 -1
- package/dist/types-ts4.5/common/ui/Button/index.d.ts +5 -0
- package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +11 -0
- package/dist/types-ts4.5/common/utils/analytics/analytics.codegen.d.ts +6 -2
- package/dist/types-ts4.5/common/utils/analytics/components.d.ts +8 -0
- package/dist/types-ts4.5/ui/link-create/error-boundary/error-boundary-base/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/link-create/error-boundary/index.d.ts +5 -1
- package/package.json +6 -3
- /package/dist/cjs/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js +0 -0
- /package/dist/cjs/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.js +0 -0
- /package/dist/cjs/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.js +0 -0
- /package/dist/es2019/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js +0 -0
- /package/dist/es2019/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.js +0 -0
- /package/dist/es2019/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.js +0 -0
- /package/dist/esm/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js +0 -0
- /package/dist/esm/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.js +0 -0
- /package/dist/esm/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.js +0 -0
- /package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.d.ts +0 -0
- /package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.d.ts +0 -0
- /package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/link-create
|
|
2
2
|
|
|
3
|
+
## 1.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42575](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42575) [`d7338b9229e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7338b9229e) - Updates exit warning dialog to fire analytics on open, and button clicks
|
|
8
|
+
- [#42553](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42553) [`76b95198067`](https://bitbucket.org/atlassian/atlassian-frontend/commits/76b95198067) - Add error boundary to catch unhandled errors outside the link create modal
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 1.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/analytics.spec.yaml
CHANGED
|
@@ -35,6 +35,13 @@ events:
|
|
|
35
35
|
<<: *PackageMetaDataContext
|
|
36
36
|
<<: *LinkCreateAnalyticContext
|
|
37
37
|
|
|
38
|
+
- linkCreateExitWarningScreen viewed:
|
|
39
|
+
type: screen
|
|
40
|
+
description: fired when the link create warning modal is shown to the users to warn them of losing their changes
|
|
41
|
+
attributes:
|
|
42
|
+
<<: *PackageMetaDataContext
|
|
43
|
+
<<: *LinkCreateAnalyticContext
|
|
44
|
+
|
|
38
45
|
- button clicked (create):
|
|
39
46
|
type: ui
|
|
40
47
|
description: fired when the create button is clicked
|
|
@@ -49,6 +56,13 @@ events:
|
|
|
49
56
|
<<: *PackageMetaDataContext
|
|
50
57
|
<<: *LinkCreateAnalyticContext
|
|
51
58
|
|
|
59
|
+
- button clicked (confirm):
|
|
60
|
+
type: ui
|
|
61
|
+
description: fired when the confirmation button is clicked
|
|
62
|
+
attributes:
|
|
63
|
+
<<: *PackageMetaDataContext
|
|
64
|
+
<<: *LinkCreateAnalyticContext
|
|
65
|
+
|
|
52
66
|
- modalDialog closed (linkCreate):
|
|
53
67
|
type: ui
|
|
54
68
|
description: fired when the link create component is unmounted/dismissed for any reason
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Button = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
|
+
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
14
|
+
var _constants = require("../../../common/constants");
|
|
15
|
+
var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
|
|
16
|
+
var _excluded = ["actionSubjectId"];
|
|
17
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
20
|
+
var actionSubjectId = _ref.actionSubjectId,
|
|
21
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
22
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
23
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_button.default, (0, _extends2.default)({}, props, {
|
|
25
|
+
ref: ref,
|
|
26
|
+
onClick: function onClick(event) {
|
|
27
|
+
var _props$onClick;
|
|
28
|
+
var payload = (0, _analytics.default)("ui.button.clicked.".concat(actionSubjectId), {});
|
|
29
|
+
var analyticEvent = createAnalyticsEvent(payload);
|
|
30
|
+
var cloned = analyticEvent.clone();
|
|
31
|
+
analyticEvent.fire(_constants.ANALYTICS_CHANNEL);
|
|
32
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, event, cloned !== null && cloned !== void 0 ? cloned : new _analyticsNext.UIAnalyticsEvent({
|
|
33
|
+
payload: payload
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ErrorBoundaryModal = void 0;
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
var _errorBoundaryUi = require("../error-boundary-ui");
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
/** @jsx jsx */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* ErrorBoundaryModal props are the same as those passed to LinkCreate, which
|
|
18
|
+
* are used to control its active state
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
var ErrorBoundaryModal = exports.ErrorBoundaryModal = function ErrorBoundaryModal(_ref) {
|
|
22
|
+
var active = _ref.active,
|
|
23
|
+
onClose = _ref.onClose;
|
|
24
|
+
return (0, _react.jsx)(_modalDialog.ModalTransition, null, active && (0, _react.jsx)(_modalDialog.default, {
|
|
25
|
+
testId: "link-create-error-boundary-modal",
|
|
26
|
+
onClose: onClose,
|
|
27
|
+
shouldScrollInViewport: true,
|
|
28
|
+
width: "".concat(_constants.CREATE_FORM_MAX_WIDTH_IN_PX, "px")
|
|
29
|
+
}, (0, _react.jsx)(_modalDialog.ModalBody, null, (0, _react.jsx)(_errorBoundaryUi.ErrorBoundaryUI, null))));
|
|
30
|
+
};
|
|
@@ -11,7 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
*
|
|
12
12
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
13
13
|
*
|
|
14
|
-
* @codegen <<SignedSource::
|
|
14
|
+
* @codegen <<SignedSource::af0139619517f37a8bca32ddb6b7d6e0>>
|
|
15
15
|
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
16
16
|
*/
|
|
17
17
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ScreenViewedEvent = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
|
+
var _constants = require("../../../common/constants");
|
|
11
|
+
var _analytics = _interopRequireDefault(require("./analytics.codegen"));
|
|
12
|
+
var ScreenViewedEvent = exports.ScreenViewedEvent = function ScreenViewedEvent(_ref) {
|
|
13
|
+
var screen = _ref.screen;
|
|
14
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
15
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
16
|
+
(0, _react.useEffect)(function () {
|
|
17
|
+
createAnalyticsEvent((0, _analytics.default)("screen.".concat(screen, ".viewed"), {})).fire(_constants.ANALYTICS_CHANNEL);
|
|
18
|
+
}, [createAnalyticsEvent, screen]);
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
@@ -8,25 +8,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.ConfirmDismissDialog = void 0;
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
|
-
var
|
|
11
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
12
|
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
13
|
+
var _Button = require("../../../common/ui/Button");
|
|
14
|
+
var _components = require("../../../common/utils/analytics/components");
|
|
13
15
|
var _messages = _interopRequireDefault(require("./messages"));
|
|
14
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
var screen = 'linkCreateExitWarningScreen';
|
|
19
|
+
var context = {
|
|
20
|
+
component: screen,
|
|
21
|
+
source: screen
|
|
22
|
+
};
|
|
16
23
|
var ConfirmDismissDialog = exports.ConfirmDismissDialog = function ConfirmDismissDialog(_ref) {
|
|
17
24
|
var active = _ref.active,
|
|
18
25
|
onCancelDismiss = _ref.onCancelDismiss,
|
|
19
26
|
onConfirmDismiss = _ref.onConfirmDismiss;
|
|
20
27
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTransition, null, active && /*#__PURE__*/_react.default.createElement(
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTransition, null, active && /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
|
|
29
|
+
data: context
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_modalDialog.default, {
|
|
22
31
|
testId: "link-create-confirm-dismiss-dialog",
|
|
23
32
|
onClose: onCancelDismiss,
|
|
24
33
|
width: "small"
|
|
25
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_components.ScreenViewedEvent, {
|
|
35
|
+
screen: "linkCreateExitWarningScreen"
|
|
36
|
+
}), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalHeader, null, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTitle, null, intl.formatMessage(_messages.default.title))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, intl.formatMessage(_messages.default.description)), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
37
|
+
actionSubjectId: "cancel",
|
|
26
38
|
appearance: "subtle",
|
|
27
39
|
onClick: onCancelDismiss
|
|
28
|
-
}, intl.formatMessage(_messages.default.cancelButtonLabel)), /*#__PURE__*/_react.default.createElement(
|
|
40
|
+
}, intl.formatMessage(_messages.default.cancelButtonLabel)), /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
41
|
+
actionSubjectId: "confirm",
|
|
29
42
|
appearance: "primary",
|
|
30
43
|
onClick: onConfirmDismiss
|
|
31
|
-
}, intl.formatMessage(_messages.default.confirmButtonLabel)))));
|
|
44
|
+
}, intl.formatMessage(_messages.default.confirmButtonLabel))))));
|
|
32
45
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -11,9 +10,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _react =
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
var _react = require("react");
|
|
17
14
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
18
15
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
16
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -43,10 +40,10 @@ var BaseErrorBoundary = exports.BaseErrorBoundary = /*#__PURE__*/function (_Comp
|
|
|
43
40
|
value: function render() {
|
|
44
41
|
var _this$props = this.props,
|
|
45
42
|
children = _this$props.children,
|
|
46
|
-
|
|
43
|
+
errorComponent = _this$props.errorComponent;
|
|
47
44
|
var hasError = this.state.hasError;
|
|
48
|
-
if (hasError &&
|
|
49
|
-
return
|
|
45
|
+
if (hasError && errorComponent) {
|
|
46
|
+
return errorComponent;
|
|
50
47
|
}
|
|
51
48
|
return children;
|
|
52
49
|
}
|
|
@@ -9,13 +9,14 @@ exports.ErrorBoundary = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
11
|
var _constants = require("../../../common/constants");
|
|
12
|
+
var _errorBoundaryUi = require("../../../common/ui/error-boundary-ui");
|
|
12
13
|
var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
|
|
13
14
|
var _errorBoundaryBase = require("./error-boundary-base");
|
|
14
|
-
var _errorBoundaryUi = require("./error-boundary-ui");
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
var ErrorBoundary = exports.ErrorBoundary = function ErrorBoundary(_ref) {
|
|
18
|
-
var children = _ref.children
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
errorComponent = _ref.errorComponent;
|
|
19
20
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
20
21
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
21
22
|
var handleError = (0, _react.useCallback)(function (error, info) {
|
|
@@ -32,6 +33,6 @@ var ErrorBoundary = exports.ErrorBoundary = function ErrorBoundary(_ref) {
|
|
|
32
33
|
}, [createAnalyticsEvent]);
|
|
33
34
|
return /*#__PURE__*/_react.default.createElement(_errorBoundaryBase.BaseErrorBoundary, {
|
|
34
35
|
onError: handleError,
|
|
35
|
-
|
|
36
|
+
errorComponent: errorComponent !== null && errorComponent !== void 0 ? errorComponent : /*#__PURE__*/_react.default.createElement(_errorBoundaryUi.ErrorBoundaryUI, null)
|
|
36
37
|
}, children);
|
|
37
38
|
};
|
package/dist/cjs/ui/main.js
CHANGED
|
@@ -11,20 +11,31 @@ var _react = require("react");
|
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
13
|
var _intlMessagesProvider = require("@atlaskit/intl-messages-provider");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _constants = require("../common/constants");
|
|
16
|
+
var _errorBoundaryModal = require("../common/ui/error-boundary-modal");
|
|
15
17
|
var _analytics = require("../common/utils/analytics");
|
|
16
18
|
var _fetchMessagesForLocale = require("../common/utils/locale/fetch-messages-for-locale");
|
|
17
19
|
var _en = _interopRequireDefault(require("../i18n/en"));
|
|
18
20
|
var _linkCreate = _interopRequireDefault(require("./link-create"));
|
|
21
|
+
var _errorBoundary = require("./link-create/error-boundary");
|
|
19
22
|
/** @jsx jsx */
|
|
20
23
|
|
|
21
24
|
var LinkCreateWithAnalyticsContext = (0, _analytics.withLinkCreateAnalyticsContext)( /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
22
25
|
var props = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref), _ref));
|
|
26
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.outer-error-boundary')) {
|
|
27
|
+
return (0, _react2.jsx)(_errorBoundary.ErrorBoundary, {
|
|
28
|
+
errorComponent: (0, _react2.jsx)(_errorBoundaryModal.ErrorBoundaryModal, {
|
|
29
|
+
active: props.active,
|
|
30
|
+
onClose: props.onCancel
|
|
31
|
+
})
|
|
32
|
+
}, (0, _react2.jsx)(_linkCreate.default, props));
|
|
33
|
+
}
|
|
23
34
|
return (0, _react2.jsx)(_linkCreate.default, props);
|
|
24
35
|
}));
|
|
25
36
|
var PACKAGE_DATA = exports.PACKAGE_DATA = {
|
|
26
37
|
packageName: "@atlaskit/link-create" || '',
|
|
27
|
-
packageVersion: "1.5.
|
|
38
|
+
packageVersion: "1.5.1" || '',
|
|
28
39
|
componentName: _constants.COMPONENT_NAME,
|
|
29
40
|
source: _constants.COMPONENT_NAME
|
|
30
41
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { UIAnalyticsEvent, useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
+
import AkButton from '@atlaskit/button';
|
|
5
|
+
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
6
|
+
import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
|
|
7
|
+
export const Button = /*#__PURE__*/forwardRef(({
|
|
8
|
+
actionSubjectId,
|
|
9
|
+
...props
|
|
10
|
+
}, ref) => {
|
|
11
|
+
const {
|
|
12
|
+
createAnalyticsEvent
|
|
13
|
+
} = useAnalyticsEvents();
|
|
14
|
+
return /*#__PURE__*/React.createElement(AkButton, _extends({}, props, {
|
|
15
|
+
ref: ref,
|
|
16
|
+
onClick: event => {
|
|
17
|
+
var _props$onClick;
|
|
18
|
+
const payload = createEventPayload(`ui.button.clicked.${actionSubjectId}`, {});
|
|
19
|
+
const analyticEvent = createAnalyticsEvent(payload);
|
|
20
|
+
const cloned = analyticEvent.clone();
|
|
21
|
+
analyticEvent.fire(ANALYTICS_CHANNEL);
|
|
22
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, event, cloned !== null && cloned !== void 0 ? cloned : new UIAnalyticsEvent({
|
|
23
|
+
payload
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import Modal, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
|
|
4
|
+
import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../constants';
|
|
5
|
+
import { ErrorBoundaryUI } from '../error-boundary-ui';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ErrorBoundaryModal props are the same as those passed to LinkCreate, which
|
|
9
|
+
* are used to control its active state
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const ErrorBoundaryModal = ({
|
|
13
|
+
active,
|
|
14
|
+
onClose
|
|
15
|
+
}) => {
|
|
16
|
+
return jsx(ModalTransition, null, active && jsx(Modal, {
|
|
17
|
+
testId: "link-create-error-boundary-modal",
|
|
18
|
+
onClose: onClose,
|
|
19
|
+
shouldScrollInViewport: true,
|
|
20
|
+
width: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`
|
|
21
|
+
}, jsx(ModalBody, null, jsx(ErrorBoundaryUI, null))));
|
|
22
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::af0139619517f37a8bca32ddb6b7d6e0>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
|
+
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
4
|
+
import createEventPayload from './analytics.codegen';
|
|
5
|
+
export const ScreenViewedEvent = ({
|
|
6
|
+
screen
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
createAnalyticsEvent
|
|
10
|
+
} = useAnalyticsEvents();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
createAnalyticsEvent(createEventPayload(`screen.${screen}.viewed`, {})).fire(ANALYTICS_CHANNEL);
|
|
13
|
+
}, [createAnalyticsEvent, screen]);
|
|
14
|
+
return null;
|
|
15
|
+
};
|
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import
|
|
3
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
4
4
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
5
|
+
import { Button } from '../../../common/ui/Button';
|
|
6
|
+
import { ScreenViewedEvent } from '../../../common/utils/analytics/components';
|
|
5
7
|
import messages from './messages';
|
|
8
|
+
const screen = 'linkCreateExitWarningScreen';
|
|
9
|
+
const context = {
|
|
10
|
+
component: screen,
|
|
11
|
+
source: screen
|
|
12
|
+
};
|
|
6
13
|
export const ConfirmDismissDialog = ({
|
|
7
14
|
active,
|
|
8
15
|
onCancelDismiss,
|
|
9
16
|
onConfirmDismiss
|
|
10
17
|
}) => {
|
|
11
18
|
const intl = useIntl();
|
|
12
|
-
return /*#__PURE__*/React.createElement(ModalTransition, null, active && /*#__PURE__*/React.createElement(
|
|
19
|
+
return /*#__PURE__*/React.createElement(ModalTransition, null, active && /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
20
|
+
data: context
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Modal, {
|
|
13
22
|
testId: "link-create-confirm-dismiss-dialog",
|
|
14
23
|
onClose: onCancelDismiss,
|
|
15
24
|
width: "small"
|
|
16
|
-
}, /*#__PURE__*/React.createElement(
|
|
25
|
+
}, /*#__PURE__*/React.createElement(ScreenViewedEvent, {
|
|
26
|
+
screen: "linkCreateExitWarningScreen"
|
|
27
|
+
}), /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, intl.formatMessage(messages.title))), /*#__PURE__*/React.createElement(ModalBody, null, intl.formatMessage(messages.description)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
actionSubjectId: "cancel",
|
|
17
29
|
appearance: "subtle",
|
|
18
30
|
onClick: onCancelDismiss
|
|
19
31
|
}, intl.formatMessage(messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
|
|
32
|
+
actionSubjectId: "confirm",
|
|
20
33
|
appearance: "primary",
|
|
21
34
|
onClick: onConfirmDismiss
|
|
22
|
-
}, intl.formatMessage(messages.confirmButtonLabel)))));
|
|
35
|
+
}, intl.formatMessage(messages.confirmButtonLabel))))));
|
|
23
36
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component } from 'react';
|
|
2
2
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
3
3
|
export class BaseErrorBoundary extends Component {
|
|
4
4
|
constructor(props) {
|
|
@@ -19,13 +19,13 @@ export class BaseErrorBoundary extends Component {
|
|
|
19
19
|
render() {
|
|
20
20
|
const {
|
|
21
21
|
children,
|
|
22
|
-
|
|
22
|
+
errorComponent
|
|
23
23
|
} = this.props;
|
|
24
24
|
const {
|
|
25
25
|
hasError
|
|
26
26
|
} = this.state;
|
|
27
|
-
if (hasError &&
|
|
28
|
-
return
|
|
27
|
+
if (hasError && errorComponent) {
|
|
28
|
+
return errorComponent;
|
|
29
29
|
}
|
|
30
30
|
return children;
|
|
31
31
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
4
|
+
import { ErrorBoundaryUI } from '../../../common/ui/error-boundary-ui';
|
|
4
5
|
import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
|
|
5
6
|
import { BaseErrorBoundary } from './error-boundary-base';
|
|
6
|
-
import { ErrorBoundaryUI } from './error-boundary-ui';
|
|
7
7
|
export const ErrorBoundary = ({
|
|
8
|
-
children
|
|
8
|
+
children,
|
|
9
|
+
errorComponent
|
|
9
10
|
}) => {
|
|
10
11
|
const {
|
|
11
12
|
createAnalyticsEvent
|
|
@@ -24,6 +25,6 @@ export const ErrorBoundary = ({
|
|
|
24
25
|
}, [createAnalyticsEvent]);
|
|
25
26
|
return /*#__PURE__*/React.createElement(BaseErrorBoundary, {
|
|
26
27
|
onError: handleError,
|
|
27
|
-
|
|
28
|
+
errorComponent: errorComponent !== null && errorComponent !== void 0 ? errorComponent : /*#__PURE__*/React.createElement(ErrorBoundaryUI, null)
|
|
28
29
|
}, children);
|
|
29
30
|
};
|
package/dist/es2019/ui/main.js
CHANGED
|
@@ -3,19 +3,30 @@ import { memo } from 'react';
|
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
5
5
|
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { COMPONENT_NAME } from '../common/constants';
|
|
8
|
+
import { ErrorBoundaryModal } from '../common/ui/error-boundary-modal';
|
|
7
9
|
import { withLinkCreateAnalyticsContext } from '../common/utils/analytics';
|
|
8
10
|
import { fetchMessagesForLocale } from '../common/utils/locale/fetch-messages-for-locale';
|
|
9
11
|
import i18nEN from '../i18n/en';
|
|
10
12
|
import LinkCreate from './link-create';
|
|
13
|
+
import { ErrorBoundary } from './link-create/error-boundary';
|
|
11
14
|
const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(({
|
|
12
15
|
...props
|
|
13
16
|
}) => {
|
|
17
|
+
if (getBooleanFF('platform.linking-platform.link-create.outer-error-boundary')) {
|
|
18
|
+
return jsx(ErrorBoundary, {
|
|
19
|
+
errorComponent: jsx(ErrorBoundaryModal, {
|
|
20
|
+
active: props.active,
|
|
21
|
+
onClose: props.onCancel
|
|
22
|
+
})
|
|
23
|
+
}, jsx(LinkCreate, props));
|
|
24
|
+
}
|
|
14
25
|
return jsx(LinkCreate, props);
|
|
15
26
|
}));
|
|
16
27
|
export const PACKAGE_DATA = {
|
|
17
28
|
packageName: "@atlaskit/link-create" || '',
|
|
18
|
-
packageVersion: "1.5.
|
|
29
|
+
packageVersion: "1.5.1" || '',
|
|
19
30
|
componentName: COMPONENT_NAME,
|
|
20
31
|
source: COMPONENT_NAME
|
|
21
32
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["actionSubjectId"];
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
|
+
import { UIAnalyticsEvent, useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
|
+
import AkButton from '@atlaskit/button';
|
|
7
|
+
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
8
|
+
import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
|
|
9
|
+
export var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
|
+
var actionSubjectId = _ref.actionSubjectId,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
13
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
14
|
+
return /*#__PURE__*/React.createElement(AkButton, _extends({}, props, {
|
|
15
|
+
ref: ref,
|
|
16
|
+
onClick: function onClick(event) {
|
|
17
|
+
var _props$onClick;
|
|
18
|
+
var payload = createEventPayload("ui.button.clicked.".concat(actionSubjectId), {});
|
|
19
|
+
var analyticEvent = createAnalyticsEvent(payload);
|
|
20
|
+
var cloned = analyticEvent.clone();
|
|
21
|
+
analyticEvent.fire(ANALYTICS_CHANNEL);
|
|
22
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, event, cloned !== null && cloned !== void 0 ? cloned : new UIAnalyticsEvent({
|
|
23
|
+
payload: payload
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import Modal, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
|
|
4
|
+
import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../constants';
|
|
5
|
+
import { ErrorBoundaryUI } from '../error-boundary-ui';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ErrorBoundaryModal props are the same as those passed to LinkCreate, which
|
|
9
|
+
* are used to control its active state
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export var ErrorBoundaryModal = function ErrorBoundaryModal(_ref) {
|
|
13
|
+
var active = _ref.active,
|
|
14
|
+
onClose = _ref.onClose;
|
|
15
|
+
return jsx(ModalTransition, null, active && jsx(Modal, {
|
|
16
|
+
testId: "link-create-error-boundary-modal",
|
|
17
|
+
onClose: onClose,
|
|
18
|
+
shouldScrollInViewport: true,
|
|
19
|
+
width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
|
|
20
|
+
}, jsx(ModalBody, null, jsx(ErrorBoundaryUI, null))));
|
|
21
|
+
};
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
*
|
|
5
5
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
6
6
|
*
|
|
7
|
-
* @codegen <<SignedSource::
|
|
7
|
+
* @codegen <<SignedSource::af0139619517f37a8bca32ddb6b7d6e0>>
|
|
8
8
|
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
|
+
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
4
|
+
import createEventPayload from './analytics.codegen';
|
|
5
|
+
export var ScreenViewedEvent = function ScreenViewedEvent(_ref) {
|
|
6
|
+
var screen = _ref.screen;
|
|
7
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
8
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
createAnalyticsEvent(createEventPayload("screen.".concat(screen, ".viewed"), {})).fire(ANALYTICS_CHANNEL);
|
|
11
|
+
}, [createAnalyticsEvent, screen]);
|
|
12
|
+
return null;
|
|
13
|
+
};
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
|
-
import
|
|
3
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
4
4
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
5
|
+
import { Button } from '../../../common/ui/Button';
|
|
6
|
+
import { ScreenViewedEvent } from '../../../common/utils/analytics/components';
|
|
5
7
|
import messages from './messages';
|
|
8
|
+
var screen = 'linkCreateExitWarningScreen';
|
|
9
|
+
var context = {
|
|
10
|
+
component: screen,
|
|
11
|
+
source: screen
|
|
12
|
+
};
|
|
6
13
|
export var ConfirmDismissDialog = function ConfirmDismissDialog(_ref) {
|
|
7
14
|
var active = _ref.active,
|
|
8
15
|
onCancelDismiss = _ref.onCancelDismiss,
|
|
9
16
|
onConfirmDismiss = _ref.onConfirmDismiss;
|
|
10
17
|
var intl = useIntl();
|
|
11
|
-
return /*#__PURE__*/React.createElement(ModalTransition, null, active && /*#__PURE__*/React.createElement(
|
|
18
|
+
return /*#__PURE__*/React.createElement(ModalTransition, null, active && /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
19
|
+
data: context
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Modal, {
|
|
12
21
|
testId: "link-create-confirm-dismiss-dialog",
|
|
13
22
|
onClose: onCancelDismiss,
|
|
14
23
|
width: "small"
|
|
15
|
-
}, /*#__PURE__*/React.createElement(
|
|
24
|
+
}, /*#__PURE__*/React.createElement(ScreenViewedEvent, {
|
|
25
|
+
screen: "linkCreateExitWarningScreen"
|
|
26
|
+
}), /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, intl.formatMessage(messages.title))), /*#__PURE__*/React.createElement(ModalBody, null, intl.formatMessage(messages.description)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
27
|
+
actionSubjectId: "cancel",
|
|
16
28
|
appearance: "subtle",
|
|
17
29
|
onClick: onCancelDismiss
|
|
18
30
|
}, intl.formatMessage(messages.cancelButtonLabel)), /*#__PURE__*/React.createElement(Button, {
|
|
31
|
+
actionSubjectId: "confirm",
|
|
19
32
|
appearance: "primary",
|
|
20
33
|
onClick: onConfirmDismiss
|
|
21
|
-
}, intl.formatMessage(messages.confirmButtonLabel)))));
|
|
34
|
+
}, intl.formatMessage(messages.confirmButtonLabel))))));
|
|
22
35
|
};
|
|
@@ -5,7 +5,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
7
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
8
|
-
import
|
|
8
|
+
import { Component } from 'react';
|
|
9
9
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
10
10
|
export var BaseErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
11
11
|
_inherits(BaseErrorBoundary, _Component);
|
|
@@ -33,10 +33,10 @@ export var BaseErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
|
33
33
|
value: function render() {
|
|
34
34
|
var _this$props = this.props,
|
|
35
35
|
children = _this$props.children,
|
|
36
|
-
|
|
36
|
+
errorComponent = _this$props.errorComponent;
|
|
37
37
|
var hasError = this.state.hasError;
|
|
38
|
-
if (hasError &&
|
|
39
|
-
return
|
|
38
|
+
if (hasError && errorComponent) {
|
|
39
|
+
return errorComponent;
|
|
40
40
|
}
|
|
41
41
|
return children;
|
|
42
42
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
4
|
+
import { ErrorBoundaryUI } from '../../../common/ui/error-boundary-ui';
|
|
4
5
|
import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
|
|
5
6
|
import { BaseErrorBoundary } from './error-boundary-base';
|
|
6
|
-
import { ErrorBoundaryUI } from './error-boundary-ui';
|
|
7
7
|
export var ErrorBoundary = function ErrorBoundary(_ref) {
|
|
8
|
-
var children = _ref.children
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
errorComponent = _ref.errorComponent;
|
|
9
10
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
10
11
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
11
12
|
var handleError = useCallback(function (error, info) {
|
|
@@ -22,6 +23,6 @@ export var ErrorBoundary = function ErrorBoundary(_ref) {
|
|
|
22
23
|
}, [createAnalyticsEvent]);
|
|
23
24
|
return /*#__PURE__*/React.createElement(BaseErrorBoundary, {
|
|
24
25
|
onError: handleError,
|
|
25
|
-
|
|
26
|
+
errorComponent: errorComponent !== null && errorComponent !== void 0 ? errorComponent : /*#__PURE__*/React.createElement(ErrorBoundaryUI, null)
|
|
26
27
|
}, children);
|
|
27
28
|
};
|
package/dist/esm/ui/main.js
CHANGED
|
@@ -5,18 +5,29 @@ import { memo } from 'react';
|
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
7
7
|
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { COMPONENT_NAME } from '../common/constants';
|
|
10
|
+
import { ErrorBoundaryModal } from '../common/ui/error-boundary-modal';
|
|
9
11
|
import { withLinkCreateAnalyticsContext } from '../common/utils/analytics';
|
|
10
12
|
import { fetchMessagesForLocale } from '../common/utils/locale/fetch-messages-for-locale';
|
|
11
13
|
import i18nEN from '../i18n/en';
|
|
12
14
|
import LinkCreate from './link-create';
|
|
15
|
+
import { ErrorBoundary } from './link-create/error-boundary';
|
|
13
16
|
var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (_ref) {
|
|
14
17
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
18
|
+
if (getBooleanFF('platform.linking-platform.link-create.outer-error-boundary')) {
|
|
19
|
+
return jsx(ErrorBoundary, {
|
|
20
|
+
errorComponent: jsx(ErrorBoundaryModal, {
|
|
21
|
+
active: props.active,
|
|
22
|
+
onClose: props.onCancel
|
|
23
|
+
})
|
|
24
|
+
}, jsx(LinkCreate, props));
|
|
25
|
+
}
|
|
15
26
|
return jsx(LinkCreate, props);
|
|
16
27
|
}));
|
|
17
28
|
export var PACKAGE_DATA = {
|
|
18
29
|
packageName: "@atlaskit/link-create" || '',
|
|
19
|
-
packageVersion: "1.5.
|
|
30
|
+
packageVersion: "1.5.1" || '',
|
|
20
31
|
componentName: COMPONENT_NAME,
|
|
21
32
|
source: COMPONENT_NAME
|
|
22
33
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
3
|
+
export declare const Button: React.ForwardRefExoticComponent<Pick<import("@atlaskit/button").ButtonProps & React.RefAttributes<HTMLElement> & {
|
|
4
|
+
actionSubjectId: "create" | "cancel" | "confirm";
|
|
5
|
+
}, "key" | keyof import("@atlaskit/button").ButtonProps | "actionSubjectId"> & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* ErrorBoundaryModal props are the same as those passed to LinkCreate, which
|
|
4
|
+
* are used to control its active state
|
|
5
|
+
*/
|
|
6
|
+
type ErrorBoundaryModalProps = {
|
|
7
|
+
active?: boolean;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ErrorBoundaryModal: React.FC<ErrorBoundaryModalProps>;
|
|
11
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::af0139619517f37a8bca32ddb6b7d6e0>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataType = {
|
|
@@ -18,8 +18,10 @@ export type LinkCreateAnalyticsContextType = {
|
|
|
18
18
|
appearance: 'modal' | 'popup';
|
|
19
19
|
};
|
|
20
20
|
export type LinkCreateScreenViewedAttributesType = {};
|
|
21
|
+
export type LinkCreateExitWarningScreenViewedAttributesType = {};
|
|
21
22
|
export type ButtonClickedCreateAttributesType = {};
|
|
22
23
|
export type ButtonClickedCancelAttributesType = {};
|
|
24
|
+
export type ButtonClickedConfirmAttributesType = {};
|
|
23
25
|
export type ModalDialogClosedLinkCreateAttributesType = {};
|
|
24
26
|
export type LinkCreateUnhandledErrorCaughtAttributesType = {
|
|
25
27
|
browserInfo: string;
|
|
@@ -33,10 +35,12 @@ export type ObjectCreatedLinkCreateAttributesType = {
|
|
|
33
35
|
export type ObjectCreateFailedLinkCreateAttributesType = {
|
|
34
36
|
failureType: string;
|
|
35
37
|
};
|
|
36
|
-
type AnalyticsEventAttributes = {
|
|
38
|
+
export type AnalyticsEventAttributes = {
|
|
37
39
|
'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
|
|
40
|
+
'screen.linkCreateExitWarningScreen.viewed': LinkCreateExitWarningScreenViewedAttributesType;
|
|
38
41
|
'ui.button.clicked.create': ButtonClickedCreateAttributesType;
|
|
39
42
|
'ui.button.clicked.cancel': ButtonClickedCancelAttributesType;
|
|
43
|
+
'ui.button.clicked.confirm': ButtonClickedConfirmAttributesType;
|
|
40
44
|
'ui.modalDialog.closed.linkCreate': ModalDialogClosedLinkCreateAttributesType;
|
|
41
45
|
'operational.linkCreate.unhandledErrorCaught': LinkCreateUnhandledErrorCaughtAttributesType;
|
|
42
46
|
'track.object.created.linkCreate': ObjectCreatedLinkCreateAttributesType;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnalyticsEventAttributes } from './analytics.codegen';
|
|
2
|
+
type ScreenViewedEventProps = {
|
|
3
|
+
screen: keyof {
|
|
4
|
+
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const ScreenViewedEvent: ({ screen }: ScreenViewedEventProps) => null;
|
|
8
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
|
2
2
|
export type ErrorBoundaryErrorInfo = {
|
|
3
3
|
componentStack: string;
|
|
4
4
|
};
|
|
@@ -7,12 +7,12 @@ type BaseErrorBoundaryState = {
|
|
|
7
7
|
};
|
|
8
8
|
interface BaseErrorBoundaryProps {
|
|
9
9
|
children: ReactNode;
|
|
10
|
-
|
|
10
|
+
errorComponent?: JSX.Element;
|
|
11
11
|
onError?: (error: Error, info?: ErrorBoundaryErrorInfo) => void;
|
|
12
12
|
}
|
|
13
13
|
export declare class BaseErrorBoundary extends Component<BaseErrorBoundaryProps, BaseErrorBoundaryState> {
|
|
14
14
|
constructor(props: BaseErrorBoundaryProps);
|
|
15
15
|
componentDidCatch(error: Error, info?: ErrorBoundaryErrorInfo): void;
|
|
16
|
-
render():
|
|
16
|
+
render(): ReactNode;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
3
|
+
export declare const Button: React.ForwardRefExoticComponent<Pick<import("@atlaskit/button").ButtonProps & React.RefAttributes<HTMLElement> & {
|
|
4
|
+
actionSubjectId: "create" | "cancel" | "confirm";
|
|
5
|
+
}, "key" | keyof import("@atlaskit/button").ButtonProps | "actionSubjectId"> & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* ErrorBoundaryModal props are the same as those passed to LinkCreate, which
|
|
4
|
+
* are used to control its active state
|
|
5
|
+
*/
|
|
6
|
+
type ErrorBoundaryModalProps = {
|
|
7
|
+
active?: boolean;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ErrorBoundaryModal: React.FC<ErrorBoundaryModalProps>;
|
|
11
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::af0139619517f37a8bca32ddb6b7d6e0>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataType = {
|
|
@@ -18,8 +18,10 @@ export type LinkCreateAnalyticsContextType = {
|
|
|
18
18
|
appearance: 'modal' | 'popup';
|
|
19
19
|
};
|
|
20
20
|
export type LinkCreateScreenViewedAttributesType = {};
|
|
21
|
+
export type LinkCreateExitWarningScreenViewedAttributesType = {};
|
|
21
22
|
export type ButtonClickedCreateAttributesType = {};
|
|
22
23
|
export type ButtonClickedCancelAttributesType = {};
|
|
24
|
+
export type ButtonClickedConfirmAttributesType = {};
|
|
23
25
|
export type ModalDialogClosedLinkCreateAttributesType = {};
|
|
24
26
|
export type LinkCreateUnhandledErrorCaughtAttributesType = {
|
|
25
27
|
browserInfo: string;
|
|
@@ -33,10 +35,12 @@ export type ObjectCreatedLinkCreateAttributesType = {
|
|
|
33
35
|
export type ObjectCreateFailedLinkCreateAttributesType = {
|
|
34
36
|
failureType: string;
|
|
35
37
|
};
|
|
36
|
-
type AnalyticsEventAttributes = {
|
|
38
|
+
export type AnalyticsEventAttributes = {
|
|
37
39
|
'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
|
|
40
|
+
'screen.linkCreateExitWarningScreen.viewed': LinkCreateExitWarningScreenViewedAttributesType;
|
|
38
41
|
'ui.button.clicked.create': ButtonClickedCreateAttributesType;
|
|
39
42
|
'ui.button.clicked.cancel': ButtonClickedCancelAttributesType;
|
|
43
|
+
'ui.button.clicked.confirm': ButtonClickedConfirmAttributesType;
|
|
40
44
|
'ui.modalDialog.closed.linkCreate': ModalDialogClosedLinkCreateAttributesType;
|
|
41
45
|
'operational.linkCreate.unhandledErrorCaught': LinkCreateUnhandledErrorCaughtAttributesType;
|
|
42
46
|
'track.object.created.linkCreate': ObjectCreatedLinkCreateAttributesType;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnalyticsEventAttributes } from './analytics.codegen';
|
|
2
|
+
type ScreenViewedEventProps = {
|
|
3
|
+
screen: keyof {
|
|
4
|
+
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const ScreenViewedEvent: ({ screen }: ScreenViewedEventProps) => null;
|
|
8
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
|
2
2
|
export type ErrorBoundaryErrorInfo = {
|
|
3
3
|
componentStack: string;
|
|
4
4
|
};
|
|
@@ -7,12 +7,12 @@ type BaseErrorBoundaryState = {
|
|
|
7
7
|
};
|
|
8
8
|
interface BaseErrorBoundaryProps {
|
|
9
9
|
children: ReactNode;
|
|
10
|
-
|
|
10
|
+
errorComponent?: JSX.Element;
|
|
11
11
|
onError?: (error: Error, info?: ErrorBoundaryErrorInfo) => void;
|
|
12
12
|
}
|
|
13
13
|
export declare class BaseErrorBoundary extends Component<BaseErrorBoundaryProps, BaseErrorBoundaryState> {
|
|
14
14
|
constructor(props: BaseErrorBoundaryProps);
|
|
15
15
|
componentDidCatch(error: Error, info?: ErrorBoundaryErrorInfo): void;
|
|
16
|
-
render():
|
|
16
|
+
render(): ReactNode;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-create",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "The driver component of meta creation flow",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
38
|
-
"@atlaskit/button": "^16.
|
|
38
|
+
"@atlaskit/button": "^16.13.0",
|
|
39
39
|
"@atlaskit/empty-state": "^7.6.0",
|
|
40
40
|
"@atlaskit/form": "^8.11.0",
|
|
41
41
|
"@atlaskit/icon": "^21.12.0",
|
|
42
42
|
"@atlaskit/intl-messages-provider": "^1.0.0",
|
|
43
43
|
"@atlaskit/modal-dialog": "^12.8.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
45
|
-
"@atlaskit/primitives": "^1.
|
|
45
|
+
"@atlaskit/primitives": "^1.9.0",
|
|
46
46
|
"@atlaskit/select": "^16.7.0",
|
|
47
47
|
"@atlaskit/spinner": "^15.6.0",
|
|
48
48
|
"@atlaskit/textfield": "^5.6.0",
|
|
@@ -117,6 +117,9 @@
|
|
|
117
117
|
},
|
|
118
118
|
"platform.linking-platform.link-create.confirm-dismiss-dialog": {
|
|
119
119
|
"type": "boolean"
|
|
120
|
+
},
|
|
121
|
+
"platform.linking-platform.link-create.outer-error-boundary": {
|
|
122
|
+
"type": "boolean"
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
}
|
/package/dist/cjs/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/es2019/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.js
RENAMED
|
File without changes
|
/package/dist/esm/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.d.ts
RENAMED
|
File without changes
|
/package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/types-ts4.5/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.d.ts
RENAMED
|
File without changes
|
|
File without changes
|