@atlaskit/link-create 1.1.1 → 1.2.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +52 -40
  2. package/dist/cjs/common/constants.js +6 -9
  3. package/dist/cjs/common/utils/analytics/analytics.codegen.js +1 -2
  4. package/dist/cjs/common/utils/analytics/context.js +1 -2
  5. package/dist/cjs/common/utils/form/index.js +2 -3
  6. package/dist/cjs/common/utils/locale/fetch-messages-for-locale.js +2 -3
  7. package/dist/cjs/controllers/callback-context/main.js +3 -5
  8. package/dist/cjs/controllers/form-context/main.js +11 -12
  9. package/dist/cjs/i18n/cs.js +2 -3
  10. package/dist/cjs/i18n/da.js +2 -3
  11. package/dist/cjs/i18n/de.js +2 -3
  12. package/dist/cjs/i18n/en.js +2 -3
  13. package/dist/cjs/i18n/en_GB.js +2 -3
  14. package/dist/cjs/i18n/en_ZZ.js +2 -3
  15. package/dist/cjs/i18n/es.js +2 -3
  16. package/dist/cjs/i18n/fi.js +2 -3
  17. package/dist/cjs/i18n/fr.js +2 -3
  18. package/dist/cjs/i18n/hu.js +2 -3
  19. package/dist/cjs/i18n/it.js +2 -3
  20. package/dist/cjs/i18n/ja.js +2 -3
  21. package/dist/cjs/i18n/ko.js +2 -3
  22. package/dist/cjs/i18n/nb.js +2 -3
  23. package/dist/cjs/i18n/nl.js +2 -3
  24. package/dist/cjs/i18n/pl.js +2 -3
  25. package/dist/cjs/i18n/pt_BR.js +2 -3
  26. package/dist/cjs/i18n/ru.js +2 -3
  27. package/dist/cjs/i18n/sv.js +2 -3
  28. package/dist/cjs/i18n/th.js +2 -3
  29. package/dist/cjs/i18n/tr.js +2 -3
  30. package/dist/cjs/i18n/uk.js +2 -3
  31. package/dist/cjs/i18n/vi.js +2 -3
  32. package/dist/cjs/i18n/zh.js +2 -3
  33. package/dist/cjs/i18n/zh_TW.js +2 -3
  34. package/dist/cjs/ui/create-form/async-select/main.js +1 -2
  35. package/dist/cjs/ui/create-form/form-footer/edit-button/index.js +52 -0
  36. package/dist/cjs/ui/create-form/form-footer/edit-button/messages.js +14 -0
  37. package/dist/cjs/ui/create-form/form-footer/main.js +12 -8
  38. package/dist/cjs/ui/create-form/form-footer/messages.js +2 -3
  39. package/dist/cjs/ui/create-form/form-footer/submit-button/index.js +43 -0
  40. package/dist/cjs/ui/create-form/form-spy/index.js +2 -3
  41. package/dist/cjs/ui/create-form/main.js +3 -5
  42. package/dist/cjs/ui/create-form/select/main.js +1 -2
  43. package/dist/cjs/ui/create-form/textfield/main.js +2 -2
  44. package/dist/cjs/ui/link-create/error-boundary/error-boundary-base/index.js +2 -3
  45. package/dist/cjs/ui/link-create/error-boundary/error-boundary-ui/error-svg/index.js +1 -2
  46. package/dist/cjs/ui/link-create/error-boundary/error-boundary-ui/index.js +3 -5
  47. package/dist/cjs/ui/link-create/error-boundary/error-boundary-ui/messages.js +2 -3
  48. package/dist/cjs/ui/link-create/error-boundary/index.js +4 -5
  49. package/dist/cjs/ui/link-create/main.js +2 -4
  50. package/dist/cjs/ui/link-create/messages.js +2 -3
  51. package/dist/cjs/ui/link-create/track-mount/index.js +1 -2
  52. package/dist/cjs/ui/main.js +4 -6
  53. package/dist/es2019/common/constants.js +2 -1
  54. package/dist/es2019/controllers/form-context/main.js +5 -2
  55. package/dist/es2019/ui/create-form/form-footer/edit-button/index.js +46 -0
  56. package/dist/es2019/ui/create-form/form-footer/edit-button/messages.js +8 -0
  57. package/dist/es2019/ui/create-form/form-footer/main.js +5 -1
  58. package/dist/es2019/ui/create-form/form-footer/submit-button/index.js +35 -0
  59. package/dist/es2019/ui/main.js +2 -2
  60. package/dist/esm/common/constants.js +2 -1
  61. package/dist/esm/controllers/form-context/main.js +6 -3
  62. package/dist/esm/ui/create-form/form-footer/edit-button/index.js +44 -0
  63. package/dist/esm/ui/create-form/form-footer/edit-button/messages.js +8 -0
  64. package/dist/esm/ui/create-form/form-footer/main.js +5 -1
  65. package/dist/esm/ui/create-form/form-footer/submit-button/index.js +34 -0
  66. package/dist/esm/ui/link-create/error-boundary/index.js +2 -2
  67. package/dist/esm/ui/main.js +2 -2
  68. package/dist/types/common/constants.d.ts +1 -0
  69. package/dist/types/controllers/form-context/main.d.ts +9 -1
  70. package/dist/types/ui/create-form/form-footer/edit-button/index.d.ts +2 -0
  71. package/dist/types/ui/create-form/form-footer/edit-button/messages.d.ts +7 -0
  72. package/dist/types/ui/create-form/form-footer/main.d.ts +0 -1
  73. package/dist/types/ui/create-form/form-footer/submit-button/index.d.ts +2 -0
  74. package/dist/types-ts4.5/common/constants.d.ts +1 -0
  75. package/dist/types-ts4.5/controllers/form-context/main.d.ts +9 -1
  76. package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/index.d.ts +2 -0
  77. package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/messages.d.ts +7 -0
  78. package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +0 -1
  79. package/dist/types-ts4.5/ui/create-form/form-footer/submit-button/index.d.ts +2 -0
  80. package/package.json +15 -7
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Japanese
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'ページを更新してください。問題が解決しない場合は、<a>アトラシアン サポート</a>にお問い合わせください。',
17
17
  'link-create.unknown-error.heading': 'エラーが発生しました',
18
18
  'linkCreate.createForm.button.close': '閉じる',
19
19
  'linkCreate.createForm.button.create': '作成',
20
20
  'linkCreate.modal.heading': '新規作成'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Korean
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': '페이지를 새로 고치거나 문제가 계속 발생하는 경우 <a>Atlassian 고객 지원 팀</a>에 문의하세요.',
17
17
  'link-create.unknown-error.heading': '문제가 발생했습니다',
18
18
  'linkCreate.createForm.button.close': '닫기',
19
19
  'linkCreate.createForm.button.create': '만들기',
20
20
  'linkCreate.modal.heading': '새로 만들기'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Norwegian (Bokmål)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Oppdater siden, eller kontakt <a>Atlassian-støtte</a> hvis problemet vedvarer.',
17
17
  'link-create.unknown-error.heading': 'Det oppstod en feil',
18
18
  'linkCreate.createForm.button.close': 'Lukk',
19
19
  'linkCreate.createForm.button.create': 'Opprett',
20
20
  'linkCreate.modal.heading': 'Opprett ny'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Dutch (Netherlands)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Vernieuw de pagina of neem contact op met <a>Atlassian-support</a> als dit blijft gebeuren.',
17
17
  'link-create.unknown-error.heading': 'Er is iets misgegaan',
18
18
  'linkCreate.createForm.button.close': 'Sluiten',
19
19
  'linkCreate.createForm.button.create': 'Aanmaken',
20
20
  'linkCreate.modal.heading': 'Nieuwe aanmaken'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Polish (Poland)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Odśwież stronę lub skontaktuj się z <a>działem wsparcia Atlassian</a>, jeśli sytuacja będzie się powtarzać.',
17
17
  'link-create.unknown-error.heading': 'Coś poszło nie tak',
18
18
  'linkCreate.createForm.button.close': 'Zamknij',
19
19
  'linkCreate.createForm.button.create': 'Utwórz',
20
20
  'linkCreate.modal.heading': 'Utwórz nową'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Portuguese (Brazil)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Atualize a página ou fale com o <a>Suporte da Atlassian</a> se o erro persistir.',
17
17
  'link-create.unknown-error.heading': 'Algo deu errado',
18
18
  'linkCreate.createForm.button.close': 'Fechar',
19
19
  'linkCreate.createForm.button.create': 'Criar',
20
20
  'linkCreate.modal.heading': 'Criar novo'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Russian
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Обновите страницу и, если проблема возникнет снова, обратитесь в <a>поддержку Atlassian</a>.',
17
17
  'link-create.unknown-error.heading': 'Произошла ошибка',
18
18
  'linkCreate.createForm.button.close': 'Закрыть',
19
19
  'linkCreate.createForm.button.create': 'Создать',
20
20
  'linkCreate.modal.heading': 'Создание'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Swedish
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Uppdatera sidan eller kontakta <a>Atlassians support</a> om problemet kvarstår.',
17
17
  'link-create.unknown-error.heading': 'Något gick fel',
18
18
  'linkCreate.createForm.button.close': 'Stäng',
19
19
  'linkCreate.createForm.button.create': 'Skapa',
20
20
  'linkCreate.modal.heading': 'Skapa ny'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Thai (Thailand)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'รีเฟรชหน้าข้อมูล หรือติดต่อฝ่าย <a>สนับสนุน Atlassian</a> หากยังคงมีปัญหานี้เกิดขึ้น',
17
17
  'link-create.unknown-error.heading': 'เกิดข้อผิดพลาดบางอย่าง',
18
18
  'linkCreate.createForm.button.close': 'ปิด',
19
19
  'linkCreate.createForm.button.create': 'สร้าง',
20
20
  'linkCreate.modal.heading': 'สร้างใหม่'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Turkish (Turkey)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Sayfayı yenileyin veya sorun devam ederse <a>Atlassian Destek</a> ekibiyle iletişime geçin.',
17
17
  'link-create.unknown-error.heading': 'Bir hata oluştu',
18
18
  'linkCreate.createForm.button.close': 'Kapat',
19
19
  'linkCreate.createForm.button.create': 'Oluştur',
20
20
  'linkCreate.modal.heading': 'Yenisini oluşturun'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Ukrainian (Ukraine)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Якщо помилка виникатиме знову, оновіть сторінку або зверніться до <a>служби підтримки Atlassian</a>.',
17
17
  'link-create.unknown-error.heading': 'Сталася помилка',
18
18
  'linkCreate.createForm.button.close': 'Закрити',
19
19
  'linkCreate.createForm.button.create': 'Створити',
20
20
  'linkCreate.modal.heading': 'Створення'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Vietnamese (Vietnam)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': 'Làm mới trang hoặc liên hệ với <a>Bộ phận hỗ trợ Atlassian</a> nếu sự cố này vẫn tiếp diễn.',
17
17
  'link-create.unknown-error.heading': 'Đã xảy ra lỗi',
18
18
  'linkCreate.createForm.button.close': 'Đóng',
19
19
  'linkCreate.createForm.button.create': 'Tạo',
20
20
  'linkCreate.modal.heading': 'Tạo mới'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Chinese (Simplified)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': '如果此问题依然存在,请刷新页面或联系 <a>Atlassian 支持团队</a>。',
17
17
  'link-create.unknown-error.heading': '出错了',
18
18
  'linkCreate.createForm.button.close': '关闭',
19
19
  'linkCreate.createForm.button.create': '创建',
20
20
  'linkCreate.modal.heading': '新建'
21
- };
22
- exports.default = _default;
21
+ };
@@ -12,11 +12,10 @@ exports.default = void 0;
12
12
  * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
13
  */
14
14
  //Chinese (Traditional)
15
- var _default = {
15
+ var _default = exports.default = {
16
16
  'link-create.unknown-error.description': '請重新整理頁面,如果持續發生錯誤,請連絡 <a>Atlassian 支援人員</a>。',
17
17
  'link-create.unknown-error.heading': '發生錯誤',
18
18
  'linkCreate.createForm.button.close': '關閉',
19
19
  'linkCreate.createForm.button.create': '建立',
20
20
  'linkCreate.modal.heading': '新建'
21
- };
22
- exports.default = _default;
21
+ };
@@ -20,7 +20,7 @@ var _createField = require("../../../controllers/create-field");
20
20
  var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId", "defaultOption", "loadOptions"],
21
21
  _excluded2 = ["fieldId"];
22
22
  /** @jsx jsx */
23
- var TEST_ID = 'link-create-async-select';
23
+ var TEST_ID = exports.TEST_ID = 'link-create-async-select';
24
24
 
25
25
  /**
26
26
  * An async select utilising the Atlaskit AsyncSelect and CreateField.
@@ -28,7 +28,6 @@ var TEST_ID = 'link-create-async-select';
28
28
  * errors returned by the handleSubmit function passed to the form <Form> that
29
29
  * have a key matching the `name` of this field are shown below the field.
30
30
  */
31
- exports.TEST_ID = TEST_ID;
32
31
  function AsyncSelect(_ref) {
33
32
  var id = _ref.id,
34
33
  name = _ref.name,
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.EditButton = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactFinalForm = require("react-final-form");
10
+ var _reactIntlNext = require("react-intl-next");
11
+ var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
12
+ var _constants = require("../../../../common/constants");
13
+ var _formContext = require("../../../../controllers/form-context");
14
+ var _formSpy = require("../../form-spy");
15
+ var _messages = require("./messages");
16
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
17
+
18
+ var EditButton = exports.EditButton = function EditButton() {
19
+ var intl = (0, _reactIntlNext.useIntl)();
20
+ var _useFormState = (0, _reactFinalForm.useFormState)(),
21
+ submitting = _useFormState.submitting;
22
+ var _useForm = (0, _reactFinalForm.useForm)(),
23
+ submit = _useForm.submit,
24
+ mutators = _useForm.mutators;
25
+ var _useFormContext = (0, _formContext.useFormContext)(),
26
+ enableEditView = _useFormContext.enableEditView;
27
+ if (!enableEditView) {
28
+ return null;
29
+ }
30
+ return /*#__PURE__*/_react.default.createElement(_formSpy.FormSpy, null, function (_ref) {
31
+ var values = _ref.values;
32
+ return /*#__PURE__*/_react.default.createElement(_loadingButton.default, {
33
+ type: "button",
34
+ testId: "link-create-form-button-edit",
35
+ isLoading:
36
+ /**
37
+ * Should only be in a loading state if submitting is because we clicked
38
+ * the edit button
39
+ */
40
+ submitting && values[_constants.LINK_CREATE_FORM_POST_CREATE_FIELD] === true,
41
+ onClick: function onClick() {
42
+ var _mutators$setField;
43
+ /**
44
+ * Setting this field to true indicates that the edit button was clicked and that
45
+ * we have the intention of triggering the edit/post create flow
46
+ */
47
+ (_mutators$setField = mutators.setField) === null || _mutators$setField === void 0 || _mutators$setField.call(mutators, _constants.LINK_CREATE_FORM_POST_CREATE_FIELD, true);
48
+ submit();
49
+ }
50
+ }, intl.formatMessage(_messages.messages.edit));
51
+ });
52
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.messages = void 0;
7
+ var _reactIntlNext = require("react-intl-next");
8
+ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
9
+ edit: {
10
+ id: 'linkCreate.createForm.button.edit',
11
+ defaultMessage: 'Edit',
12
+ description: 'Button to edit the Create object'
13
+ }
14
+ });
@@ -6,22 +6,26 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.CreateFormFooter = CreateFormFooter;
9
- var _react = require("@emotion/react");
9
+ var _react = require("react");
10
+ var _react2 = require("@emotion/react");
10
11
  var _reactIntlNext = require("react-intl-next");
11
12
  var _button = _interopRequireWildcard(require("@atlaskit/button"));
12
13
  var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
13
14
  var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/error"));
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
+ var _editButton = require("./edit-button");
14
17
  var _messages = require("./messages");
18
+ var _submitButton = require("./submit-button");
15
19
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
21
  /** @jsx jsx */
18
22
 
19
- var formFooterWrapperStyles = (0, _react.css)({
23
+ var formFooterWrapperStyles = (0, _react2.css)({
20
24
  display: 'flex',
21
25
  marginTop: "var(--ds-space-300, 24px)",
22
26
  justifyContent: 'flex-end'
23
27
  });
24
- var errorStyles = (0, _react.css)({
28
+ var errorStyles = (0, _react2.css)({
25
29
  display: 'flex',
26
30
  alignItems: 'center',
27
31
  marginRight: 'auto'
@@ -37,21 +41,21 @@ function CreateFormFooter(_ref) {
37
41
  submitting = _ref.submitting,
38
42
  testId = _ref.testId;
39
43
  var intl = (0, _reactIntlNext.useIntl)();
40
- return (0, _react.jsx)("footer", {
44
+ return (0, _react2.jsx)("footer", {
41
45
  "data-testid": "".concat(testId, "-footer"),
42
46
  css: formFooterWrapperStyles
43
- }, formErrorMessage && (0, _react.jsx)("div", {
47
+ }, formErrorMessage && (0, _react2.jsx)("div", {
44
48
  css: errorStyles,
45
49
  "data-testid": "".concat(testId, "-error")
46
- }, (0, _react.jsx)(_error.default, {
50
+ }, (0, _react2.jsx)(_error.default, {
47
51
  label: formErrorMessage,
48
52
  primaryColor: "var(--ds-icon-danger, #E34935)"
49
- }), formErrorMessage), (0, _react.jsx)(_button.ButtonGroup, null, (0, _react.jsx)(_button.default, {
53
+ }), formErrorMessage), (0, _react2.jsx)(_button.ButtonGroup, null, (0, _react2.jsx)(_button.default, {
50
54
  type: "button",
51
55
  appearance: "subtle",
52
56
  onClick: handleCancel,
53
57
  testId: "".concat(testId, "-button-cancel")
54
- }, intl.formatMessage(_messages.messages.close)), (0, _react.jsx)(_loadingButton.default, {
58
+ }, 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, {
55
59
  type: "submit",
56
60
  appearance: "primary",
57
61
  isLoading: submitting,
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.messages = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
- var messages = (0, _reactIntlNext.defineMessages)({
8
+ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
9
9
  close: {
10
10
  id: 'linkCreate.createForm.button.close',
11
11
  defaultMessage: 'Close',
@@ -16,5 +16,4 @@ var messages = (0, _reactIntlNext.defineMessages)({
16
16
  defaultMessage: 'Create',
17
17
  description: 'Button to submit the form and Create object'
18
18
  }
19
- });
20
- exports.messages = messages;
19
+ });
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SubmitButton = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactFinalForm = require("react-final-form");
10
+ var _reactIntlNext = require("react-intl-next");
11
+ var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
12
+ var _constants = require("../../../../common/constants");
13
+ var _formSpy = require("../../form-spy");
14
+ var _messages = require("../messages");
15
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
16
+
17
+ // eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
18
+
19
+ var SubmitButton = exports.SubmitButton = function SubmitButton() {
20
+ var intl = (0, _reactIntlNext.useIntl)();
21
+ var _useFormState = (0, _reactFinalForm.useFormState)(),
22
+ submitting = _useFormState.submitting;
23
+ var _useForm = (0, _reactFinalForm.useForm)(),
24
+ mutators = _useForm.mutators;
25
+ return /*#__PURE__*/_react.default.createElement(_formSpy.FormSpy, null, function (_ref) {
26
+ var values = _ref.values;
27
+ return /*#__PURE__*/_react.default.createElement(_loadingButton.default, {
28
+ type: "submit",
29
+ appearance: "primary",
30
+ isLoading:
31
+ /**
32
+ * Should only be in a loading state if submitting is because we clicked
33
+ * the edit button
34
+ */
35
+ submitting && values[_constants.LINK_CREATE_FORM_POST_CREATE_FIELD] === false,
36
+ testId: "link-create-form-button-submit",
37
+ onClick: function onClick() {
38
+ var _mutators$setField;
39
+ (_mutators$setField = mutators.setField) === null || _mutators$setField === void 0 || _mutators$setField.call(mutators, _constants.LINK_CREATE_FORM_POST_CREATE_FIELD, false);
40
+ }
41
+ }, intl.formatMessage(_messages.messages.create));
42
+ });
43
+ };
@@ -12,7 +12,7 @@ var _reactFinalForm = require("react-final-form");
12
12
  * FormSpy component so that we can control selectively
13
13
  * how much of the API we are commited to.
14
14
  */
15
- var FormSpy = function FormSpy(_ref) {
15
+ var FormSpy = exports.FormSpy = function FormSpy(_ref) {
16
16
  var children = _ref.children;
17
17
  return /*#__PURE__*/_react.default.createElement(_reactFinalForm.FormSpy, {
18
18
  subscription: {
@@ -23,5 +23,4 @@ var FormSpy = function FormSpy(_ref) {
23
23
  values: props.values
24
24
  });
25
25
  });
26
- };
27
- exports.FormSpy = FormSpy;
26
+ };
@@ -25,9 +25,8 @@ var formStyles = (0, _react2.css)({
25
25
  padding: "0 0 ".concat("var(--ds-space-300, 24px)", " 0"),
26
26
  margin: "var(--ds-space-0, 0px)".concat(" auto")
27
27
  });
28
- var TEST_ID = 'link-create-form';
29
- exports.TEST_ID = TEST_ID;
30
- var CreateForm = function CreateForm(_ref) {
28
+ var TEST_ID = exports.TEST_ID = 'link-create-form';
29
+ var CreateForm = exports.CreateForm = function CreateForm(_ref) {
31
30
  var children = _ref.children,
32
31
  _ref$testId = _ref.testId,
33
32
  testId = _ref$testId === void 0 ? TEST_ID : _ref$testId,
@@ -102,5 +101,4 @@ var CreateForm = function CreateForm(_ref) {
102
101
  testId: testId
103
102
  }));
104
103
  });
105
- };
106
- exports.CreateForm = CreateForm;
104
+ };
@@ -14,14 +14,13 @@ var _createField = require("../../../controllers/create-field");
14
14
  var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId"],
15
15
  _excluded2 = ["fieldId"];
16
16
  /** @jsx jsx */
17
- var TEST_ID = 'link-create-select';
17
+ var TEST_ID = exports.TEST_ID = 'link-create-select';
18
18
  /**
19
19
  * A select component utilising the Atlaskit Select and CreateField.
20
20
  * Validation is handled by the form on form submission. Any
21
21
  * errors returned by the handleSubmit function passed to the form <Form> that
22
22
  * have a key matching the `name` of this field are shown below the field.
23
23
  */
24
- exports.TEST_ID = TEST_ID;
25
24
  function Select(_ref) {
26
25
  var id = _ref.id,
27
26
  name = _ref.name,
@@ -14,7 +14,7 @@ var _createField = require("../../../controllers/create-field");
14
14
  var _excluded = ["id", "name", "label", "isRequired", "validators", "validationHelpText", "testId"],
15
15
  _excluded2 = ["fieldId"];
16
16
  /** @jsx jsx */
17
- var TEST_ID = 'link-create-text-field';
17
+ var TEST_ID = exports.TEST_ID = 'link-create-text-field';
18
18
 
19
19
  /**
20
20
  * A text field utilising the Atlaskit Textfield and CreateField.
@@ -22,7 +22,7 @@ var TEST_ID = 'link-create-text-field';
22
22
  * the handleSubmit function passed to the form <Form> that have a key matching the `name`
23
23
  * of this text field are shown above the field.
24
24
  */
25
- exports.TEST_ID = TEST_ID;
25
+
26
26
  function TextField(_ref) {
27
27
  var id = _ref.id,
28
28
  name = _ref.name,
@@ -17,7 +17,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
17
17
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
18
18
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
19
  // eslint-disable-next-line @repo/internal/react/no-class-components
20
- var BaseErrorBoundary = /*#__PURE__*/function (_Component) {
20
+ var BaseErrorBoundary = exports.BaseErrorBoundary = /*#__PURE__*/function (_Component) {
21
21
  (0, _inherits2.default)(BaseErrorBoundary, _Component);
22
22
  var _super = _createSuper(BaseErrorBoundary);
23
23
  function BaseErrorBoundary(props) {
@@ -52,5 +52,4 @@ var BaseErrorBoundary = /*#__PURE__*/function (_Component) {
52
52
  }
53
53
  }]);
54
54
  return BaseErrorBoundary;
55
- }(_react.Component);
56
- exports.BaseErrorBoundary = BaseErrorBoundary;
55
+ }(_react.Component);
@@ -60,5 +60,4 @@ var ErrorSVG = function ErrorSVG() {
60
60
  stopOpacity: ".6"
61
61
  }))));
62
62
  };
63
- var _default = ErrorSVG;
64
- exports.default = _default;
63
+ var _default = exports.default = ErrorSVG;
@@ -12,9 +12,8 @@ var _button = _interopRequireDefault(require("@atlaskit/button"));
12
12
  var _emptyState = _interopRequireDefault(require("@atlaskit/empty-state"));
13
13
  var _errorSvg = _interopRequireDefault(require("./error-svg"));
14
14
  var _messages = _interopRequireDefault(require("./messages"));
15
- var CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
16
- exports.CONTACT_SUPPORT_LINK = CONTACT_SUPPORT_LINK;
17
- var ErrorBoundaryUI = function ErrorBoundaryUI() {
15
+ var CONTACT_SUPPORT_LINK = exports.CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
16
+ var ErrorBoundaryUI = exports.ErrorBoundaryUI = function ErrorBoundaryUI() {
18
17
  var intl = (0, _reactIntlNext.useIntl)();
19
18
  return /*#__PURE__*/_react.default.createElement(_emptyState.default, {
20
19
  maxImageWidth: 82,
@@ -37,5 +36,4 @@ var ErrorBoundaryUI = function ErrorBoundaryUI() {
37
36
  return /*#__PURE__*/_react.default.createElement(_errorSvg.default, null);
38
37
  }
39
38
  });
40
- };
41
- exports.ErrorBoundaryUI = ErrorBoundaryUI;
39
+ };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
- var _default = (0, _reactIntlNext.defineMessages)({
8
+ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
9
9
  heading: {
10
10
  id: 'link-create.unknown-error.heading',
11
11
  defaultMessage: 'Something went wrong',
@@ -16,5 +16,4 @@ var _default = (0, _reactIntlNext.defineMessages)({
16
16
  defaultMessage: 'Refresh the page, or contact <a>Atlassian Support</a> if this keeps happening.',
17
17
  description: 'Description when an unknown error occurs'
18
18
  }
19
- });
20
- exports.default = _default;
19
+ });
@@ -14,15 +14,15 @@ var _errorBoundaryBase = require("./error-boundary-base");
14
14
  var _errorBoundaryUi = require("./error-boundary-ui");
15
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
- var ErrorBoundary = function ErrorBoundary(_ref) {
17
+ var ErrorBoundary = exports.ErrorBoundary = function ErrorBoundary(_ref) {
18
18
  var children = _ref.children;
19
19
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
20
20
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
21
21
  var handleError = (0, _react.useCallback)(function (error, info) {
22
- var _window, _window$navigator, _info$componentStack;
22
+ var _window, _info$componentStack;
23
23
  // Fire Analytics event
24
24
  createAnalyticsEvent((0, _analytics.default)('operational.linkCreate.unhandledErrorCaught', {
25
- browserInfo: ((_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent) || 'unknown',
25
+ browserInfo: ((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) || 'unknown',
26
26
  error: error.toString(),
27
27
  componentStack: (_info$componentStack = info === null || info === void 0 ? void 0 : info.componentStack) !== null && _info$componentStack !== void 0 ? _info$componentStack : ''
28
28
  })).fire(_constants.ANALYTICS_CHANNEL);
@@ -34,5 +34,4 @@ var ErrorBoundary = function ErrorBoundary(_ref) {
34
34
  onError: handleError,
35
35
  ErrorComponent: _errorBoundaryUi.ErrorBoundaryUI
36
36
  }, children);
37
- };
38
- exports.ErrorBoundary = ErrorBoundary;
37
+ };
@@ -24,8 +24,7 @@ var _excluded = ["testId", "onCreate", "onFailure", "onCancel", "triggeredFrom"]
24
24
  /** @jsx jsx */
25
25
  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); }
26
26
  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; }
27
- var TEST_ID = 'link-create';
28
- exports.TEST_ID = TEST_ID;
27
+ var TEST_ID = exports.TEST_ID = 'link-create';
29
28
  var LinkCreateContent = function LinkCreateContent(_ref) {
30
29
  var plugins = _ref.plugins,
31
30
  entityKey = _ref.entityKey;
@@ -99,5 +98,4 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref4) {
99
98
  width: "".concat(_constants.CREATE_FORM_MAX_WIDTH_IN_PX, "px")
100
99
  }, (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, createProps))));
101
100
  };
102
- var _default = LinkCreateWithModal;
103
- exports.default = _default;
101
+ var _default = exports.default = LinkCreateWithModal;
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.messages = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
- var messages = (0, _reactIntlNext.defineMessages)({
8
+ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
9
9
  heading: {
10
10
  id: 'linkCreate.modal.heading',
11
11
  defaultMessage: 'Create new',
12
12
  description: 'Header for the create modal'
13
13
  }
14
- });
15
- exports.messages = messages;
14
+ });
@@ -27,5 +27,4 @@ function TrackMount() {
27
27
  }, [createAnalyticsEvent]);
28
28
  return null;
29
29
  }
30
- var _default = TrackMount;
31
- exports.default = _default;
30
+ var _default = exports.default = TrackMount;