@atlaskit/link-create 1.11.6 → 1.12.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.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#60340](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60340) [`480de4a70eed`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/480de4a70eed) - EDM-8657: remove platform.linking-platform.link-create.enable-edit feature flag, to permanently enable the use of create and open (edit) flow in link create / link create confluence.
8
+
3
9
  ## 1.11.6
4
10
 
5
11
  ### Patch Changes
@@ -5,28 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.CreateFormFooter = CreateFormFooter;
8
- var _react = require("react");
9
- var _react2 = require("@emotion/react");
8
+ var _react = require("@emotion/react");
10
9
  var _reactIntlNext = require("react-intl-next");
11
- var _analyticsNext = require("@atlaskit/analytics-next");
12
10
  var _button = require("@atlaskit/button");
13
- var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
14
11
  var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/error"));
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
- var _constants = require("../../../common/constants");
17
12
  var _Button = require("../../../common/ui/Button");
18
- var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
19
13
  var _editButton = require("./edit-button");
20
14
  var _messages = require("./messages");
21
15
  var _submitButton = require("./submit-button");
22
16
  /** @jsx jsx */
23
17
 
24
- var formFooterWrapperStyles = (0, _react2.css)({
18
+ var formFooterWrapperStyles = (0, _react.css)({
25
19
  display: 'flex',
26
20
  marginTop: "var(--ds-space-300, 24px)",
27
21
  justifyContent: 'flex-end'
28
22
  });
29
- var errorStyles = (0, _react2.css)({
23
+ var errorStyles = (0, _react.css)({
30
24
  display: 'flex',
31
25
  alignItems: 'center',
32
26
  marginRight: 'auto'
@@ -39,33 +33,22 @@ var errorStyles = (0, _react2.css)({
39
33
  function CreateFormFooter(_ref) {
40
34
  var formErrorMessage = _ref.formErrorMessage,
41
35
  handleCancel = _ref.handleCancel,
42
- submitting = _ref.submitting,
43
36
  testId = _ref.testId;
44
37
  var intl = (0, _reactIntlNext.useIntl)();
45
- var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
46
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
47
- return (0, _react2.jsx)("footer", {
38
+ return (0, _react.jsx)("footer", {
48
39
  "data-testid": "".concat(testId, "-footer"),
49
40
  css: formFooterWrapperStyles
50
- }, formErrorMessage && (0, _react2.jsx)("div", {
41
+ }, formErrorMessage && (0, _react.jsx)("div", {
51
42
  css: errorStyles,
52
43
  "data-testid": "".concat(testId, "-error")
53
- }, (0, _react2.jsx)(_error.default, {
44
+ }, (0, _react.jsx)(_error.default, {
54
45
  label: formErrorMessage,
55
46
  primaryColor: "var(--ds-icon-danger, #E34935)"
56
- }), formErrorMessage), (0, _react2.jsx)(_button.ButtonGroup, null, (0, _react2.jsx)(_Button.Button, {
47
+ }), formErrorMessage), (0, _react.jsx)(_button.ButtonGroup, null, (0, _react.jsx)(_Button.Button, {
57
48
  type: "button",
58
49
  actionSubjectId: "cancel",
59
50
  appearance: "subtle",
60
51
  onClick: handleCancel,
61
52
  testId: "".concat(testId, "-button-cancel")
62
- }, intl.formatMessage(_messages.messages.close)), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit') ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_editButton.EditButton, null), (0, _react2.jsx)(_submitButton.SubmitButton, null)) : (0, _react2.jsx)(_loadingButton.default, {
63
- type: "submit",
64
- appearance: "primary",
65
- isLoading: submitting,
66
- testId: "".concat(testId, "-button-submit"),
67
- onClick: function onClick() {
68
- createAnalyticsEvent((0, _analytics.default)('ui.button.clicked.create', {})).fire(_constants.ANALYTICS_CHANNEL);
69
- }
70
- }, intl.formatMessage(_messages.messages.create))));
53
+ }, intl.formatMessage(_messages.messages.close)), (0, _react.jsx)(_editButton.EditButton, null), (0, _react.jsx)(_submitButton.SubmitButton, null)));
71
54
  }
@@ -34,7 +34,7 @@ var SubmitButton = exports.SubmitButton = function SubmitButton() {
34
34
  isLoading:
35
35
  /**
36
36
  * Should only be in a loading state if submitting is because we clicked
37
- * the edit button
37
+ * the submit button
38
38
  */
39
39
  submitting && values[_constants.LINK_CREATE_FORM_POST_CREATE_FIELD] === false,
40
40
  testId: "link-create-form-button-submit",
@@ -24,7 +24,7 @@ var _exitWarningModalContext = require("../../controllers/exit-warning-modal-con
24
24
  var _formContext = require("../../controllers/form-context");
25
25
  var _formFooter = require("./form-footer");
26
26
  var _formLoader = require("./form-loader");
27
- var _excluded = ["submitting", "submitError"];
27
+ var _excluded = ["submitError"];
28
28
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
29
29
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /** @jsx jsx */
30
30
  var formStyles = (0, _react2.css)({
@@ -58,10 +58,6 @@ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
58
58
  return _regenerator.default.wrap(function _callee$(_context) {
59
59
  while (1) switch (_context.prev = _context.next) {
60
60
  case 0:
61
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit')) {
62
- _context.next = 4;
63
- break;
64
- }
65
61
  shouldEnableEditView = data[_constants.LINK_CREATE_FORM_POST_CREATE_FIELD], formData = (0, _objectWithoutProperties2.default)(data, [_constants.LINK_CREATE_FORM_POST_CREATE_FIELD].map(_toPropertyKey));
66
62
  /**
67
63
  * If form has post-create field set to trigger post-create edit
@@ -75,9 +71,7 @@ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
75
71
  * It will be async, and it will likely involve awaiting `onCreate` (the adopters handler)
76
72
  */
77
73
  return _context.abrupt("return", onSubmit(formData));
78
- case 4:
79
- return _context.abrupt("return", onSubmit(data));
80
- case 5:
74
+ case 3:
81
75
  case "end":
82
76
  return _context.stop();
83
77
  }
@@ -138,8 +132,7 @@ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
138
132
  }
139
133
  }
140
134
  }, function (_ref5) {
141
- var submitting = _ref5.submitting,
142
- submitError = _ref5.submitError,
135
+ var submitError = _ref5.submitError,
143
136
  formProps = (0, _objectWithoutProperties2.default)(_ref5, _excluded);
144
137
  return (0, _react2.jsx)("form", {
145
138
  onSubmit: formProps.handleSubmit,
@@ -170,7 +163,6 @@ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
170
163
  */, {
171
164
  formErrorMessage: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.better-observability') ? submitError || formErrorMessage : formErrorMessage,
172
165
  handleCancel: handleCancel,
173
- submitting: submitting,
174
166
  testId: testId
175
167
  }));
176
168
  });
@@ -120,7 +120,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
120
120
  }, (0, _react2.jsx)(_errorBoundary.ErrorBoundary, null, (0, _react2.jsx)(LinkCreateContent, {
121
121
  plugins: plugins,
122
122
  entityKey: entityKey
123
- })))))), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit') && onComplete && (0, _react2.jsx)(_editModal.EditModal, {
123
+ })))))), onComplete && (0, _react2.jsx)(_editModal.EditModal, {
124
124
  onCloseComplete: onCloseComplete,
125
125
  onClose: onComplete
126
126
  }), (0, _react2.jsx)(_confirmDismissDialog.ConfirmDismissDialog, {
@@ -129,97 +129,71 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
129
129
  }));
130
130
  };
131
131
  var LinkCreateModal = function LinkCreateModal(props) {
132
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-edit')) {
133
- // eslint-disable-next-line react-hooks/rules-of-hooks
134
- var shouldCallCloseComplete = (0, _react.useRef)(!props.active);
132
+ var shouldCallCloseComplete = (0, _react.useRef)(!props.active);
135
133
 
136
- // modal calls onCloseComplete in a useEffect(), so we can track whether
137
- // or not we should execute it based on the active prop in a
138
- // useLayoutEffect() which will be run before child useEffect()s
139
- // eslint-disable-next-line react-hooks/rules-of-hooks
140
- (0, _react.useLayoutEffect)(function () {
141
- // onCloseComplete should only be called when it is not active
142
- shouldCallCloseComplete.current = !props.active;
143
- }, [props.active]);
144
- return (0, _react2.jsx)(_pluginContext.LinkCreatePluginsProvider, {
145
- plugins: props.plugins,
146
- entityKey: props.entityKey
147
- }, function (pluginsProvider) {
148
- return (0, _react2.jsx)(_editPostCreateContext.EditPostCreateModalProvider, {
149
- active: !!props.active
150
- }, function (_ref4) {
151
- var _pluginsProvider$acti;
152
- var setEditViewPayload = _ref4.setEditViewPayload,
153
- editViewPayload = _ref4.editViewPayload,
154
- shouldActivateEditView = _ref4.shouldActivateEditView,
155
- enableEditView = _ref4.enableEditView;
156
- return (0, _react2.jsx)(_formContext.FormContextProvider, {
157
- enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
158
- }, (0, _react2.jsx)(_exitWarningModalContext.ExitWarningModalProvider, null, (0, _react2.jsx)(LinkCreateWithModal, (0, _extends2.default)({}, props, {
159
- active: props.active && !editViewPayload,
160
- onCreate: /*#__PURE__*/function () {
161
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(payload) {
162
- var _props$onCreate;
163
- return _regenerator.default.wrap(function _callee2$(_context2) {
164
- while (1) switch (_context2.prev = _context2.next) {
165
- case 0:
166
- _context2.next = 2;
167
- return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
168
- case 2:
169
- // if onComplete exists then there is an edit flow
170
- if (props.onComplete) {
171
- if (shouldActivateEditView()) {
172
- //edit button is pressed
173
- setEditViewPayload(payload);
174
- } else {
175
- //create button is pressed
176
- props.onComplete();
177
- }
134
+ // modal calls onCloseComplete in a useEffect(), so we can track whether
135
+ // or not we should execute it based on the active prop in a
136
+ // useLayoutEffect() which will be run before child useEffect()s
137
+ (0, _react.useLayoutEffect)(function () {
138
+ // onCloseComplete should only be called when it is not active
139
+ shouldCallCloseComplete.current = !props.active;
140
+ }, [props.active]);
141
+ return (0, _react2.jsx)(_pluginContext.LinkCreatePluginsProvider, {
142
+ plugins: props.plugins,
143
+ entityKey: props.entityKey
144
+ }, function (pluginsProvider) {
145
+ return (0, _react2.jsx)(_editPostCreateContext.EditPostCreateModalProvider, {
146
+ active: !!props.active
147
+ }, function (_ref4) {
148
+ var _pluginsProvider$acti;
149
+ var setEditViewPayload = _ref4.setEditViewPayload,
150
+ editViewPayload = _ref4.editViewPayload,
151
+ shouldActivateEditView = _ref4.shouldActivateEditView,
152
+ enableEditView = _ref4.enableEditView;
153
+ return (0, _react2.jsx)(_formContext.FormContextProvider, {
154
+ enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
155
+ }, (0, _react2.jsx)(_exitWarningModalContext.ExitWarningModalProvider, null, (0, _react2.jsx)(LinkCreateWithModal, (0, _extends2.default)({}, props, {
156
+ active: props.active && !editViewPayload,
157
+ onCreate: /*#__PURE__*/function () {
158
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(payload) {
159
+ var _props$onCreate;
160
+ return _regenerator.default.wrap(function _callee2$(_context2) {
161
+ while (1) switch (_context2.prev = _context2.next) {
162
+ case 0:
163
+ _context2.next = 2;
164
+ return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
165
+ case 2:
166
+ // if onComplete exists then there is an edit flow
167
+ if (props.onComplete) {
168
+ if (shouldActivateEditView()) {
169
+ //edit button is pressed
170
+ setEditViewPayload(payload);
171
+ } else {
172
+ //create button is pressed
173
+ props.onComplete();
178
174
  }
179
- case 3:
180
- case "end":
181
- return _context2.stop();
182
- }
183
- }, _callee2);
184
- }));
185
- return function (_x2) {
186
- return _ref5.apply(this, arguments);
187
- };
188
- }(),
189
- onCloseComplete: function onCloseComplete() {
190
- if (shouldCallCloseComplete.current) {
191
- var _props$onCloseComplet;
192
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
193
- args[_key] = arguments[_key];
175
+ }
176
+ case 3:
177
+ case "end":
178
+ return _context2.stop();
194
179
  }
195
- (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
180
+ }, _callee2);
181
+ }));
182
+ return function (_x2) {
183
+ return _ref5.apply(this, arguments);
184
+ };
185
+ }(),
186
+ onCloseComplete: function onCloseComplete() {
187
+ if (shouldCallCloseComplete.current) {
188
+ var _props$onCloseComplet;
189
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
190
+ args[_key] = arguments[_key];
196
191
  }
192
+ (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
197
193
  }
198
- }))));
199
- });
194
+ }
195
+ }))));
200
196
  });
201
- }
202
- return (0, _react2.jsx)(_formContext.FormContextProvider, null, (0, _react2.jsx)(_exitWarningModalContext.ExitWarningModalProvider, null, (0, _react2.jsx)(LinkCreateWithModal, (0, _extends2.default)({}, props, {
203
- onCreate: /*#__PURE__*/function () {
204
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(payload) {
205
- var _props$onCreate2, _props$onComplete;
206
- return _regenerator.default.wrap(function _callee3$(_context3) {
207
- while (1) switch (_context3.prev = _context3.next) {
208
- case 0:
209
- _context3.next = 2;
210
- return (_props$onCreate2 = props.onCreate) === null || _props$onCreate2 === void 0 ? void 0 : _props$onCreate2.call(props, payload);
211
- case 2:
212
- (_props$onComplete = props.onComplete) === null || _props$onComplete === void 0 || _props$onComplete.call(props);
213
- case 3:
214
- case "end":
215
- return _context3.stop();
216
- }
217
- }, _callee3);
218
- }));
219
- return function (_x3) {
220
- return _ref6.apply(this, arguments);
221
- };
222
- }()
223
- }))));
197
+ });
224
198
  };
225
199
  var _default = exports.default = LinkCreateModal;
@@ -31,7 +31,7 @@ var LinkCreateWithAnalyticsContext = (0, _analytics.withLinkCreateAnalyticsConte
31
31
  }));
32
32
  var PACKAGE_DATA = exports.PACKAGE_DATA = {
33
33
  packageName: "@atlaskit/link-create" || '',
34
- packageVersion: "1.11.6" || '',
34
+ packageVersion: "1.12.0" || '',
35
35
  component: _constants.COMPONENT_NAME,
36
36
  componentName: _constants.COMPONENT_NAME
37
37
  };
@@ -1,15 +1,9 @@
1
1
  /** @jsx jsx */
2
- import { Fragment } from 'react';
3
2
  import { css, jsx } from '@emotion/react';
4
3
  import { useIntl } from 'react-intl-next';
5
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
4
  import { ButtonGroup } from '@atlaskit/button';
7
- import LoadingButton from '@atlaskit/button/loading-button';
8
5
  import ErrorIcon from '@atlaskit/icon/glyph/error';
9
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
- import { ANALYTICS_CHANNEL } from '../../../common/constants';
11
6
  import { Button } from '../../../common/ui/Button';
12
- import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
13
7
  import { EditButton } from './edit-button';
14
8
  import { messages } from './messages';
15
9
  import { SubmitButton } from './submit-button';
@@ -31,13 +25,9 @@ const errorStyles = css({
31
25
  export function CreateFormFooter({
32
26
  formErrorMessage,
33
27
  handleCancel,
34
- submitting,
35
28
  testId
36
29
  }) {
37
30
  const intl = useIntl();
38
- const {
39
- createAnalyticsEvent
40
- } = useAnalyticsEvents();
41
31
  return jsx("footer", {
42
32
  "data-testid": `${testId}-footer`,
43
33
  css: formFooterWrapperStyles
@@ -53,13 +43,5 @@ export function CreateFormFooter({
53
43
  appearance: "subtle",
54
44
  onClick: handleCancel,
55
45
  testId: `${testId}-button-cancel`
56
- }, intl.formatMessage(messages.close)), getBooleanFF('platform.linking-platform.link-create.enable-edit') ? jsx(Fragment, null, jsx(EditButton, null), jsx(SubmitButton, null)) : jsx(LoadingButton, {
57
- type: "submit",
58
- appearance: "primary",
59
- isLoading: submitting,
60
- testId: `${testId}-button-submit`,
61
- onClick: () => {
62
- createAnalyticsEvent(createEventPayload('ui.button.clicked.create', {})).fire(ANALYTICS_CHANNEL);
63
- }
64
- }, intl.formatMessage(messages.create))));
46
+ }, intl.formatMessage(messages.close)), jsx(EditButton, null), jsx(SubmitButton, null)));
65
47
  }
@@ -28,7 +28,7 @@ export const SubmitButton = () => {
28
28
  isLoading:
29
29
  /**
30
30
  * Should only be in a loading state if submitting is because we clicked
31
- * the edit button
31
+ * the submit button
32
32
  */
33
33
  submitting && values[LINK_CREATE_FORM_POST_CREATE_FIELD] === false,
34
34
  testId: "link-create-form-button-submit",
@@ -42,26 +42,23 @@ export const CreateForm = ({
42
42
  onFailure
43
43
  } = useLinkCreateCallback();
44
44
  const handleSubmit = useCallback(async data => {
45
- if (getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
46
- const {
47
- [LINK_CREATE_FORM_POST_CREATE_FIELD]: shouldEnableEditView,
48
- ...formData
49
- } = data;
45
+ const {
46
+ [LINK_CREATE_FORM_POST_CREATE_FIELD]: shouldEnableEditView,
47
+ ...formData
48
+ } = data;
50
49
 
51
- /**
52
- * If form has post-create field set to trigger post-create edit
53
- * send this to the form context so we know what to do next
54
- * if submission is successful
55
- */
56
- enableEditView === null || enableEditView === void 0 ? void 0 : enableEditView(!!shouldEnableEditView);
50
+ /**
51
+ * If form has post-create field set to trigger post-create edit
52
+ * send this to the form context so we know what to do next
53
+ * if submission is successful
54
+ */
55
+ enableEditView === null || enableEditView === void 0 ? void 0 : enableEditView(!!shouldEnableEditView);
57
56
 
58
- /**
59
- * This is the onSubmit handler provided by the plugin
60
- * It will be async, and it will likely involve awaiting `onCreate` (the adopters handler)
61
- */
62
- return onSubmit(formData);
63
- }
64
- return onSubmit(data);
57
+ /**
58
+ * This is the onSubmit handler provided by the plugin
59
+ * It will be async, and it will likely involve awaiting `onCreate` (the adopters handler)
60
+ */
61
+ return onSubmit(formData);
65
62
  }, [onSubmit, enableEditView]);
66
63
  const handleSubmitWithErrorHandling = useCallback(async (...args) => {
67
64
  try {
@@ -101,7 +98,6 @@ export const CreateForm = ({
101
98
  }
102
99
  }
103
100
  }, ({
104
- submitting,
105
101
  submitError,
106
102
  ...formProps
107
103
  }) => {
@@ -132,7 +128,6 @@ export const CreateForm = ({
132
128
  */, {
133
129
  formErrorMessage: getBooleanFF('platform.linking-platform.link-create.better-observability') ? submitError || formErrorMessage : formErrorMessage,
134
130
  handleCancel: handleCancel,
135
- submitting: submitting,
136
131
  testId: testId
137
132
  }));
138
133
  });
@@ -89,7 +89,7 @@ const LinkCreateWithModal = ({
89
89
  }, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
90
90
  plugins: plugins,
91
91
  entityKey: entityKey
92
- })))))), getBooleanFF('platform.linking-platform.link-create.enable-edit') && onComplete && jsx(EditModal, {
92
+ })))))), onComplete && jsx(EditModal, {
93
93
  onCloseComplete: onCloseComplete,
94
94
  onClose: onComplete
95
95
  }), jsx(ConfirmDismissDialog, {
@@ -98,64 +98,53 @@ const LinkCreateWithModal = ({
98
98
  }));
99
99
  };
100
100
  const LinkCreateModal = props => {
101
- if (getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
102
- // eslint-disable-next-line react-hooks/rules-of-hooks
103
- const shouldCallCloseComplete = useRef(!props.active);
101
+ const shouldCallCloseComplete = useRef(!props.active);
104
102
 
105
- // modal calls onCloseComplete in a useEffect(), so we can track whether
106
- // or not we should execute it based on the active prop in a
107
- // useLayoutEffect() which will be run before child useEffect()s
108
- // eslint-disable-next-line react-hooks/rules-of-hooks
109
- useLayoutEffect(() => {
110
- // onCloseComplete should only be called when it is not active
111
- shouldCallCloseComplete.current = !props.active;
112
- }, [props.active]);
113
- return jsx(LinkCreatePluginsProvider, {
114
- plugins: props.plugins,
115
- entityKey: props.entityKey
116
- }, pluginsProvider => jsx(EditPostCreateModalProvider, {
117
- active: !!props.active
118
- }, ({
119
- setEditViewPayload,
120
- editViewPayload,
121
- shouldActivateEditView,
122
- enableEditView
123
- }) => {
124
- var _pluginsProvider$acti;
125
- return jsx(FormContextProvider, {
126
- enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
127
- }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
128
- active: props.active && !editViewPayload,
129
- onCreate: async payload => {
130
- var _props$onCreate;
131
- await ((_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload));
103
+ // modal calls onCloseComplete in a useEffect(), so we can track whether
104
+ // or not we should execute it based on the active prop in a
105
+ // useLayoutEffect() which will be run before child useEffect()s
106
+ useLayoutEffect(() => {
107
+ // onCloseComplete should only be called when it is not active
108
+ shouldCallCloseComplete.current = !props.active;
109
+ }, [props.active]);
110
+ return jsx(LinkCreatePluginsProvider, {
111
+ plugins: props.plugins,
112
+ entityKey: props.entityKey
113
+ }, pluginsProvider => jsx(EditPostCreateModalProvider, {
114
+ active: !!props.active
115
+ }, ({
116
+ setEditViewPayload,
117
+ editViewPayload,
118
+ shouldActivateEditView,
119
+ enableEditView
120
+ }) => {
121
+ var _pluginsProvider$acti;
122
+ return jsx(FormContextProvider, {
123
+ enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
124
+ }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
125
+ active: props.active && !editViewPayload,
126
+ onCreate: async payload => {
127
+ var _props$onCreate;
128
+ await ((_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload));
132
129
 
133
- // if onComplete exists then there is an edit flow
134
- if (props.onComplete) {
135
- if (shouldActivateEditView()) {
136
- //edit button is pressed
137
- setEditViewPayload(payload);
138
- } else {
139
- //create button is pressed
140
- props.onComplete();
141
- }
142
- }
143
- },
144
- onCloseComplete: (...args) => {
145
- if (shouldCallCloseComplete.current) {
146
- var _props$onCloseComplet;
147
- (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 ? void 0 : _props$onCloseComplet.call(props, ...args);
130
+ // if onComplete exists then there is an edit flow
131
+ if (props.onComplete) {
132
+ if (shouldActivateEditView()) {
133
+ //edit button is pressed
134
+ setEditViewPayload(payload);
135
+ } else {
136
+ //create button is pressed
137
+ props.onComplete();
148
138
  }
149
139
  }
150
- }))));
151
- }));
152
- }
153
- return jsx(FormContextProvider, null, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
154
- onCreate: async payload => {
155
- var _props$onCreate2, _props$onComplete;
156
- await ((_props$onCreate2 = props.onCreate) === null || _props$onCreate2 === void 0 ? void 0 : _props$onCreate2.call(props, payload));
157
- (_props$onComplete = props.onComplete) === null || _props$onComplete === void 0 ? void 0 : _props$onComplete.call(props);
158
- }
159
- }))));
140
+ },
141
+ onCloseComplete: (...args) => {
142
+ if (shouldCallCloseComplete.current) {
143
+ var _props$onCloseComplet;
144
+ (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 ? void 0 : _props$onCloseComplet.call(props, ...args);
145
+ }
146
+ }
147
+ }))));
148
+ }));
160
149
  };
161
150
  export default LinkCreateModal;
@@ -23,7 +23,7 @@ const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE
23
23
  }));
24
24
  export const PACKAGE_DATA = {
25
25
  packageName: "@atlaskit/link-create" || '',
26
- packageVersion: "1.11.6" || '',
26
+ packageVersion: "1.12.0" || '',
27
27
  component: COMPONENT_NAME,
28
28
  componentName: COMPONENT_NAME
29
29
  };
@@ -1,15 +1,9 @@
1
1
  /** @jsx jsx */
2
- import { Fragment } from 'react';
3
2
  import { css, jsx } from '@emotion/react';
4
3
  import { useIntl } from 'react-intl-next';
5
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
4
  import { ButtonGroup } from '@atlaskit/button';
7
- import LoadingButton from '@atlaskit/button/loading-button';
8
5
  import ErrorIcon from '@atlaskit/icon/glyph/error';
9
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
- import { ANALYTICS_CHANNEL } from '../../../common/constants';
11
6
  import { Button } from '../../../common/ui/Button';
12
- import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
13
7
  import { EditButton } from './edit-button';
14
8
  import { messages } from './messages';
15
9
  import { SubmitButton } from './submit-button';
@@ -31,11 +25,8 @@ var errorStyles = css({
31
25
  export function CreateFormFooter(_ref) {
32
26
  var formErrorMessage = _ref.formErrorMessage,
33
27
  handleCancel = _ref.handleCancel,
34
- submitting = _ref.submitting,
35
28
  testId = _ref.testId;
36
29
  var intl = useIntl();
37
- var _useAnalyticsEvents = useAnalyticsEvents(),
38
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
39
30
  return jsx("footer", {
40
31
  "data-testid": "".concat(testId, "-footer"),
41
32
  css: formFooterWrapperStyles
@@ -51,13 +42,5 @@ export function CreateFormFooter(_ref) {
51
42
  appearance: "subtle",
52
43
  onClick: handleCancel,
53
44
  testId: "".concat(testId, "-button-cancel")
54
- }, intl.formatMessage(messages.close)), getBooleanFF('platform.linking-platform.link-create.enable-edit') ? jsx(Fragment, null, jsx(EditButton, null), jsx(SubmitButton, null)) : jsx(LoadingButton, {
55
- type: "submit",
56
- appearance: "primary",
57
- isLoading: submitting,
58
- testId: "".concat(testId, "-button-submit"),
59
- onClick: function onClick() {
60
- createAnalyticsEvent(createEventPayload('ui.button.clicked.create', {})).fire(ANALYTICS_CHANNEL);
61
- }
62
- }, intl.formatMessage(messages.create))));
45
+ }, intl.formatMessage(messages.close)), jsx(EditButton, null), jsx(SubmitButton, null)));
63
46
  }
@@ -25,7 +25,7 @@ export var SubmitButton = function SubmitButton() {
25
25
  isLoading:
26
26
  /**
27
27
  * Should only be in a loading state if submitting is because we clicked
28
- * the edit button
28
+ * the submit button
29
29
  */
30
30
  submitting && values[LINK_CREATE_FORM_POST_CREATE_FIELD] === false,
31
31
  testId: "link-create-form-button-submit",
@@ -2,7 +2,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
- var _excluded = ["submitting", "submitError"];
5
+ var _excluded = ["submitError"];
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
8
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
@@ -52,10 +52,6 @@ export var CreateForm = function CreateForm(_ref) {
52
52
  return _regeneratorRuntime.wrap(function _callee$(_context) {
53
53
  while (1) switch (_context.prev = _context.next) {
54
54
  case 0:
55
- if (!getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
56
- _context.next = 4;
57
- break;
58
- }
59
55
  shouldEnableEditView = data[LINK_CREATE_FORM_POST_CREATE_FIELD], formData = _objectWithoutProperties(data, [LINK_CREATE_FORM_POST_CREATE_FIELD].map(_toPropertyKey));
60
56
  /**
61
57
  * If form has post-create field set to trigger post-create edit
@@ -69,9 +65,7 @@ export var CreateForm = function CreateForm(_ref) {
69
65
  * It will be async, and it will likely involve awaiting `onCreate` (the adopters handler)
70
66
  */
71
67
  return _context.abrupt("return", onSubmit(formData));
72
- case 4:
73
- return _context.abrupt("return", onSubmit(data));
74
- case 5:
68
+ case 3:
75
69
  case "end":
76
70
  return _context.stop();
77
71
  }
@@ -132,8 +126,7 @@ export var CreateForm = function CreateForm(_ref) {
132
126
  }
133
127
  }
134
128
  }, function (_ref5) {
135
- var submitting = _ref5.submitting,
136
- submitError = _ref5.submitError,
129
+ var submitError = _ref5.submitError,
137
130
  formProps = _objectWithoutProperties(_ref5, _excluded);
138
131
  return jsx("form", {
139
132
  onSubmit: formProps.handleSubmit,
@@ -164,7 +157,6 @@ export var CreateForm = function CreateForm(_ref) {
164
157
  */, {
165
158
  formErrorMessage: getBooleanFF('platform.linking-platform.link-create.better-observability') ? submitError || formErrorMessage : formErrorMessage,
166
159
  handleCancel: handleCancel,
167
- submitting: submitting,
168
160
  testId: testId
169
161
  }));
170
162
  });
@@ -112,7 +112,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
112
112
  }, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
113
113
  plugins: plugins,
114
114
  entityKey: entityKey
115
- })))))), getBooleanFF('platform.linking-platform.link-create.enable-edit') && onComplete && jsx(EditModal, {
115
+ })))))), onComplete && jsx(EditModal, {
116
116
  onCloseComplete: onCloseComplete,
117
117
  onClose: onComplete
118
118
  }), jsx(ConfirmDismissDialog, {
@@ -121,97 +121,71 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
121
121
  }));
122
122
  };
123
123
  var LinkCreateModal = function LinkCreateModal(props) {
124
- if (getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
125
- // eslint-disable-next-line react-hooks/rules-of-hooks
126
- var shouldCallCloseComplete = useRef(!props.active);
124
+ var shouldCallCloseComplete = useRef(!props.active);
127
125
 
128
- // modal calls onCloseComplete in a useEffect(), so we can track whether
129
- // or not we should execute it based on the active prop in a
130
- // useLayoutEffect() which will be run before child useEffect()s
131
- // eslint-disable-next-line react-hooks/rules-of-hooks
132
- useLayoutEffect(function () {
133
- // onCloseComplete should only be called when it is not active
134
- shouldCallCloseComplete.current = !props.active;
135
- }, [props.active]);
136
- return jsx(LinkCreatePluginsProvider, {
137
- plugins: props.plugins,
138
- entityKey: props.entityKey
139
- }, function (pluginsProvider) {
140
- return jsx(EditPostCreateModalProvider, {
141
- active: !!props.active
142
- }, function (_ref4) {
143
- var _pluginsProvider$acti;
144
- var setEditViewPayload = _ref4.setEditViewPayload,
145
- editViewPayload = _ref4.editViewPayload,
146
- shouldActivateEditView = _ref4.shouldActivateEditView,
147
- enableEditView = _ref4.enableEditView;
148
- return jsx(FormContextProvider, {
149
- enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
150
- }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
151
- active: props.active && !editViewPayload,
152
- onCreate: /*#__PURE__*/function () {
153
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(payload) {
154
- var _props$onCreate;
155
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
156
- while (1) switch (_context2.prev = _context2.next) {
157
- case 0:
158
- _context2.next = 2;
159
- return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
160
- case 2:
161
- // if onComplete exists then there is an edit flow
162
- if (props.onComplete) {
163
- if (shouldActivateEditView()) {
164
- //edit button is pressed
165
- setEditViewPayload(payload);
166
- } else {
167
- //create button is pressed
168
- props.onComplete();
169
- }
126
+ // modal calls onCloseComplete in a useEffect(), so we can track whether
127
+ // or not we should execute it based on the active prop in a
128
+ // useLayoutEffect() which will be run before child useEffect()s
129
+ useLayoutEffect(function () {
130
+ // onCloseComplete should only be called when it is not active
131
+ shouldCallCloseComplete.current = !props.active;
132
+ }, [props.active]);
133
+ return jsx(LinkCreatePluginsProvider, {
134
+ plugins: props.plugins,
135
+ entityKey: props.entityKey
136
+ }, function (pluginsProvider) {
137
+ return jsx(EditPostCreateModalProvider, {
138
+ active: !!props.active
139
+ }, function (_ref4) {
140
+ var _pluginsProvider$acti;
141
+ var setEditViewPayload = _ref4.setEditViewPayload,
142
+ editViewPayload = _ref4.editViewPayload,
143
+ shouldActivateEditView = _ref4.shouldActivateEditView,
144
+ enableEditView = _ref4.enableEditView;
145
+ return jsx(FormContextProvider, {
146
+ enableEditView: pluginsProvider !== null && pluginsProvider !== void 0 && (_pluginsProvider$acti = pluginsProvider.activePlugin) !== null && _pluginsProvider$acti !== void 0 && _pluginsProvider$acti.editView && props !== null && props !== void 0 && props.onComplete ? enableEditView : undefined
147
+ }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
148
+ active: props.active && !editViewPayload,
149
+ onCreate: /*#__PURE__*/function () {
150
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(payload) {
151
+ var _props$onCreate;
152
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
153
+ while (1) switch (_context2.prev = _context2.next) {
154
+ case 0:
155
+ _context2.next = 2;
156
+ return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
157
+ case 2:
158
+ // if onComplete exists then there is an edit flow
159
+ if (props.onComplete) {
160
+ if (shouldActivateEditView()) {
161
+ //edit button is pressed
162
+ setEditViewPayload(payload);
163
+ } else {
164
+ //create button is pressed
165
+ props.onComplete();
170
166
  }
171
- case 3:
172
- case "end":
173
- return _context2.stop();
174
- }
175
- }, _callee2);
176
- }));
177
- return function (_x2) {
178
- return _ref5.apply(this, arguments);
179
- };
180
- }(),
181
- onCloseComplete: function onCloseComplete() {
182
- if (shouldCallCloseComplete.current) {
183
- var _props$onCloseComplet;
184
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
185
- args[_key] = arguments[_key];
167
+ }
168
+ case 3:
169
+ case "end":
170
+ return _context2.stop();
186
171
  }
187
- (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
172
+ }, _callee2);
173
+ }));
174
+ return function (_x2) {
175
+ return _ref5.apply(this, arguments);
176
+ };
177
+ }(),
178
+ onCloseComplete: function onCloseComplete() {
179
+ if (shouldCallCloseComplete.current) {
180
+ var _props$onCloseComplet;
181
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
182
+ args[_key] = arguments[_key];
188
183
  }
184
+ (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
189
185
  }
190
- }))));
191
- });
186
+ }
187
+ }))));
192
188
  });
193
- }
194
- return jsx(FormContextProvider, null, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
195
- onCreate: /*#__PURE__*/function () {
196
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(payload) {
197
- var _props$onCreate2, _props$onComplete;
198
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
199
- while (1) switch (_context3.prev = _context3.next) {
200
- case 0:
201
- _context3.next = 2;
202
- return (_props$onCreate2 = props.onCreate) === null || _props$onCreate2 === void 0 ? void 0 : _props$onCreate2.call(props, payload);
203
- case 2:
204
- (_props$onComplete = props.onComplete) === null || _props$onComplete === void 0 || _props$onComplete.call(props);
205
- case 3:
206
- case "end":
207
- return _context3.stop();
208
- }
209
- }, _callee3);
210
- }));
211
- return function (_x3) {
212
- return _ref6.apply(this, arguments);
213
- };
214
- }()
215
- }))));
189
+ });
216
190
  };
217
191
  export default LinkCreateModal;
@@ -23,7 +23,7 @@ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__
23
23
  }));
24
24
  export var PACKAGE_DATA = {
25
25
  packageName: "@atlaskit/link-create" || '',
26
- packageVersion: "1.11.6" || '',
26
+ packageVersion: "1.12.0" || '',
27
27
  component: COMPONENT_NAME,
28
28
  componentName: COMPONENT_NAME
29
29
  };
@@ -1,8 +1,8 @@
1
+ /** @jsx jsx */
1
2
  import { jsx } from '@emotion/react';
2
3
  export interface CreateFormFooterProps {
3
4
  formErrorMessage: string | undefined;
4
5
  handleCancel: () => void;
5
- submitting: boolean;
6
6
  testId?: string;
7
7
  }
8
8
  /**
@@ -10,4 +10,4 @@ export interface CreateFormFooterProps {
10
10
  * and form error messages. This component is unmounted if
11
11
  * hideFooter is true in the Create Form.
12
12
  */
13
- export declare function CreateFormFooter({ formErrorMessage, handleCancel, submitting, testId, }: CreateFormFooterProps): jsx.JSX.Element;
13
+ export declare function CreateFormFooter({ formErrorMessage, handleCancel, testId, }: CreateFormFooterProps): jsx.JSX.Element;
@@ -1,8 +1,8 @@
1
+ /** @jsx jsx */
1
2
  import { jsx } from '@emotion/react';
2
3
  export interface CreateFormFooterProps {
3
4
  formErrorMessage: string | undefined;
4
5
  handleCancel: () => void;
5
- submitting: boolean;
6
6
  testId?: string;
7
7
  }
8
8
  /**
@@ -10,4 +10,4 @@ export interface CreateFormFooterProps {
10
10
  * and form error messages. This component is unmounted if
11
11
  * hideFooter is true in the Create Form.
12
12
  */
13
- export declare function CreateFormFooter({ formErrorMessage, handleCancel, submitting, testId, }: CreateFormFooterProps): jsx.JSX.Element;
13
+ export declare function CreateFormFooter({ formErrorMessage, handleCancel, testId, }: CreateFormFooterProps): jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "1.11.6",
3
+ "version": "1.12.0",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@atlaskit/analytics-next": "^9.1.0",
41
- "@atlaskit/button": "^17.0.0",
41
+ "@atlaskit/button": "^17.1.0",
42
42
  "@atlaskit/empty-state": "^7.6.0",
43
43
  "@atlaskit/form": "^9.0.3",
44
44
  "@atlaskit/icon": "^22.0.0",
@@ -117,9 +117,6 @@
117
117
  },
118
118
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
119
119
  "platform-feature-flags": {
120
- "platform.linking-platform.link-create.enable-edit": {
121
- "type": "boolean"
122
- },
123
120
  "platform.linking-platform.link-create.enable-sentry-client": {
124
121
  "type": "boolean"
125
122
  },