@atlaskit/link-create 1.4.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/analytics.spec.yaml +14 -0
  3. package/dist/cjs/common/ui/Button/index.js +37 -0
  4. package/dist/cjs/common/ui/error-boundary-modal/index.js +30 -0
  5. package/dist/cjs/common/utils/analytics/analytics.codegen.js +1 -1
  6. package/dist/cjs/common/utils/analytics/components.js +20 -0
  7. package/dist/cjs/controllers/edit-post-create-context/index.js +43 -0
  8. package/dist/cjs/controllers/plugin-context/index.js +39 -0
  9. package/dist/cjs/ui/link-create/confirm-dismiss-dialog/main.js +18 -5
  10. package/dist/cjs/ui/link-create/edit-modal/index.js +25 -0
  11. package/dist/cjs/ui/link-create/error-boundary/error-boundary-base/index.js +4 -7
  12. package/dist/cjs/ui/link-create/error-boundary/index.js +4 -3
  13. package/dist/cjs/ui/link-create/main.js +17 -2
  14. package/dist/cjs/ui/main.js +12 -1
  15. package/dist/es2019/common/ui/Button/index.js +27 -0
  16. package/dist/es2019/common/ui/error-boundary-modal/index.js +22 -0
  17. package/dist/es2019/common/utils/analytics/analytics.codegen.js +1 -1
  18. package/dist/es2019/common/utils/analytics/components.js +15 -0
  19. package/dist/es2019/controllers/edit-post-create-context/index.js +28 -0
  20. package/dist/es2019/controllers/plugin-context/index.js +25 -0
  21. package/dist/es2019/ui/link-create/confirm-dismiss-dialog/main.js +17 -4
  22. package/dist/es2019/ui/link-create/edit-modal/index.js +17 -0
  23. package/dist/es2019/ui/link-create/error-boundary/error-boundary-base/index.js +4 -4
  24. package/dist/es2019/ui/link-create/error-boundary/index.js +4 -3
  25. package/dist/es2019/ui/link-create/main.js +17 -2
  26. package/dist/es2019/ui/main.js +12 -1
  27. package/dist/esm/common/ui/Button/index.js +27 -0
  28. package/dist/esm/common/ui/error-boundary-modal/index.js +21 -0
  29. package/dist/esm/common/utils/analytics/analytics.codegen.js +1 -1
  30. package/dist/esm/common/utils/analytics/components.js +13 -0
  31. package/dist/esm/controllers/edit-post-create-context/index.js +33 -0
  32. package/dist/esm/controllers/plugin-context/index.js +29 -0
  33. package/dist/esm/ui/link-create/confirm-dismiss-dialog/main.js +17 -4
  34. package/dist/esm/ui/link-create/edit-modal/index.js +15 -0
  35. package/dist/esm/ui/link-create/error-boundary/error-boundary-base/index.js +4 -4
  36. package/dist/esm/ui/link-create/error-boundary/index.js +4 -3
  37. package/dist/esm/ui/link-create/main.js +17 -2
  38. package/dist/esm/ui/main.js +12 -1
  39. package/dist/types/common/ui/Button/index.d.ts +5 -0
  40. package/dist/types/common/ui/error-boundary-modal/index.d.ts +11 -0
  41. package/dist/types/common/utils/analytics/analytics.codegen.d.ts +6 -2
  42. package/dist/types/common/utils/analytics/components.d.ts +8 -0
  43. package/dist/types/controllers/edit-post-create-context/index.d.ts +12 -0
  44. package/dist/types/controllers/plugin-context/index.d.ts +18 -0
  45. package/dist/types/ui/link-create/edit-modal/index.d.ts +4 -0
  46. package/dist/types/ui/link-create/error-boundary/error-boundary-base/index.d.ts +3 -3
  47. package/dist/types/ui/link-create/error-boundary/index.d.ts +5 -1
  48. package/dist/types-ts4.5/common/ui/Button/index.d.ts +5 -0
  49. package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +11 -0
  50. package/dist/types-ts4.5/common/utils/analytics/analytics.codegen.d.ts +6 -2
  51. package/dist/types-ts4.5/common/utils/analytics/components.d.ts +8 -0
  52. package/dist/types-ts4.5/controllers/edit-post-create-context/index.d.ts +12 -0
  53. package/dist/types-ts4.5/controllers/plugin-context/index.d.ts +18 -0
  54. package/dist/types-ts4.5/ui/link-create/edit-modal/index.d.ts +4 -0
  55. package/dist/types-ts4.5/ui/link-create/error-boundary/error-boundary-base/index.d.ts +3 -3
  56. package/dist/types-ts4.5/ui/link-create/error-boundary/index.d.ts +5 -1
  57. package/package.json +6 -3
  58. /package/dist/cjs/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js +0 -0
  59. /package/dist/cjs/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.js +0 -0
  60. /package/dist/cjs/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.js +0 -0
  61. /package/dist/es2019/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js +0 -0
  62. /package/dist/es2019/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.js +0 -0
  63. /package/dist/es2019/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.js +0 -0
  64. /package/dist/esm/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.js +0 -0
  65. /package/dist/esm/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.js +0 -0
  66. /package/dist/esm/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.js +0 -0
  67. /package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.d.ts +0 -0
  68. /package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.d.ts +0 -0
  69. /package/dist/types/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.d.ts +0 -0
  70. /package/dist/types-ts4.5/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/error-svg/index.d.ts +0 -0
  71. /package/dist/types-ts4.5/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/index.d.ts +0 -0
  72. /package/dist/types-ts4.5/{ui/link-create/error-boundary → common/ui}/error-boundary-ui/messages.d.ts +0 -0
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import Modal, { ModalTransition } from '@atlaskit/modal-dialog';
3
+ import { useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
4
+ export const EditModal = ({
5
+ onClose
6
+ }) => {
7
+ const {
8
+ editViewPayload
9
+ } = useEditPostCreateModal();
10
+ return /*#__PURE__*/React.createElement(ModalTransition, null, !!editViewPayload && /*#__PURE__*/React.createElement(Modal, {
11
+ testId: "link-create-edit-modal",
12
+ onClose: onClose,
13
+ shouldScrollInViewport: true,
14
+ width: "calc(100vw - 120px)",
15
+ height: "calc(100vh - 120px)"
16
+ }));
17
+ };
@@ -1,4 +1,4 @@
1
- import React, { Component } from 'react';
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
- ErrorComponent
22
+ errorComponent
23
23
  } = this.props;
24
24
  const {
25
25
  hasError
26
26
  } = this.state;
27
- if (hasError && ErrorComponent) {
28
- return /*#__PURE__*/React.createElement(ErrorComponent, null);
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
- ErrorComponent: ErrorBoundaryUI
28
+ errorComponent: errorComponent !== null && errorComponent !== void 0 ? errorComponent : /*#__PURE__*/React.createElement(ErrorBoundaryUI, null)
28
29
  }, children);
29
30
  };
@@ -8,8 +8,11 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
8
  import { Box } from '@atlaskit/primitives';
9
9
  import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../common/constants';
10
10
  import { LinkCreateCallbackProvider } from '../../controllers/callback-context';
11
+ import { EditPostCreateModalProvider } from '../../controllers/edit-post-create-context';
11
12
  import { useFormContext, withLinkCreateFormContext } from '../../controllers/form-context';
13
+ import { LinkCreatePluginsProvider } from '../../controllers/plugin-context';
12
14
  import { ConfirmDismissDialog } from './confirm-dismiss-dialog';
15
+ import { EditModal } from './edit-modal';
13
16
  import { ErrorBoundary } from './error-boundary';
14
17
  import { messages } from './messages';
15
18
  import TrackMount from './track-mount';
@@ -92,10 +95,22 @@ const LinkCreateWithModal = ({
92
95
  width: `${CREATE_FORM_MAX_WIDTH_IN_PX}px`
93
96
  }, jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(LinkCreate, _extends({}, createProps, {
94
97
  onCancel: handleCancel
95
- }))))), jsx(ConfirmDismissDialog, {
98
+ }))))), getBooleanFF('platform.linking-platform.link-create.enable-edit') && jsx(EditModal, {
99
+ onClose: handleCancel
100
+ }), getBooleanFF('platform.linking-platform.link-create.confirm-dismiss-dialog') && jsx(ConfirmDismissDialog, {
96
101
  active: dismissDialog,
97
102
  onCancelDismiss: handleCancelDismiss,
98
103
  onConfirmDismiss: handleConfirmDismiss
99
104
  }));
100
105
  };
101
- export default withLinkCreateFormContext(LinkCreateWithModal);
106
+ export default withLinkCreateFormContext(props => {
107
+ if (getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
108
+ return jsx(LinkCreatePluginsProvider, {
109
+ plugins: props.plugins,
110
+ entityKey: props.entityKey
111
+ }, jsx(EditPostCreateModalProvider, {
112
+ active: !!props.active
113
+ }, jsx(LinkCreateWithModal, props)));
114
+ }
115
+ return jsx(LinkCreateWithModal, props);
116
+ });
@@ -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.4.0" || '',
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::afcb2b69ebf56a35a2926fa7fdfd1118>>
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
+ };
@@ -0,0 +1,33 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { createContext, useContext, useMemo, useState } from 'react';
3
+ var EditPostCreateModalContext = /*#__PURE__*/createContext({
4
+ editViewPayload: undefined,
5
+ setEditViewPayload: function setEditViewPayload() {}
6
+ });
7
+ export var EditPostCreateModalProvider = function EditPostCreateModalProvider(_ref) {
8
+ var active = _ref.active,
9
+ children = _ref.children;
10
+ var _useState = useState(undefined),
11
+ _useState2 = _slicedToArray(_useState, 2),
12
+ editViewPayload = _useState2[0],
13
+ setEditViewPayload = _useState2[1];
14
+ var value = useMemo(function () {
15
+ return {
16
+ editViewPayload: editViewPayload,
17
+ setEditViewPayload: setEditViewPayload
18
+ };
19
+ }, [editViewPayload, setEditViewPayload]);
20
+ if (editViewPayload && !active) {
21
+ setEditViewPayload(undefined);
22
+ }
23
+ return /*#__PURE__*/React.createElement(EditPostCreateModalContext.Provider, {
24
+ value: value
25
+ }, children);
26
+ };
27
+ export var useEditPostCreateModal = function useEditPostCreateModal() {
28
+ var value = useContext(EditPostCreateModalContext);
29
+ if (!value) {
30
+ throw new Error('useEditPostCreateModal used outside of useEditPostCreateModalProvider');
31
+ }
32
+ return value;
33
+ };
@@ -0,0 +1,29 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { createContext, useContext, useMemo, useState } from 'react';
3
+ var LinkCreatePluginsContext = /*#__PURE__*/createContext(null);
4
+ export var LinkCreatePluginsProvider = function LinkCreatePluginsProvider(_ref) {
5
+ var plugins = _ref.plugins,
6
+ propEntityKey = _ref.entityKey,
7
+ children = _ref.children;
8
+ var _useState = useState(propEntityKey),
9
+ _useState2 = _slicedToArray(_useState, 1),
10
+ entityKey = _useState2[0];
11
+ var value = useMemo(function () {
12
+ var _plugins$find;
13
+ return {
14
+ activePlugin: (_plugins$find = plugins.find(function (plugin) {
15
+ return plugin.key === entityKey;
16
+ })) !== null && _plugins$find !== void 0 ? _plugins$find : null
17
+ };
18
+ }, [entityKey, plugins]);
19
+ return /*#__PURE__*/React.createElement(LinkCreatePluginsContext.Provider, {
20
+ value: value
21
+ }, children);
22
+ };
23
+ export var useLinkCreatePlugins = function useLinkCreatePlugins() {
24
+ var value = useContext(LinkCreatePluginsContext);
25
+ if (!value) {
26
+ throw new Error('useLinkCreatePlugins used outside of LinkCreatePluginsProvider');
27
+ }
28
+ return value;
29
+ };
@@ -1,22 +1,35 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
- import Button from '@atlaskit/button';
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(Modal, {
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(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, {
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
  };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import Modal, { ModalTransition } from '@atlaskit/modal-dialog';
3
+ import { useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
4
+ export var EditModal = function EditModal(_ref) {
5
+ var onClose = _ref.onClose;
6
+ var _useEditPostCreateMod = useEditPostCreateModal(),
7
+ editViewPayload = _useEditPostCreateMod.editViewPayload;
8
+ return /*#__PURE__*/React.createElement(ModalTransition, null, !!editViewPayload && /*#__PURE__*/React.createElement(Modal, {
9
+ testId: "link-create-edit-modal",
10
+ onClose: onClose,
11
+ shouldScrollInViewport: true,
12
+ width: "calc(100vw - 120px)",
13
+ height: "calc(100vh - 120px)"
14
+ }));
15
+ };
@@ -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 React, { Component } from 'react';
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
- ErrorComponent = _this$props.ErrorComponent;
36
+ errorComponent = _this$props.errorComponent;
37
37
  var hasError = this.state.hasError;
38
- if (hasError && ErrorComponent) {
39
- return /*#__PURE__*/React.createElement(ErrorComponent, null);
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
- ErrorComponent: ErrorBoundaryUI
26
+ errorComponent: errorComponent !== null && errorComponent !== void 0 ? errorComponent : /*#__PURE__*/React.createElement(ErrorBoundaryUI, null)
26
27
  }, children);
27
28
  };
@@ -14,8 +14,11 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
14
  import { Box } from '@atlaskit/primitives';
15
15
  import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../common/constants';
16
16
  import { LinkCreateCallbackProvider } from '../../controllers/callback-context';
17
+ import { EditPostCreateModalProvider } from '../../controllers/edit-post-create-context';
17
18
  import { useFormContext, withLinkCreateFormContext } from '../../controllers/form-context';
19
+ import { LinkCreatePluginsProvider } from '../../controllers/plugin-context';
18
20
  import { ConfirmDismissDialog } from './confirm-dismiss-dialog';
21
+ import { EditModal } from './edit-modal';
19
22
  import { ErrorBoundary } from './error-boundary';
20
23
  import { messages } from './messages';
21
24
  import TrackMount from './track-mount';
@@ -115,10 +118,22 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref4) {
115
118
  width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
116
119
  }, jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(LinkCreate, _extends({}, createProps, {
117
120
  onCancel: handleCancel
118
- }))))), jsx(ConfirmDismissDialog, {
121
+ }))))), getBooleanFF('platform.linking-platform.link-create.enable-edit') && jsx(EditModal, {
122
+ onClose: handleCancel
123
+ }), getBooleanFF('platform.linking-platform.link-create.confirm-dismiss-dialog') && jsx(ConfirmDismissDialog, {
119
124
  active: dismissDialog,
120
125
  onCancelDismiss: handleCancelDismiss,
121
126
  onConfirmDismiss: handleConfirmDismiss
122
127
  }));
123
128
  };
124
- export default withLinkCreateFormContext(LinkCreateWithModal);
129
+ export default withLinkCreateFormContext(function (props) {
130
+ if (getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
131
+ return jsx(LinkCreatePluginsProvider, {
132
+ plugins: props.plugins,
133
+ entityKey: props.entityKey
134
+ }, jsx(EditPostCreateModalProvider, {
135
+ active: !!props.active
136
+ }, jsx(LinkCreateWithModal, props)));
137
+ }
138
+ return jsx(LinkCreateWithModal, props);
139
+ });
@@ -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.4.0" || '',
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::afcb2b69ebf56a35a2926fa7fdfd1118>>
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 {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { CreatePayload } from '../../common/types';
3
+ type EditPostCreateModalContextValue = {
4
+ editViewPayload?: CreatePayload | undefined;
5
+ setEditViewPayload: (payload?: CreatePayload) => void;
6
+ };
7
+ export declare const EditPostCreateModalProvider: ({ active, children, }: {
8
+ active: boolean;
9
+ children: React.ReactNode;
10
+ }) => JSX.Element;
11
+ export declare const useEditPostCreateModal: () => EditPostCreateModalContextValue;
12
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { LinkCreatePlugin } from '../../common/types';
3
+ type LinkCreatePluginsProviderProps = {
4
+ /**
5
+ * The list of plugins provided as a prop to Link Create component
6
+ */
7
+ plugins: LinkCreatePlugin[];
8
+ /**
9
+ * The entity key as provided as prop to link create which controls the initially active plugin
10
+ */
11
+ entityKey: string;
12
+ children: React.ReactNode;
13
+ };
14
+ export declare const LinkCreatePluginsProvider: ({ plugins, entityKey: propEntityKey, children, }: LinkCreatePluginsProviderProps) => JSX.Element;
15
+ export declare const useLinkCreatePlugins: () => {
16
+ activePlugin: LinkCreatePlugin | null;
17
+ };
18
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const EditModal: ({ onClose }: {
3
+ onClose?: (() => void) | undefined;
4
+ }) => JSX.Element;
@@ -1,4 +1,4 @@
1
- import React, { Component, ReactNode } from 'react';
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
- ErrorComponent?: React.ComponentType;
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(): React.ReactNode;
16
+ render(): ReactNode;
17
17
  }
18
18
  export {};
@@ -1,2 +1,6 @@
1
1
  import React from 'react';
2
- export declare const ErrorBoundary: React.FC<{}>;
2
+ type ErrorBoundaryProps = {
3
+ errorComponent?: JSX.Element;
4
+ };
5
+ export declare const ErrorBoundary: React.FC<ErrorBoundaryProps>;
6
+ 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::afcb2b69ebf56a35a2926fa7fdfd1118>>
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;