@atlaskit/link-create 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-create
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#42436](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42436) [`08c8e861177`](https://bitbucket.org/atlassian/atlassian-frontend/commits/08c8e861177) - EDM-8371: internal refactor under feature flag platform.linking-platform.link-create.enable-edit
8
+
3
9
  ## 1.4.0
4
10
 
5
11
  ### Minor Changes
@@ -0,0 +1,43 @@
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.useEditPostCreateModal = exports.EditPostCreateModalProvider = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ 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); }
12
+ 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 EditPostCreateModalContext = /*#__PURE__*/(0, _react.createContext)({
14
+ editViewPayload: undefined,
15
+ setEditViewPayload: function setEditViewPayload() {}
16
+ });
17
+ var EditPostCreateModalProvider = exports.EditPostCreateModalProvider = function EditPostCreateModalProvider(_ref) {
18
+ var active = _ref.active,
19
+ children = _ref.children;
20
+ var _useState = (0, _react.useState)(undefined),
21
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
22
+ editViewPayload = _useState2[0],
23
+ setEditViewPayload = _useState2[1];
24
+ var value = (0, _react.useMemo)(function () {
25
+ return {
26
+ editViewPayload: editViewPayload,
27
+ setEditViewPayload: setEditViewPayload
28
+ };
29
+ }, [editViewPayload, setEditViewPayload]);
30
+ if (editViewPayload && !active) {
31
+ setEditViewPayload(undefined);
32
+ }
33
+ return /*#__PURE__*/_react.default.createElement(EditPostCreateModalContext.Provider, {
34
+ value: value
35
+ }, children);
36
+ };
37
+ var useEditPostCreateModal = exports.useEditPostCreateModal = function useEditPostCreateModal() {
38
+ var value = (0, _react.useContext)(EditPostCreateModalContext);
39
+ if (!value) {
40
+ throw new Error('useEditPostCreateModal used outside of useEditPostCreateModalProvider');
41
+ }
42
+ return value;
43
+ };
@@ -0,0 +1,39 @@
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.useLinkCreatePlugins = exports.LinkCreatePluginsProvider = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ 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); }
12
+ 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 LinkCreatePluginsContext = /*#__PURE__*/(0, _react.createContext)(null);
14
+ var LinkCreatePluginsProvider = exports.LinkCreatePluginsProvider = function LinkCreatePluginsProvider(_ref) {
15
+ var plugins = _ref.plugins,
16
+ propEntityKey = _ref.entityKey,
17
+ children = _ref.children;
18
+ var _useState = (0, _react.useState)(propEntityKey),
19
+ _useState2 = (0, _slicedToArray2.default)(_useState, 1),
20
+ entityKey = _useState2[0];
21
+ var value = (0, _react.useMemo)(function () {
22
+ var _plugins$find;
23
+ return {
24
+ activePlugin: (_plugins$find = plugins.find(function (plugin) {
25
+ return plugin.key === entityKey;
26
+ })) !== null && _plugins$find !== void 0 ? _plugins$find : null
27
+ };
28
+ }, [entityKey, plugins]);
29
+ return /*#__PURE__*/_react.default.createElement(LinkCreatePluginsContext.Provider, {
30
+ value: value
31
+ }, children);
32
+ };
33
+ var useLinkCreatePlugins = exports.useLinkCreatePlugins = function useLinkCreatePlugins() {
34
+ var value = (0, _react.useContext)(LinkCreatePluginsContext);
35
+ if (!value) {
36
+ throw new Error('useLinkCreatePlugins used outside of LinkCreatePluginsProvider');
37
+ }
38
+ return value;
39
+ };
@@ -0,0 +1,25 @@
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.EditModal = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
11
+ var _editPostCreateContext = require("../../../controllers/edit-post-create-context");
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
+ var EditModal = exports.EditModal = function EditModal(_ref) {
15
+ var onClose = _ref.onClose;
16
+ var _useEditPostCreateMod = (0, _editPostCreateContext.useEditPostCreateModal)(),
17
+ editViewPayload = _useEditPostCreateMod.editViewPayload;
18
+ return /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTransition, null, !!editViewPayload && /*#__PURE__*/_react.default.createElement(_modalDialog.default, {
19
+ testId: "link-create-edit-modal",
20
+ onClose: onClose,
21
+ shouldScrollInViewport: true,
22
+ width: "calc(100vw - 120px)",
23
+ height: "calc(100vh - 120px)"
24
+ }));
25
+ };
@@ -19,8 +19,11 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
19
  var _primitives = require("@atlaskit/primitives");
20
20
  var _constants = require("../../common/constants");
21
21
  var _callbackContext = require("../../controllers/callback-context");
22
+ var _editPostCreateContext = require("../../controllers/edit-post-create-context");
22
23
  var _formContext = require("../../controllers/form-context");
24
+ var _pluginContext = require("../../controllers/plugin-context");
23
25
  var _confirmDismissDialog = require("./confirm-dismiss-dialog");
26
+ var _editModal = require("./edit-modal");
24
27
  var _errorBoundary = require("./error-boundary");
25
28
  var _messages = require("./messages");
26
29
  var _trackMount = _interopRequireDefault(require("./track-mount"));
@@ -125,10 +128,22 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref4) {
125
128
  width: "".concat(_constants.CREATE_FORM_MAX_WIDTH_IN_PX, "px")
126
129
  }, (0, _react2.jsx)(_modalDialog.ModalHeader, null, (0, _react2.jsx)(_modalDialog.ModalTitle, null, modalTitle || intl.formatMessage(_messages.messages.heading))), (0, _react2.jsx)(_modalDialog.ModalBody, null, (0, _react2.jsx)(LinkCreate, (0, _extends2.default)({}, createProps, {
127
130
  onCancel: handleCancel
128
- }))))), (0, _react2.jsx)(_confirmDismissDialog.ConfirmDismissDialog, {
131
+ }))))), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit') && (0, _react2.jsx)(_editModal.EditModal, {
132
+ onClose: handleCancel
133
+ }), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.confirm-dismiss-dialog') && (0, _react2.jsx)(_confirmDismissDialog.ConfirmDismissDialog, {
129
134
  active: dismissDialog,
130
135
  onCancelDismiss: handleCancelDismiss,
131
136
  onConfirmDismiss: handleConfirmDismiss
132
137
  }));
133
138
  };
134
- var _default = exports.default = (0, _formContext.withLinkCreateFormContext)(LinkCreateWithModal);
139
+ var _default = exports.default = (0, _formContext.withLinkCreateFormContext)(function (props) {
140
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit')) {
141
+ return (0, _react2.jsx)(_pluginContext.LinkCreatePluginsProvider, {
142
+ plugins: props.plugins,
143
+ entityKey: props.entityKey
144
+ }, (0, _react2.jsx)(_editPostCreateContext.EditPostCreateModalProvider, {
145
+ active: !!props.active
146
+ }, (0, _react2.jsx)(LinkCreateWithModal, props)));
147
+ }
148
+ return (0, _react2.jsx)(LinkCreateWithModal, props);
149
+ });
@@ -24,7 +24,7 @@ var LinkCreateWithAnalyticsContext = (0, _analytics.withLinkCreateAnalyticsConte
24
24
  }));
25
25
  var PACKAGE_DATA = exports.PACKAGE_DATA = {
26
26
  packageName: "@atlaskit/link-create" || '',
27
- packageVersion: "1.4.0" || '',
27
+ packageVersion: "1.5.0" || '',
28
28
  componentName: _constants.COMPONENT_NAME,
29
29
  source: _constants.COMPONENT_NAME
30
30
  };
@@ -0,0 +1,28 @@
1
+ import React, { createContext, useContext, useMemo, useState } from 'react';
2
+ const EditPostCreateModalContext = /*#__PURE__*/createContext({
3
+ editViewPayload: undefined,
4
+ setEditViewPayload: () => {}
5
+ });
6
+ export const EditPostCreateModalProvider = ({
7
+ active,
8
+ children
9
+ }) => {
10
+ const [editViewPayload, setEditViewPayload] = useState(undefined);
11
+ const value = useMemo(() => ({
12
+ editViewPayload,
13
+ setEditViewPayload
14
+ }), [editViewPayload, setEditViewPayload]);
15
+ if (editViewPayload && !active) {
16
+ setEditViewPayload(undefined);
17
+ }
18
+ return /*#__PURE__*/React.createElement(EditPostCreateModalContext.Provider, {
19
+ value: value
20
+ }, children);
21
+ };
22
+ export const useEditPostCreateModal = () => {
23
+ const value = useContext(EditPostCreateModalContext);
24
+ if (!value) {
25
+ throw new Error('useEditPostCreateModal used outside of useEditPostCreateModalProvider');
26
+ }
27
+ return value;
28
+ };
@@ -0,0 +1,25 @@
1
+ import React, { createContext, useContext, useMemo, useState } from 'react';
2
+ const LinkCreatePluginsContext = /*#__PURE__*/createContext(null);
3
+ export const LinkCreatePluginsProvider = ({
4
+ plugins,
5
+ entityKey: propEntityKey,
6
+ children
7
+ }) => {
8
+ const [entityKey] = useState(propEntityKey);
9
+ const value = useMemo(() => {
10
+ var _plugins$find;
11
+ return {
12
+ activePlugin: (_plugins$find = plugins.find(plugin => plugin.key === entityKey)) !== null && _plugins$find !== void 0 ? _plugins$find : null
13
+ };
14
+ }, [entityKey, plugins]);
15
+ return /*#__PURE__*/React.createElement(LinkCreatePluginsContext.Provider, {
16
+ value: value
17
+ }, children);
18
+ };
19
+ export const useLinkCreatePlugins = () => {
20
+ const value = useContext(LinkCreatePluginsContext);
21
+ if (!value) {
22
+ throw new Error('useLinkCreatePlugins used outside of LinkCreatePluginsProvider');
23
+ }
24
+ return value;
25
+ };
@@ -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
+ };
@@ -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
+ });
@@ -15,7 +15,7 @@ const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE
15
15
  }));
16
16
  export const PACKAGE_DATA = {
17
17
  packageName: "@atlaskit/link-create" || '',
18
- packageVersion: "1.4.0" || '',
18
+ packageVersion: "1.5.0" || '',
19
19
  componentName: COMPONENT_NAME,
20
20
  source: COMPONENT_NAME
21
21
  };
@@ -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
+ };
@@ -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
+ };
@@ -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
+ });
@@ -16,7 +16,7 @@ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__
16
16
  }));
17
17
  export var PACKAGE_DATA = {
18
18
  packageName: "@atlaskit/link-create" || '',
19
- packageVersion: "1.4.0" || '',
19
+ packageVersion: "1.5.0" || '',
20
20
  componentName: COMPONENT_NAME,
21
21
  source: COMPONENT_NAME
22
22
  };
@@ -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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",