@atlaskit/link-create 2.13.20 → 2.15.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 (235) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/common/constants.js +4 -1
  3. package/dist/cjs/common/ui/error-boundary-modal/index.js +13 -10
  4. package/dist/cjs/common/ui/error-boundary-modal/old/index.js +34 -0
  5. package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
  6. package/dist/cjs/common/ui/error-boundary-ui/error-svg/index.js +32 -25
  7. package/dist/cjs/common/ui/error-boundary-ui/error-svg/old/index.js +67 -0
  8. package/dist/cjs/common/ui/icon/index.compiled.css +7 -0
  9. package/dist/cjs/common/ui/icon/index.js +25 -20
  10. package/dist/cjs/common/ui/icon/old/index.js +26 -0
  11. package/dist/cjs/common/ui/message/index.compiled.css +11 -0
  12. package/dist/cjs/common/ui/message/index.js +33 -40
  13. package/dist/cjs/common/ui/message/old/index.js +81 -0
  14. package/dist/cjs/common/ui/modal-hero/index.js +11 -3
  15. package/dist/cjs/common/ui/modal-hero/old/index.js +27 -0
  16. package/dist/cjs/controllers/create-field/main.compiled.css +1 -0
  17. package/dist/cjs/controllers/create-field/main.js +30 -21
  18. package/dist/cjs/controllers/create-field/old/main.js +76 -0
  19. package/dist/cjs/ui/create-form/async-select/main.js +15 -10
  20. package/dist/cjs/ui/create-form/async-select/old/main.js +195 -0
  21. package/dist/cjs/ui/create-form/form-footer/main.compiled.css +5 -0
  22. package/dist/cjs/ui/create-form/form-footer/main.js +28 -28
  23. package/dist/cjs/ui/create-form/form-footer/old/main.js +64 -0
  24. package/dist/cjs/ui/create-form/form-loader/main.compiled.css +4 -0
  25. package/dist/cjs/ui/create-form/form-loader/main.js +22 -21
  26. package/dist/cjs/ui/create-form/form-loader/old/main.js +39 -0
  27. package/dist/cjs/ui/create-form/main.compiled.css +9 -0
  28. package/dist/cjs/ui/create-form/main.js +26 -21
  29. package/dist/cjs/ui/create-form/old/main.js +177 -0
  30. package/dist/cjs/ui/create-form/select/main.js +41 -20
  31. package/dist/cjs/ui/create-form/select/old/main.js +127 -0
  32. package/dist/cjs/ui/create-form/textfield/main.js +14 -13
  33. package/dist/cjs/ui/create-form/textfield/old/main.js +55 -0
  34. package/dist/cjs/ui/create-form/user-picker/main.js +14 -13
  35. package/dist/cjs/ui/create-form/user-picker/old/main.js +72 -0
  36. package/dist/cjs/ui/inline-create/index.js +17 -14
  37. package/dist/cjs/ui/inline-create/main.js +21 -19
  38. package/dist/cjs/ui/inline-create/old/index.js +38 -0
  39. package/dist/cjs/ui/inline-create/old/main.js +120 -0
  40. package/dist/cjs/ui/modal-create/index.js +19 -16
  41. package/dist/cjs/ui/modal-create/main.js +26 -23
  42. package/dist/cjs/ui/modal-create/old/index.js +44 -0
  43. package/dist/cjs/ui/modal-create/old/main.js +164 -0
  44. package/dist/es2019/common/constants.js +4 -1
  45. package/dist/es2019/common/ui/error-boundary-modal/index.js +12 -9
  46. package/dist/es2019/common/ui/error-boundary-modal/old/index.js +26 -0
  47. package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
  48. package/dist/es2019/common/ui/error-boundary-ui/error-svg/index.js +24 -23
  49. package/dist/es2019/common/ui/error-boundary-ui/error-svg/old/index.js +58 -0
  50. package/dist/es2019/common/ui/icon/index.compiled.css +7 -0
  51. package/dist/es2019/common/ui/icon/index.js +23 -18
  52. package/dist/es2019/common/ui/icon/old/index.js +18 -0
  53. package/dist/es2019/common/ui/message/index.compiled.css +11 -0
  54. package/dist/es2019/common/ui/message/index.js +30 -39
  55. package/dist/es2019/common/ui/message/old/index.js +74 -0
  56. package/dist/es2019/common/ui/modal-hero/index.js +10 -2
  57. package/dist/es2019/common/ui/modal-hero/old/index.js +19 -0
  58. package/dist/es2019/controllers/create-field/main.compiled.css +1 -0
  59. package/dist/es2019/controllers/create-field/main.js +26 -23
  60. package/dist/es2019/controllers/create-field/old/main.js +74 -0
  61. package/dist/es2019/ui/create-form/async-select/main.js +12 -11
  62. package/dist/es2019/ui/create-form/async-select/old/main.js +137 -0
  63. package/dist/es2019/ui/create-form/form-footer/main.compiled.css +5 -0
  64. package/dist/es2019/ui/create-form/form-footer/main.js +25 -27
  65. package/dist/es2019/ui/create-form/form-footer/old/main.js +57 -0
  66. package/dist/es2019/ui/create-form/form-loader/main.compiled.css +4 -0
  67. package/dist/es2019/ui/create-form/form-loader/main.js +19 -20
  68. package/dist/es2019/ui/create-form/form-loader/old/main.js +31 -0
  69. package/dist/es2019/ui/create-form/main.compiled.css +9 -0
  70. package/dist/es2019/ui/create-form/main.js +23 -23
  71. package/dist/es2019/ui/create-form/old/main.js +145 -0
  72. package/dist/es2019/ui/create-form/select/main.js +42 -22
  73. package/dist/es2019/ui/create-form/select/old/main.js +106 -0
  74. package/dist/es2019/ui/create-form/textfield/main.js +14 -12
  75. package/dist/es2019/ui/create-form/textfield/old/main.js +45 -0
  76. package/dist/es2019/ui/create-form/user-picker/main.js +14 -12
  77. package/dist/es2019/ui/create-form/user-picker/old/main.js +59 -0
  78. package/dist/es2019/ui/inline-create/index.js +14 -13
  79. package/dist/es2019/ui/inline-create/main.js +21 -18
  80. package/dist/es2019/ui/inline-create/old/index.js +30 -0
  81. package/dist/es2019/ui/inline-create/old/main.js +96 -0
  82. package/dist/es2019/ui/modal-create/index.js +16 -15
  83. package/dist/es2019/ui/modal-create/main.js +23 -22
  84. package/dist/es2019/ui/modal-create/old/index.js +36 -0
  85. package/dist/es2019/ui/modal-create/old/main.js +137 -0
  86. package/dist/esm/common/constants.js +4 -1
  87. package/dist/esm/common/ui/error-boundary-modal/index.js +12 -9
  88. package/dist/esm/common/ui/error-boundary-modal/old/index.js +25 -0
  89. package/dist/esm/common/ui/error-boundary-ui/error-svg/index.compiled.css +6 -0
  90. package/dist/esm/common/ui/error-boundary-ui/error-svg/index.js +28 -24
  91. package/dist/esm/common/ui/error-boundary-ui/error-svg/old/index.js +60 -0
  92. package/dist/esm/common/ui/icon/index.compiled.css +7 -0
  93. package/dist/esm/common/ui/icon/index.js +23 -18
  94. package/dist/esm/common/ui/icon/old/index.js +18 -0
  95. package/dist/esm/common/ui/message/index.compiled.css +11 -0
  96. package/dist/esm/common/ui/message/index.js +30 -39
  97. package/dist/esm/common/ui/message/old/index.js +73 -0
  98. package/dist/esm/common/ui/modal-hero/index.js +10 -2
  99. package/dist/esm/common/ui/modal-hero/old/index.js +18 -0
  100. package/dist/esm/controllers/create-field/main.compiled.css +1 -0
  101. package/dist/esm/controllers/create-field/main.js +25 -22
  102. package/dist/esm/controllers/create-field/old/main.js +72 -0
  103. package/dist/esm/ui/create-form/async-select/main.js +12 -11
  104. package/dist/esm/ui/create-form/async-select/old/main.js +188 -0
  105. package/dist/esm/ui/create-form/form-footer/main.compiled.css +5 -0
  106. package/dist/esm/ui/create-form/form-footer/main.js +24 -26
  107. package/dist/esm/ui/create-form/form-footer/old/main.js +56 -0
  108. package/dist/esm/ui/create-form/form-loader/main.compiled.css +4 -0
  109. package/dist/esm/ui/create-form/form-loader/main.js +18 -19
  110. package/dist/esm/ui/create-form/form-loader/old/main.js +31 -0
  111. package/dist/esm/ui/create-form/main.compiled.css +9 -0
  112. package/dist/esm/ui/create-form/main.js +23 -23
  113. package/dist/esm/ui/create-form/old/main.js +174 -0
  114. package/dist/esm/ui/create-form/select/main.js +41 -21
  115. package/dist/esm/ui/create-form/select/old/main.js +117 -0
  116. package/dist/esm/ui/create-form/textfield/main.js +13 -11
  117. package/dist/esm/ui/create-form/textfield/old/main.js +47 -0
  118. package/dist/esm/ui/create-form/user-picker/main.js +13 -11
  119. package/dist/esm/ui/create-form/user-picker/old/main.js +64 -0
  120. package/dist/esm/ui/inline-create/index.js +14 -13
  121. package/dist/esm/ui/inline-create/main.js +21 -18
  122. package/dist/esm/ui/inline-create/old/index.js +30 -0
  123. package/dist/esm/ui/inline-create/old/main.js +112 -0
  124. package/dist/esm/ui/modal-create/index.js +16 -15
  125. package/dist/esm/ui/modal-create/main.js +23 -22
  126. package/dist/esm/ui/modal-create/old/index.js +36 -0
  127. package/dist/esm/ui/modal-create/old/main.js +156 -0
  128. package/dist/types/common/constants.d.ts +3 -0
  129. package/dist/types/common/ui/Button/index.d.ts +8 -3
  130. package/dist/types/common/ui/ModalDialog/index.d.ts +1 -1
  131. package/dist/types/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
  132. package/dist/types/common/ui/edit-modal/index.d.ts +1 -1
  133. package/dist/types/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
  134. package/dist/types/common/ui/error-boundary/index.d.ts +2 -2
  135. package/dist/types/common/ui/error-boundary-modal/index.d.ts +2 -2
  136. package/dist/types/common/ui/error-boundary-modal/old/index.d.ts +11 -0
  137. package/dist/types/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
  138. package/dist/types/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
  139. package/dist/types/common/ui/error-boundary-ui/index.d.ts +2 -2
  140. package/dist/types/common/ui/experience-tracker/index.d.ts +1 -1
  141. package/dist/types/common/ui/icon/index.d.ts +10 -6
  142. package/dist/types/common/ui/icon/old/index.d.ts +7 -0
  143. package/dist/types/common/ui/link-create-content/index.d.ts +2 -2
  144. package/dist/types/common/ui/message/index.d.ts +1 -2
  145. package/dist/types/common/ui/message/old/index.d.ts +15 -0
  146. package/dist/types/common/ui/modal-hero/index.d.ts +4 -2
  147. package/dist/types/common/ui/modal-hero/old/index.d.ts +4 -0
  148. package/dist/types/controllers/callback-context/main.d.ts +2 -2
  149. package/dist/types/controllers/create-field/main.d.ts +2 -2
  150. package/dist/types/controllers/create-field/old/main.d.ts +7 -0
  151. package/dist/types/controllers/edit-post-create-context/index.d.ts +1 -1
  152. package/dist/types/controllers/exit-warning-modal-context/index.d.ts +1 -1
  153. package/dist/types/controllers/form-context/main.d.ts +2 -2
  154. package/dist/types/controllers/plugin-context/index.d.ts +1 -1
  155. package/dist/types/ui/create-form/async-select/main.d.ts +2 -8
  156. package/dist/types/ui/create-form/async-select/old/main.d.ts +11 -0
  157. package/dist/types/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
  158. package/dist/types/ui/create-form/form-footer/main.d.ts +2 -11
  159. package/dist/types/ui/create-form/form-footer/old/main.d.ts +16 -0
  160. package/dist/types/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
  161. package/dist/types/ui/create-form/form-loader/main.d.ts +2 -10
  162. package/dist/types/ui/create-form/form-loader/old/main.d.ts +11 -0
  163. package/dist/types/ui/create-form/form-spy/index.d.ts +1 -1
  164. package/dist/types/ui/create-form/main.d.ts +1 -2
  165. package/dist/types/ui/create-form/old/main.d.ts +54 -0
  166. package/dist/types/ui/create-form/select/main.d.ts +5 -16
  167. package/dist/types/ui/create-form/select/old/main.d.ts +24 -0
  168. package/dist/types/ui/create-form/textfield/main.d.ts +2 -12
  169. package/dist/types/ui/create-form/textfield/old/main.d.ts +14 -0
  170. package/dist/types/ui/create-form/user-picker/main.d.ts +2 -9
  171. package/dist/types/ui/create-form/user-picker/old/main.d.ts +11 -0
  172. package/dist/types/ui/inline-create/index.d.ts +2 -3
  173. package/dist/types/ui/inline-create/inline-analytics/index.d.ts +2 -2
  174. package/dist/types/ui/inline-create/main.d.ts +2 -6
  175. package/dist/types/ui/inline-create/old/index.d.ts +5 -0
  176. package/dist/types/ui/inline-create/old/main.d.ts +8 -0
  177. package/dist/types/ui/modal-create/index.d.ts +2 -3
  178. package/dist/types/ui/modal-create/main.d.ts +2 -2
  179. package/dist/types/ui/modal-create/old/index.d.ts +5 -0
  180. package/dist/types/ui/modal-create/old/main.d.ts +4 -0
  181. package/dist/types-ts4.5/common/constants.d.ts +3 -0
  182. package/dist/types-ts4.5/common/ui/Button/index.d.ts +8 -3
  183. package/dist/types-ts4.5/common/ui/ModalDialog/index.d.ts +1 -1
  184. package/dist/types-ts4.5/common/ui/confirm-dismiss-dialog/main.d.ts +2 -2
  185. package/dist/types-ts4.5/common/ui/edit-modal/index.d.ts +1 -1
  186. package/dist/types-ts4.5/common/ui/error-boundary/error-boundary-base/index.d.ts +1 -1
  187. package/dist/types-ts4.5/common/ui/error-boundary/index.d.ts +2 -2
  188. package/dist/types-ts4.5/common/ui/error-boundary-modal/index.d.ts +2 -2
  189. package/dist/types-ts4.5/common/ui/error-boundary-modal/old/index.d.ts +11 -0
  190. package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/index.d.ts +2 -6
  191. package/dist/types-ts4.5/common/ui/error-boundary-ui/error-svg/old/index.d.ts +7 -0
  192. package/dist/types-ts4.5/common/ui/error-boundary-ui/index.d.ts +2 -2
  193. package/dist/types-ts4.5/common/ui/experience-tracker/index.d.ts +1 -1
  194. package/dist/types-ts4.5/common/ui/icon/index.d.ts +10 -6
  195. package/dist/types-ts4.5/common/ui/icon/old/index.d.ts +7 -0
  196. package/dist/types-ts4.5/common/ui/link-create-content/index.d.ts +2 -2
  197. package/dist/types-ts4.5/common/ui/message/index.d.ts +1 -2
  198. package/dist/types-ts4.5/common/ui/message/old/index.d.ts +15 -0
  199. package/dist/types-ts4.5/common/ui/modal-hero/index.d.ts +4 -2
  200. package/dist/types-ts4.5/common/ui/modal-hero/old/index.d.ts +4 -0
  201. package/dist/types-ts4.5/controllers/callback-context/main.d.ts +2 -2
  202. package/dist/types-ts4.5/controllers/create-field/main.d.ts +2 -2
  203. package/dist/types-ts4.5/controllers/create-field/old/main.d.ts +7 -0
  204. package/dist/types-ts4.5/controllers/edit-post-create-context/index.d.ts +1 -1
  205. package/dist/types-ts4.5/controllers/exit-warning-modal-context/index.d.ts +1 -1
  206. package/dist/types-ts4.5/controllers/form-context/main.d.ts +2 -2
  207. package/dist/types-ts4.5/controllers/plugin-context/index.d.ts +1 -1
  208. package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +2 -8
  209. package/dist/types-ts4.5/ui/create-form/async-select/old/main.d.ts +11 -0
  210. package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/index.d.ts +2 -2
  211. package/dist/types-ts4.5/ui/create-form/form-footer/main.d.ts +2 -11
  212. package/dist/types-ts4.5/ui/create-form/form-footer/old/main.d.ts +16 -0
  213. package/dist/types-ts4.5/ui/create-form/form-footer/submit-button/index.d.ts +2 -2
  214. package/dist/types-ts4.5/ui/create-form/form-loader/main.d.ts +2 -10
  215. package/dist/types-ts4.5/ui/create-form/form-loader/old/main.d.ts +11 -0
  216. package/dist/types-ts4.5/ui/create-form/form-spy/index.d.ts +1 -1
  217. package/dist/types-ts4.5/ui/create-form/main.d.ts +1 -2
  218. package/dist/types-ts4.5/ui/create-form/old/main.d.ts +56 -0
  219. package/dist/types-ts4.5/ui/create-form/select/main.d.ts +5 -16
  220. package/dist/types-ts4.5/ui/create-form/select/old/main.d.ts +24 -0
  221. package/dist/types-ts4.5/ui/create-form/textfield/main.d.ts +2 -12
  222. package/dist/types-ts4.5/ui/create-form/textfield/old/main.d.ts +14 -0
  223. package/dist/types-ts4.5/ui/create-form/user-picker/main.d.ts +2 -9
  224. package/dist/types-ts4.5/ui/create-form/user-picker/old/main.d.ts +11 -0
  225. package/dist/types-ts4.5/ui/inline-create/index.d.ts +2 -3
  226. package/dist/types-ts4.5/ui/inline-create/inline-analytics/index.d.ts +2 -2
  227. package/dist/types-ts4.5/ui/inline-create/main.d.ts +2 -6
  228. package/dist/types-ts4.5/ui/inline-create/old/index.d.ts +5 -0
  229. package/dist/types-ts4.5/ui/inline-create/old/main.d.ts +8 -0
  230. package/dist/types-ts4.5/ui/modal-create/index.d.ts +2 -3
  231. package/dist/types-ts4.5/ui/modal-create/main.d.ts +2 -2
  232. package/dist/types-ts4.5/ui/modal-create/old/index.d.ts +5 -0
  233. package/dist/types-ts4.5/ui/modal-create/old/main.d.ts +4 -0
  234. package/example-helpers/mock-disclaimer.tsx +1 -1
  235. package/package.json +37 -26
@@ -1,13 +1,7 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { memo } from 'react';
6
-
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
- import { jsx } from '@emotion/react';
1
+ import React, { memo } from 'react';
9
2
  import { AnalyticsContext } from '@atlaskit/analytics-next';
10
3
  import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
11
5
  import { PACKAGE_DATA } from '../../common/constants';
12
6
  import { ErrorBoundary } from '../../common/ui/error-boundary';
13
7
  import { Experience } from '../../common/ui/experience-tracker';
@@ -15,15 +9,22 @@ import { withLinkCreateAnalyticsContext } from '../../common/utils/analytics';
15
9
  import { fetchMessagesForLocale } from '../../common/utils/locale/fetch-messages-for-locale';
16
10
  import i18nEN from '../../i18n/en';
17
11
  import InlineCreate from './main';
12
+ import ComposedLinkCreateOld from './old';
18
13
  var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (props) {
19
- return jsx(Experience, null, jsx(ErrorBoundary, null, jsx(InlineCreate, props)));
14
+ return /*#__PURE__*/React.createElement(Experience, null, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(InlineCreate, props)));
20
15
  }));
21
- var ComposedLinkCreate = /*#__PURE__*/memo(function (props) {
22
- return jsx(AnalyticsContext, {
16
+ var ComposedLinkCreateNew = /*#__PURE__*/memo(function (props) {
17
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
23
18
  data: PACKAGE_DATA
24
- }, jsx(IntlMessagesProvider, {
19
+ }, /*#__PURE__*/React.createElement(IntlMessagesProvider, {
25
20
  defaultMessages: i18nEN,
26
21
  loaderFn: fetchMessagesForLocale
27
- }, jsx(LinkCreateWithAnalyticsContext, props)));
22
+ }, /*#__PURE__*/React.createElement(LinkCreateWithAnalyticsContext, props)));
23
+ });
24
+ var ComposedLinkCreate = /*#__PURE__*/memo(function (props) {
25
+ if (fg('platform_bandicoots-link-create-css')) {
26
+ return /*#__PURE__*/React.createElement(ComposedLinkCreateNew, props);
27
+ }
28
+ return /*#__PURE__*/React.createElement(ComposedLinkCreateOld, props);
28
29
  });
29
30
  export default ComposedLinkCreate;
@@ -1,13 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- /**
5
- * @jsxRuntime classic
6
- * @jsx jsx
7
- */
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
- import { jsx } from '@emotion/react';
10
- import { Box } from '@atlaskit/primitives';
4
+ import React from 'react';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { Box } from '@atlaskit/primitives/compiled';
11
7
  import { DEFAULT_TEST_ID, SCREEN_ID } from '../../common/constants';
12
8
  import { ConfirmDismissDialog } from '../../common/ui/confirm-dismiss-dialog';
13
9
  import { EditModal } from '../../common/ui/edit-modal';
@@ -19,6 +15,7 @@ import { useExitWarningModal } from '../../controllers/exit-warning-modal-contex
19
15
  import { FormContextProvider } from '../../controllers/form-context';
20
16
  import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../controllers/plugin-context';
21
17
  import { InlineAnalytics } from './inline-analytics';
18
+ import InlineCreateOld from './old/main';
22
19
  var InlineCreateContent = function InlineCreateContent(_ref) {
23
20
  var onCreate = _ref.onCreate,
24
21
  onFailure = _ref.onFailure,
@@ -39,42 +36,42 @@ var InlineCreateContent = function InlineCreateContent(_ref) {
39
36
  var handleCloseExitWarning = function handleCloseExitWarning() {
40
37
  return setShowExitWarning(false);
41
38
  };
42
- return jsx(LinkCreateCallbackProvider, {
39
+ return /*#__PURE__*/React.createElement(LinkCreateCallbackProvider, {
43
40
  onCreate: onCreate,
44
41
  onFailure: onFailure,
45
42
  onCancel: withExitWarning(onCancel)
46
- }, jsx(ErrorBoundary, null, jsx(InlineAnalytics, {
43
+ }, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(InlineAnalytics, {
47
44
  screen: SCREEN_ID
48
- }, jsx(Box, {
45
+ }, /*#__PURE__*/React.createElement(Box, {
49
46
  testId: testId
50
- }, jsx(LinkCreateContent, {
47
+ }, /*#__PURE__*/React.createElement(LinkCreateContent, {
51
48
  plugins: plugins,
52
49
  entityKey: entityKey
53
- })))), onComplete && jsx(EditModal, {
50
+ })))), onComplete && /*#__PURE__*/React.createElement(EditModal, {
54
51
  onClose: onComplete,
55
52
  editViewPayload: editViewPayload,
56
53
  activePlugin: activePlugin
57
- }), jsx(ConfirmDismissDialog, {
54
+ }), /*#__PURE__*/React.createElement(ConfirmDismissDialog, {
58
55
  active: showExitWarning,
59
56
  onClose: handleCloseExitWarning,
60
57
  onCancel: onCancel
61
58
  }));
62
59
  };
63
- var InlineCreate = function InlineCreate(props) {
64
- return jsx(LinkCreatePluginsProvider, {
60
+ var InlineCreateNew = function InlineCreateNew(props) {
61
+ return /*#__PURE__*/React.createElement(LinkCreatePluginsProvider, {
65
62
  plugins: props.plugins,
66
63
  entityKey: props.entityKey
67
64
  }, function (pluginsProvider) {
68
- return jsx(EditPostCreateModalProvider, {
65
+ return /*#__PURE__*/React.createElement(EditPostCreateModalProvider, {
69
66
  active: true
70
67
  }, function (_ref2) {
71
68
  var _pluginsProvider$acti;
72
69
  var setEditViewPayload = _ref2.setEditViewPayload,
73
70
  shouldActivateEditView = _ref2.shouldActivateEditView,
74
71
  enableEditView = _ref2.enableEditView;
75
- return jsx(FormContextProvider, {
72
+ return /*#__PURE__*/React.createElement(FormContextProvider, {
76
73
  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
77
- }, jsx(InlineCreateContent, _extends({}, props, {
74
+ }, /*#__PURE__*/React.createElement(InlineCreateContent, _extends({}, props, {
78
75
  onCreate: ( /*#__PURE__*/function () {
79
76
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
80
77
  var _props$onCreate;
@@ -108,4 +105,10 @@ var InlineCreate = function InlineCreate(props) {
108
105
  });
109
106
  });
110
107
  };
108
+ var InlineCreate = function InlineCreate(props) {
109
+ if (fg('platform_bandicoots-link-create-css')) {
110
+ return /*#__PURE__*/React.createElement(InlineCreateNew, props);
111
+ }
112
+ return /*#__PURE__*/React.createElement(InlineCreateOld, props);
113
+ };
111
114
  export default InlineCreate;
@@ -0,0 +1,30 @@
1
+ /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
6
+ import { memo } from 'react';
7
+
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
+ import { jsx } from '@emotion/react';
10
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
11
+ import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
12
+ import { PACKAGE_DATA } from '../../../common/constants';
13
+ import { ErrorBoundary } from '../../../common/ui/error-boundary';
14
+ import { Experience } from '../../../common/ui/experience-tracker';
15
+ import { withLinkCreateAnalyticsContext } from '../../../common/utils/analytics';
16
+ import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
17
+ import i18nEN from '../../../i18n/en';
18
+ import InlineCreate from '../main';
19
+ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (props) {
20
+ return jsx(Experience, null, jsx(ErrorBoundary, null, jsx(InlineCreate, props)));
21
+ }));
22
+ var ComposedLinkCreateOld = /*#__PURE__*/memo(function (props) {
23
+ return jsx(AnalyticsContext, {
24
+ data: PACKAGE_DATA
25
+ }, jsx(IntlMessagesProvider, {
26
+ defaultMessages: i18nEN,
27
+ loaderFn: fetchMessagesForLocale
28
+ }, jsx(LinkCreateWithAnalyticsContext, props)));
29
+ });
30
+ export default ComposedLinkCreateOld;
@@ -0,0 +1,112 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
5
+ /**
6
+ * @jsxRuntime classic
7
+ * @jsx jsx
8
+ */
9
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
+ import { jsx } from '@emotion/react';
11
+ import { Box } from '@atlaskit/primitives';
12
+ import { DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
13
+ import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
14
+ import { EditModal } from '../../../common/ui/edit-modal';
15
+ import { ErrorBoundary } from '../../../common/ui/error-boundary';
16
+ import { LinkCreateContent } from '../../../common/ui/link-create-content';
17
+ import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
18
+ import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
19
+ import { useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
20
+ import { FormContextProvider } from '../../../controllers/form-context';
21
+ import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
22
+ import { InlineAnalytics } from '../inline-analytics';
23
+ var InlineCreateContent = function InlineCreateContent(_ref) {
24
+ var onCreate = _ref.onCreate,
25
+ onFailure = _ref.onFailure,
26
+ onCancel = _ref.onCancel,
27
+ onComplete = _ref.onComplete,
28
+ plugins = _ref.plugins,
29
+ entityKey = _ref.entityKey,
30
+ _ref$testId = _ref.testId,
31
+ testId = _ref$testId === void 0 ? DEFAULT_TEST_ID : _ref$testId;
32
+ var _useExitWarningModal = useExitWarningModal(),
33
+ withExitWarning = _useExitWarningModal.withExitWarning,
34
+ showExitWarning = _useExitWarningModal.showExitWarning,
35
+ setShowExitWarning = _useExitWarningModal.setShowExitWarning;
36
+ var _useEditPostCreateMod = useEditPostCreateModal(),
37
+ editViewPayload = _useEditPostCreateMod.editViewPayload;
38
+ var _useLinkCreatePlugins = useLinkCreatePlugins(),
39
+ activePlugin = _useLinkCreatePlugins.activePlugin;
40
+ var handleCloseExitWarning = function handleCloseExitWarning() {
41
+ return setShowExitWarning(false);
42
+ };
43
+ return jsx(LinkCreateCallbackProvider, {
44
+ onCreate: onCreate,
45
+ onFailure: onFailure,
46
+ onCancel: withExitWarning(onCancel)
47
+ }, jsx(ErrorBoundary, null, jsx(InlineAnalytics, {
48
+ screen: SCREEN_ID
49
+ }, jsx(Box, {
50
+ testId: testId
51
+ }, jsx(LinkCreateContent, {
52
+ plugins: plugins,
53
+ entityKey: entityKey
54
+ })))), onComplete && jsx(EditModal, {
55
+ onClose: onComplete,
56
+ editViewPayload: editViewPayload,
57
+ activePlugin: activePlugin
58
+ }), jsx(ConfirmDismissDialog, {
59
+ active: showExitWarning,
60
+ onClose: handleCloseExitWarning,
61
+ onCancel: onCancel
62
+ }));
63
+ };
64
+ var InlineCreateOld = function InlineCreateOld(props) {
65
+ return jsx(LinkCreatePluginsProvider, {
66
+ plugins: props.plugins,
67
+ entityKey: props.entityKey
68
+ }, function (pluginsProvider) {
69
+ return jsx(EditPostCreateModalProvider, {
70
+ active: true
71
+ }, function (_ref2) {
72
+ var _pluginsProvider$acti;
73
+ var setEditViewPayload = _ref2.setEditViewPayload,
74
+ shouldActivateEditView = _ref2.shouldActivateEditView,
75
+ enableEditView = _ref2.enableEditView;
76
+ return jsx(FormContextProvider, {
77
+ 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
78
+ }, jsx(InlineCreateContent, _extends({}, props, {
79
+ onCreate: ( /*#__PURE__*/function () {
80
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
81
+ var _props$onCreate;
82
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
83
+ while (1) switch (_context.prev = _context.next) {
84
+ case 0:
85
+ _context.next = 2;
86
+ return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
87
+ case 2:
88
+ // if onComplete exists then there is an edit flow
89
+ if (props.onComplete) {
90
+ if (shouldActivateEditView()) {
91
+ //edit button is pressed
92
+ setEditViewPayload(payload);
93
+ } else {
94
+ //create button is pressed
95
+ props.onComplete();
96
+ }
97
+ }
98
+ case 3:
99
+ case "end":
100
+ return _context.stop();
101
+ }
102
+ }, _callee);
103
+ }));
104
+ return function (_x) {
105
+ return _ref3.apply(this, arguments);
106
+ };
107
+ }())
108
+ })));
109
+ });
110
+ });
111
+ };
112
+ export default InlineCreateOld;
@@ -1,13 +1,7 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { memo } from 'react';
6
-
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
- import { jsx } from '@emotion/react';
1
+ import React, { memo } from 'react';
9
2
  import { AnalyticsContext } from '@atlaskit/analytics-next';
10
3
  import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
11
5
  import { PACKAGE_DATA } from '../../common/constants';
12
6
  import { ErrorBoundary } from '../../common/ui/error-boundary';
13
7
  import { ErrorBoundaryModal } from '../../common/ui/error-boundary-modal';
@@ -16,20 +10,27 @@ import { withLinkCreateAnalyticsContext } from '../../common/utils/analytics';
16
10
  import { fetchMessagesForLocale } from '../../common/utils/locale/fetch-messages-for-locale';
17
11
  import i18nEN from '../../i18n/en';
18
12
  import LinkCreate from './main';
13
+ import ComposedLinkCreateOld from './old';
19
14
  var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (props) {
20
- return jsx(Experience, null, jsx(ErrorBoundary, {
21
- errorComponent: jsx(ErrorBoundaryModal, {
15
+ return /*#__PURE__*/React.createElement(Experience, null, /*#__PURE__*/React.createElement(ErrorBoundary, {
16
+ errorComponent: /*#__PURE__*/React.createElement(ErrorBoundaryModal, {
22
17
  active: props.active,
23
18
  onClose: props.onCancel
24
19
  })
25
- }, jsx(LinkCreate, props)));
20
+ }, /*#__PURE__*/React.createElement(LinkCreate, props)));
26
21
  }));
27
- var ComposedLinkCreate = /*#__PURE__*/memo(function (props) {
28
- return jsx(AnalyticsContext, {
22
+ var ComposedLinkCreateNew = /*#__PURE__*/memo(function (props) {
23
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
29
24
  data: PACKAGE_DATA
30
- }, jsx(IntlMessagesProvider, {
25
+ }, /*#__PURE__*/React.createElement(IntlMessagesProvider, {
31
26
  defaultMessages: i18nEN,
32
27
  loaderFn: fetchMessagesForLocale
33
- }, jsx(LinkCreateWithAnalyticsContext, props)));
28
+ }, /*#__PURE__*/React.createElement(LinkCreateWithAnalyticsContext, props)));
29
+ });
30
+ var ComposedLinkCreate = /*#__PURE__*/memo(function (props) {
31
+ if (fg('platform_bandicoots-link-create-css')) {
32
+ return /*#__PURE__*/React.createElement(ComposedLinkCreateNew, props);
33
+ }
34
+ return /*#__PURE__*/React.createElement(ComposedLinkCreateOld, props);
34
35
  });
35
36
  export default ComposedLinkCreate;
@@ -1,18 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- /**
5
- * @jsxRuntime classic
6
- * @jsx jsx
7
- */
8
- import { useLayoutEffect, useRef } from 'react';
9
-
10
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
- import { jsx } from '@emotion/react';
4
+ import React, { useLayoutEffect, useRef } from 'react';
12
5
  import { useIntl } from 'react-intl-next';
13
6
  import { Layering } from '@atlaskit/layering';
14
7
  import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
15
- import { Box } from '@atlaskit/primitives';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { Box } from '@atlaskit/primitives/compiled';
16
10
  import { CREATE_FORM_MAX_WIDTH_IN_PX, DEFAULT_TEST_ID, SCREEN_ID } from '../../common/constants';
17
11
  import { ConfirmDismissDialog } from '../../common/ui/confirm-dismiss-dialog';
18
12
  import { EditModal } from '../../common/ui/edit-modal';
@@ -26,6 +20,7 @@ import { ExitWarningModalProvider, useExitWarningModal } from '../../controllers
26
20
  import { FormContextProvider } from '../../controllers/form-context';
27
21
  import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../controllers/plugin-context';
28
22
  import { messages } from './messages';
23
+ import LinkCreateModalOld from './old/main';
29
24
  var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
30
25
  var active = _ref.active,
31
26
  modalTitle = _ref.modalTitle,
@@ -52,11 +47,11 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
52
47
  var handleCloseExitWarning = function handleCloseExitWarning() {
53
48
  return setShowExitWarning(false);
54
49
  };
55
- return jsx(LinkCreateCallbackProvider, {
50
+ return /*#__PURE__*/React.createElement(LinkCreateCallbackProvider, {
56
51
  onCreate: onCreate,
57
52
  onFailure: onFailure,
58
53
  onCancel: withExitWarning(onCancel)
59
- }, jsx(ModalTransition, null, active && jsx(Modal, {
54
+ }, /*#__PURE__*/React.createElement(ModalTransition, null, active && /*#__PURE__*/React.createElement(Modal, {
60
55
  testId: "link-create-modal",
61
56
  screen: SCREEN_ID,
62
57
  onClose: withExitWarning(onCancel),
@@ -64,27 +59,27 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
64
59
  onOpenComplete: onOpenComplete,
65
60
  onCloseComplete: onCloseComplete,
66
61
  width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
67
- }, jsx(ModalHero, {
62
+ }, /*#__PURE__*/React.createElement(ModalHero, {
68
63
  hero: modalHero
69
- }), jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
64
+ }), /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Box, {
70
65
  testId: testId
71
- }, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
66
+ }, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(LinkCreateContent, {
72
67
  plugins: plugins,
73
68
  entityKey: entityKey
74
- })))))), onComplete && jsx(EditModal, {
69
+ })))))), onComplete && /*#__PURE__*/React.createElement(EditModal, {
75
70
  onCloseComplete: onCloseComplete,
76
71
  onClose: onComplete,
77
72
  editViewPayload: editViewPayload,
78
73
  activePlugin: activePlugin
79
- }), jsx(Layering, {
74
+ }), /*#__PURE__*/React.createElement(Layering, {
80
75
  isDisabled: false
81
- }, jsx(ConfirmDismissDialog, {
76
+ }, /*#__PURE__*/React.createElement(ConfirmDismissDialog, {
82
77
  active: showExitWarning,
83
78
  onClose: handleCloseExitWarning,
84
79
  onCancel: onCancel
85
80
  })));
86
81
  };
87
- var LinkCreateModal = function LinkCreateModal(props) {
82
+ var LinkCreateModalNew = function LinkCreateModalNew(props) {
88
83
  var shouldCallCloseComplete = useRef(!props.active);
89
84
 
90
85
  // modal calls onCloseComplete in a useEffect(), so we can track whether
@@ -94,11 +89,11 @@ var LinkCreateModal = function LinkCreateModal(props) {
94
89
  // onCloseComplete should only be called when it is not active
95
90
  shouldCallCloseComplete.current = !props.active;
96
91
  }, [props.active]);
97
- return jsx(LinkCreatePluginsProvider, {
92
+ return /*#__PURE__*/React.createElement(LinkCreatePluginsProvider, {
98
93
  plugins: props.plugins,
99
94
  entityKey: props.entityKey
100
95
  }, function (pluginsProvider) {
101
- return jsx(EditPostCreateModalProvider, {
96
+ return /*#__PURE__*/React.createElement(EditPostCreateModalProvider, {
102
97
  active: !!props.active
103
98
  }, function (_ref2) {
104
99
  var _pluginsProvider$acti;
@@ -106,9 +101,9 @@ var LinkCreateModal = function LinkCreateModal(props) {
106
101
  editViewPayload = _ref2.editViewPayload,
107
102
  shouldActivateEditView = _ref2.shouldActivateEditView,
108
103
  enableEditView = _ref2.enableEditView;
109
- return jsx(FormContextProvider, {
104
+ return /*#__PURE__*/React.createElement(FormContextProvider, {
110
105
  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
111
- }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
106
+ }, /*#__PURE__*/React.createElement(ExitWarningModalProvider, null, /*#__PURE__*/React.createElement(LinkCreateWithModal, _extends({}, props, {
112
107
  active: props.active && !editViewPayload,
113
108
  onCreate: ( /*#__PURE__*/function () {
114
109
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
@@ -152,4 +147,10 @@ var LinkCreateModal = function LinkCreateModal(props) {
152
147
  });
153
148
  });
154
149
  };
150
+ var LinkCreateModal = function LinkCreateModal(props) {
151
+ if (fg('platform_bandicoots-link-create-css')) {
152
+ return /*#__PURE__*/React.createElement(LinkCreateModalNew, props);
153
+ }
154
+ return /*#__PURE__*/React.createElement(LinkCreateModalOld, props);
155
+ };
155
156
  export default LinkCreateModal;
@@ -0,0 +1,36 @@
1
+ /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
6
+ import { memo } from 'react';
7
+
8
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
+ import { jsx } from '@emotion/react';
10
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
11
+ import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
12
+ import { PACKAGE_DATA } from '../../../common/constants';
13
+ import { ErrorBoundary } from '../../../common/ui/error-boundary';
14
+ import { ErrorBoundaryModal } from '../../../common/ui/error-boundary-modal';
15
+ import { Experience } from '../../../common/ui/experience-tracker';
16
+ import { withLinkCreateAnalyticsContext } from '../../../common/utils/analytics';
17
+ import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
18
+ import i18nEN from '../../../i18n/en';
19
+ import LinkCreate from '../main';
20
+ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (props) {
21
+ return jsx(Experience, null, jsx(ErrorBoundary, {
22
+ errorComponent: jsx(ErrorBoundaryModal, {
23
+ active: props.active,
24
+ onClose: props.onCancel
25
+ })
26
+ }, jsx(LinkCreate, props)));
27
+ }));
28
+ var ComposedLinkCreateOld = /*#__PURE__*/memo(function (props) {
29
+ return jsx(AnalyticsContext, {
30
+ data: PACKAGE_DATA
31
+ }, jsx(IntlMessagesProvider, {
32
+ defaultMessages: i18nEN,
33
+ loaderFn: fetchMessagesForLocale
34
+ }, jsx(LinkCreateWithAnalyticsContext, props)));
35
+ });
36
+ export default ComposedLinkCreateOld;
@@ -0,0 +1,156 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ /* eslint-disable @atlassian/tangerine/import/no-parent-imports */
5
+ /**
6
+ * @jsxRuntime classic
7
+ * @jsx jsx
8
+ */
9
+ import { useLayoutEffect, useRef } from 'react';
10
+
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
+ import { jsx } from '@emotion/react';
13
+ import { useIntl } from 'react-intl-next';
14
+ import { Layering } from '@atlaskit/layering';
15
+ import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
16
+ import { Box } from '@atlaskit/primitives';
17
+ import { CREATE_FORM_MAX_WIDTH_IN_PX, DEFAULT_TEST_ID, SCREEN_ID } from '../../../common/constants';
18
+ import { ConfirmDismissDialog } from '../../../common/ui/confirm-dismiss-dialog';
19
+ import { EditModal } from '../../../common/ui/edit-modal';
20
+ import { ErrorBoundary } from '../../../common/ui/error-boundary';
21
+ import { LinkCreateContent } from '../../../common/ui/link-create-content';
22
+ import { ModalHero } from '../../../common/ui/modal-hero';
23
+ import { Modal } from '../../../common/ui/ModalDialog';
24
+ import { LinkCreateCallbackProvider } from '../../../controllers/callback-context';
25
+ import { EditPostCreateModalProvider, useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
26
+ import { ExitWarningModalProvider, useExitWarningModal } from '../../../controllers/exit-warning-modal-context';
27
+ import { FormContextProvider } from '../../../controllers/form-context';
28
+ import { LinkCreatePluginsProvider, useLinkCreatePlugins } from '../../../controllers/plugin-context';
29
+ import { messages } from '../messages';
30
+ var LinkCreateWithModal = function LinkCreateWithModal(_ref) {
31
+ var active = _ref.active,
32
+ modalTitle = _ref.modalTitle,
33
+ onCreate = _ref.onCreate,
34
+ onFailure = _ref.onFailure,
35
+ onCancel = _ref.onCancel,
36
+ onComplete = _ref.onComplete,
37
+ onOpenComplete = _ref.onOpenComplete,
38
+ onCloseComplete = _ref.onCloseComplete,
39
+ _ref$testId = _ref.testId,
40
+ testId = _ref$testId === void 0 ? DEFAULT_TEST_ID : _ref$testId,
41
+ plugins = _ref.plugins,
42
+ entityKey = _ref.entityKey,
43
+ modalHero = _ref.modalHero;
44
+ var intl = useIntl();
45
+ var _useExitWarningModal = useExitWarningModal(),
46
+ withExitWarning = _useExitWarningModal.withExitWarning,
47
+ showExitWarning = _useExitWarningModal.showExitWarning,
48
+ setShowExitWarning = _useExitWarningModal.setShowExitWarning;
49
+ var _useEditPostCreateMod = useEditPostCreateModal(),
50
+ editViewPayload = _useEditPostCreateMod.editViewPayload;
51
+ var _useLinkCreatePlugins = useLinkCreatePlugins(),
52
+ activePlugin = _useLinkCreatePlugins.activePlugin;
53
+ var handleCloseExitWarning = function handleCloseExitWarning() {
54
+ return setShowExitWarning(false);
55
+ };
56
+ return jsx(LinkCreateCallbackProvider, {
57
+ onCreate: onCreate,
58
+ onFailure: onFailure,
59
+ onCancel: withExitWarning(onCancel)
60
+ }, jsx(ModalTransition, null, active && jsx(Modal, {
61
+ testId: "link-create-modal",
62
+ screen: SCREEN_ID,
63
+ onClose: withExitWarning(onCancel),
64
+ shouldScrollInViewport: true,
65
+ onOpenComplete: onOpenComplete,
66
+ onCloseComplete: onCloseComplete,
67
+ width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
68
+ }, jsx(ModalHero, {
69
+ hero: modalHero
70
+ }), jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
71
+ testId: testId
72
+ }, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
73
+ plugins: plugins,
74
+ entityKey: entityKey
75
+ })))))), onComplete && jsx(EditModal, {
76
+ onCloseComplete: onCloseComplete,
77
+ onClose: onComplete,
78
+ editViewPayload: editViewPayload,
79
+ activePlugin: activePlugin
80
+ }), jsx(Layering, {
81
+ isDisabled: false
82
+ }, jsx(ConfirmDismissDialog, {
83
+ active: showExitWarning,
84
+ onClose: handleCloseExitWarning,
85
+ onCancel: onCancel
86
+ })));
87
+ };
88
+ var LinkCreateModalOld = function LinkCreateModalOld(props) {
89
+ var shouldCallCloseComplete = useRef(!props.active);
90
+
91
+ // modal calls onCloseComplete in a useEffect(), so we can track whether
92
+ // or not we should execute it based on the active prop in a
93
+ // useLayoutEffect() which will be run before child useEffect()s
94
+ useLayoutEffect(function () {
95
+ // onCloseComplete should only be called when it is not active
96
+ shouldCallCloseComplete.current = !props.active;
97
+ }, [props.active]);
98
+ return jsx(LinkCreatePluginsProvider, {
99
+ plugins: props.plugins,
100
+ entityKey: props.entityKey
101
+ }, function (pluginsProvider) {
102
+ return jsx(EditPostCreateModalProvider, {
103
+ active: !!props.active
104
+ }, function (_ref2) {
105
+ var _pluginsProvider$acti;
106
+ var setEditViewPayload = _ref2.setEditViewPayload,
107
+ editViewPayload = _ref2.editViewPayload,
108
+ shouldActivateEditView = _ref2.shouldActivateEditView,
109
+ enableEditView = _ref2.enableEditView;
110
+ return jsx(FormContextProvider, {
111
+ 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
112
+ }, jsx(ExitWarningModalProvider, null, jsx(LinkCreateWithModal, _extends({}, props, {
113
+ active: props.active && !editViewPayload,
114
+ onCreate: ( /*#__PURE__*/function () {
115
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
116
+ var _props$onCreate;
117
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
118
+ while (1) switch (_context.prev = _context.next) {
119
+ case 0:
120
+ _context.next = 2;
121
+ return (_props$onCreate = props.onCreate) === null || _props$onCreate === void 0 ? void 0 : _props$onCreate.call(props, payload);
122
+ case 2:
123
+ // if onComplete exists then there is an edit flow
124
+ if (props.onComplete) {
125
+ if (shouldActivateEditView()) {
126
+ //edit button is pressed
127
+ setEditViewPayload(payload);
128
+ } else {
129
+ //create button is pressed
130
+ props.onComplete();
131
+ }
132
+ }
133
+ case 3:
134
+ case "end":
135
+ return _context.stop();
136
+ }
137
+ }, _callee);
138
+ }));
139
+ return function (_x) {
140
+ return _ref3.apply(this, arguments);
141
+ };
142
+ }()),
143
+ onCloseComplete: function onCloseComplete() {
144
+ if (shouldCallCloseComplete.current) {
145
+ var _props$onCloseComplet;
146
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
147
+ args[_key] = arguments[_key];
148
+ }
149
+ (_props$onCloseComplet = props.onCloseComplete) === null || _props$onCloseComplet === void 0 || _props$onCloseComplet.call.apply(_props$onCloseComplet, [props].concat(args));
150
+ }
151
+ }
152
+ }))));
153
+ });
154
+ });
155
+ };
156
+ export default LinkCreateModalOld;
@@ -4,6 +4,9 @@ export declare const COMPONENT_NAME = "linkCreate";
4
4
  export declare const SCREEN_ID = "linkCreateScreen";
5
5
  export declare const DEFAULT_TEST_ID = "link-create";
6
6
  export declare const CREATE_FORM_MAX_WIDTH_IN_PX = "480";
7
+ /**
8
+ * @deprecated Remove on FF clean up platform_bandicoots-link-create-css
9
+ */
7
10
  export declare const CREATE_FORM_MIN_HEIGHT_IN_PX = "200";
8
11
  export declare const LINK_CREATE_FORM_POST_CREATE_FIELD = "__post_create__";
9
12
  export declare const PACKAGE_DATA: PackageMetaDataType;