@atlaskit/link-create 1.9.4 → 1.9.5
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 +6 -0
- package/analytics.spec.yaml +24 -2
- package/dist/cjs/common/ui/ModalDialog/index.js +49 -0
- package/dist/cjs/common/utils/analytics/analytics.codegen.js +1 -1
- package/dist/cjs/common/utils/form/index.js +14 -3
- package/dist/cjs/controllers/create-field/main.js +23 -26
- package/dist/cjs/controllers/form-context/main.js +0 -25
- package/dist/cjs/ui/create-form/form-footer/edit-button/index.js +5 -0
- package/dist/cjs/ui/create-form/form-footer/main.js +13 -6
- package/dist/cjs/ui/create-form/form-footer/submit-button/index.js +5 -0
- package/dist/cjs/ui/create-form/main.js +6 -25
- package/dist/cjs/ui/link-create/confirm-dismiss-dialog/main.js +5 -9
- package/dist/cjs/ui/link-create/edit-modal/index.js +6 -6
- package/dist/cjs/ui/link-create/main.js +6 -7
- package/dist/cjs/ui/main.js +1 -1
- package/dist/es2019/common/ui/ModalDialog/index.js +39 -0
- package/dist/es2019/common/utils/analytics/analytics.codegen.js +1 -1
- package/dist/es2019/common/utils/form/index.js +13 -2
- package/dist/es2019/controllers/create-field/main.js +21 -23
- package/dist/es2019/controllers/form-context/main.js +0 -18
- package/dist/es2019/ui/create-form/form-footer/edit-button/index.js +7 -1
- package/dist/es2019/ui/create-form/form-footer/main.js +13 -2
- package/dist/es2019/ui/create-form/form-footer/submit-button/index.js +7 -1
- package/dist/es2019/ui/create-form/main.js +3 -20
- package/dist/es2019/ui/link-create/confirm-dismiss-dialog/main.js +4 -5
- package/dist/es2019/ui/link-create/edit-modal/index.js +6 -3
- package/dist/es2019/ui/link-create/main.js +5 -3
- package/dist/es2019/ui/main.js +1 -1
- package/dist/esm/common/ui/ModalDialog/index.js +39 -0
- package/dist/esm/common/utils/analytics/analytics.codegen.js +1 -1
- package/dist/esm/common/utils/form/index.js +13 -2
- package/dist/esm/controllers/create-field/main.js +21 -24
- package/dist/esm/controllers/form-context/main.js +0 -25
- package/dist/esm/ui/create-form/form-footer/edit-button/index.js +6 -1
- package/dist/esm/ui/create-form/form-footer/main.js +12 -2
- package/dist/esm/ui/create-form/form-footer/submit-button/index.js +6 -1
- package/dist/esm/ui/create-form/main.js +7 -26
- package/dist/esm/ui/link-create/confirm-dismiss-dialog/main.js +4 -5
- package/dist/esm/ui/link-create/edit-modal/index.js +6 -3
- package/dist/esm/ui/link-create/main.js +5 -3
- package/dist/esm/ui/main.js +1 -1
- package/dist/types/common/ui/Button/index.d.ts +1 -1
- package/dist/types/common/ui/ModalDialog/index.d.ts +13 -0
- package/dist/types/common/utils/analytics/analytics.codegen.d.ts +7 -1
- package/dist/types/common/utils/analytics/components.d.ts +1 -2
- package/dist/types/common/utils/form/index.d.ts +1 -1
- package/dist/types/controllers/create-field/main.d.ts +1 -0
- package/dist/types/controllers/form-context/main.d.ts +1 -3
- package/dist/types/ui/link-create/edit-modal/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/Button/index.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/ModalDialog/index.d.ts +13 -0
- package/dist/types-ts4.5/common/utils/analytics/analytics.codegen.d.ts +7 -1
- package/dist/types-ts4.5/common/utils/analytics/components.d.ts +1 -2
- package/dist/types-ts4.5/common/utils/form/index.d.ts +1 -1
- package/dist/types-ts4.5/controllers/create-field/main.d.ts +1 -0
- package/dist/types-ts4.5/controllers/form-context/main.d.ts +1 -3
- package/dist/types-ts4.5/ui/link-create/edit-modal/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/ui/link-create/track-mount/index.js +0 -30
- package/dist/es2019/ui/link-create/track-mount/index.js +0 -24
- package/dist/esm/ui/link-create/track-mount/index.js +0 -23
- package/dist/types/ui/link-create/track-mount/index.d.ts +0 -5
- package/dist/types-ts4.5/ui/link-create/track-mount/index.d.ts +0 -5
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useForm, useFormState } from 'react-final-form';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
5
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
5
|
-
import { LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
|
|
6
|
+
import { ANALYTICS_CHANNEL, LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
|
|
7
|
+
import createEventPayload from '../../../../common/utils/analytics/analytics.codegen';
|
|
6
8
|
import { useFormContext } from '../../../../controllers/form-context';
|
|
7
9
|
// eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
|
|
8
10
|
import { FormSpy } from '../../form-spy';
|
|
9
11
|
import { messages } from './messages';
|
|
10
12
|
export var EditButton = function EditButton() {
|
|
11
13
|
var intl = useIntl();
|
|
14
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
15
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
12
16
|
var _useFormState = useFormState(),
|
|
13
17
|
submitting = _useFormState.submitting;
|
|
14
18
|
var _useForm = useForm(),
|
|
@@ -32,6 +36,7 @@ export var EditButton = function EditButton() {
|
|
|
32
36
|
submitting && values[LINK_CREATE_FORM_POST_CREATE_FIELD] === true,
|
|
33
37
|
onClick: function onClick() {
|
|
34
38
|
var _mutators$setField;
|
|
39
|
+
createAnalyticsEvent(createEventPayload('ui.button.clicked.edit', {})).fire(ANALYTICS_CHANNEL);
|
|
35
40
|
/**
|
|
36
41
|
* Setting this field to true indicates that the edit button was clicked and that
|
|
37
42
|
* we have the intention of triggering the edit/post create flow
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useIntl } from 'react-intl-next';
|
|
5
|
-
import
|
|
5
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
|
+
import { ButtonGroup } from '@atlaskit/button';
|
|
6
7
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
7
8
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
8
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
11
|
+
import { Button } from '../../../common/ui/Button';
|
|
12
|
+
import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
|
|
9
13
|
import { EditButton } from './edit-button';
|
|
10
14
|
import { messages } from './messages';
|
|
11
15
|
import { SubmitButton } from './submit-button';
|
|
@@ -30,6 +34,8 @@ export function CreateFormFooter(_ref) {
|
|
|
30
34
|
submitting = _ref.submitting,
|
|
31
35
|
testId = _ref.testId;
|
|
32
36
|
var intl = useIntl();
|
|
37
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
38
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
33
39
|
return jsx("footer", {
|
|
34
40
|
"data-testid": "".concat(testId, "-footer"),
|
|
35
41
|
css: formFooterWrapperStyles
|
|
@@ -41,6 +47,7 @@ export function CreateFormFooter(_ref) {
|
|
|
41
47
|
primaryColor: "var(--ds-icon-danger, #E34935)"
|
|
42
48
|
}), formErrorMessage), jsx(ButtonGroup, null, jsx(Button, {
|
|
43
49
|
type: "button",
|
|
50
|
+
actionSubjectId: "cancel",
|
|
44
51
|
appearance: "subtle",
|
|
45
52
|
onClick: handleCancel,
|
|
46
53
|
testId: "".concat(testId, "-button-cancel")
|
|
@@ -48,6 +55,9 @@ export function CreateFormFooter(_ref) {
|
|
|
48
55
|
type: "submit",
|
|
49
56
|
appearance: "primary",
|
|
50
57
|
isLoading: submitting,
|
|
51
|
-
testId: "".concat(testId, "-button-submit")
|
|
58
|
+
testId: "".concat(testId, "-button-submit"),
|
|
59
|
+
onClick: function onClick() {
|
|
60
|
+
createAnalyticsEvent(createEventPayload('ui.button.clicked.create', {})).fire(ANALYTICS_CHANNEL);
|
|
61
|
+
}
|
|
52
62
|
}, intl.formatMessage(messages.create))));
|
|
53
63
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useForm, useFormState } from 'react-final-form';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
5
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
5
|
-
import { LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
|
|
6
|
+
import { ANALYTICS_CHANNEL, LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../../../common/constants';
|
|
7
|
+
import createEventPayload from '../../../../common/utils/analytics/analytics.codegen';
|
|
6
8
|
// eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
|
|
7
9
|
import { FormSpy } from '../../form-spy';
|
|
8
10
|
// eslint-disable-next-line @atlassian/tangerine/import/no-parent-imports
|
|
9
11
|
import { messages } from '../messages';
|
|
10
12
|
export var SubmitButton = function SubmitButton() {
|
|
11
13
|
var intl = useIntl();
|
|
14
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
15
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
12
16
|
var _useFormState = useFormState(),
|
|
13
17
|
submitting = _useFormState.submitting;
|
|
14
18
|
var _useForm = useForm(),
|
|
@@ -27,6 +31,7 @@ export var SubmitButton = function SubmitButton() {
|
|
|
27
31
|
testId: "link-create-form-button-submit",
|
|
28
32
|
onClick: function onClick() {
|
|
29
33
|
var _mutators$setField;
|
|
34
|
+
createAnalyticsEvent(createEventPayload('ui.button.clicked.create', {})).fire(ANALYTICS_CHANNEL);
|
|
30
35
|
(_mutators$setField = mutators.setField) === null || _mutators$setField === void 0 || _mutators$setField.call(mutators, LINK_CREATE_FORM_POST_CREATE_FIELD, false);
|
|
31
36
|
}
|
|
32
37
|
}, intl.formatMessage(messages.create));
|
|
@@ -9,16 +9,13 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
9
9
|
import { useCallback } from 'react';
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { Form, FormSpy } from 'react-final-form';
|
|
12
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { Box } from '@atlaskit/primitives';
|
|
15
|
-
import {
|
|
16
|
-
import createEventPayload from '../../common/utils/analytics/analytics.codegen';
|
|
14
|
+
import { CREATE_FORM_MAX_WIDTH_IN_PX, LINK_CREATE_FORM_POST_CREATE_FIELD } from '../../common/constants';
|
|
17
15
|
import { useExitWarningModal } from '../../controllers/exit-warning-modal-context';
|
|
18
16
|
import { useFormContext } from '../../controllers/form-context';
|
|
19
17
|
import { CreateFormFooter } from './form-footer';
|
|
20
18
|
import { CreateFormLoader } from './form-loader';
|
|
21
|
-
import { validateFormData } from './utils';
|
|
22
19
|
var formStyles = css({
|
|
23
20
|
maxWidth: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px"),
|
|
24
21
|
padding: "0 0 ".concat("var(--ds-space-300, 24px)", " 0"),
|
|
@@ -35,34 +32,19 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
35
32
|
isLoading = _ref.isLoading,
|
|
36
33
|
hideFooter = _ref.hideFooter,
|
|
37
34
|
initialValues = _ref.initialValues;
|
|
38
|
-
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
39
|
-
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
40
35
|
var _useFormContext = useFormContext(),
|
|
41
|
-
getValidators = _useFormContext.getValidators,
|
|
42
36
|
formErrorMessage = _useFormContext.formErrorMessage,
|
|
43
37
|
enableEditView = _useFormContext.enableEditView;
|
|
44
38
|
var _useExitWarningModal = useExitWarningModal(),
|
|
45
39
|
setShouldShowWarning = _useExitWarningModal.setShouldShowWarning;
|
|
46
40
|
var handleSubmit = useCallback( /*#__PURE__*/function () {
|
|
47
41
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
48
|
-
var
|
|
42
|
+
var shouldEnableEditView, formData;
|
|
49
43
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
50
44
|
while (1) switch (_context.prev = _context.next) {
|
|
51
45
|
case 0:
|
|
52
|
-
createAnalyticsEvent(createEventPayload('ui.button.clicked.create', {})).fire(ANALYTICS_CHANNEL);
|
|
53
|
-
validators = getValidators();
|
|
54
|
-
errors = validateFormData({
|
|
55
|
-
data: data,
|
|
56
|
-
validators: validators
|
|
57
|
-
});
|
|
58
|
-
if (!(Object.keys(errors).length !== 0)) {
|
|
59
|
-
_context.next = 5;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
return _context.abrupt("return", errors);
|
|
63
|
-
case 5:
|
|
64
46
|
if (!getBooleanFF('platform.linking-platform.link-create.enable-edit')) {
|
|
65
|
-
_context.next =
|
|
47
|
+
_context.next = 4;
|
|
66
48
|
break;
|
|
67
49
|
}
|
|
68
50
|
shouldEnableEditView = data[LINK_CREATE_FORM_POST_CREATE_FIELD], formData = _objectWithoutProperties(data, [LINK_CREATE_FORM_POST_CREATE_FIELD].map(_toPropertyKey));
|
|
@@ -73,9 +55,9 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
73
55
|
*/
|
|
74
56
|
enableEditView === null || enableEditView === void 0 || enableEditView(!!shouldEnableEditView);
|
|
75
57
|
return _context.abrupt("return", onSubmit(formData));
|
|
76
|
-
case
|
|
58
|
+
case 4:
|
|
77
59
|
return _context.abrupt("return", onSubmit(data));
|
|
78
|
-
case
|
|
60
|
+
case 5:
|
|
79
61
|
case "end":
|
|
80
62
|
return _context.stop();
|
|
81
63
|
}
|
|
@@ -84,11 +66,10 @@ export var CreateForm = function CreateForm(_ref) {
|
|
|
84
66
|
return function (_x) {
|
|
85
67
|
return _ref2.apply(this, arguments);
|
|
86
68
|
};
|
|
87
|
-
}(), [
|
|
69
|
+
}(), [onSubmit, enableEditView]);
|
|
88
70
|
var handleCancel = useCallback(function () {
|
|
89
|
-
createAnalyticsEvent(createEventPayload('ui.button.clicked.cancel', {})).fire(ANALYTICS_CHANNEL);
|
|
90
71
|
onCancel && onCancel();
|
|
91
|
-
}, [
|
|
72
|
+
}, [onCancel]);
|
|
92
73
|
if (isLoading) {
|
|
93
74
|
return jsx(CreateFormLoader, null);
|
|
94
75
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
4
|
-
import
|
|
4
|
+
import { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
5
5
|
import { Button } from '../../../common/ui/Button';
|
|
6
|
-
import {
|
|
6
|
+
import { Modal } from '../../../common/ui/ModalDialog';
|
|
7
7
|
import { useLinkCreateCallback } from '../../../controllers/callback-context';
|
|
8
8
|
import messages from './messages';
|
|
9
9
|
var screen = 'linkCreateExitWarningScreen';
|
|
@@ -28,11 +28,10 @@ export var ConfirmDismissDialog = function ConfirmDismissDialog(_ref) {
|
|
|
28
28
|
data: context
|
|
29
29
|
}, /*#__PURE__*/React.createElement(Modal, {
|
|
30
30
|
testId: "link-create-confirm-dismiss-dialog",
|
|
31
|
+
screen: screen,
|
|
31
32
|
onClose: onCancelDismiss,
|
|
32
33
|
width: "small"
|
|
33
|
-
}, /*#__PURE__*/React.createElement(
|
|
34
|
-
screen: screen
|
|
35
|
-
}), /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, intl.formatMessage(messages.title))), /*#__PURE__*/React.createElement(ModalBody, null, intl.formatMessage(messages.description)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
34
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(ModalTitle, null, intl.formatMessage(messages.title))), /*#__PURE__*/React.createElement(ModalBody, null, intl.formatMessage(messages.description)), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
36
35
|
actionSubjectId: "cancel",
|
|
37
36
|
appearance: "subtle",
|
|
38
37
|
onClick: onCancelDismiss
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { ModalTransition } from '@atlaskit/modal-dialog';
|
|
3
|
+
import { Modal } from '../../../common/ui/ModalDialog';
|
|
3
4
|
import { useEditPostCreateModal } from '../../../controllers/edit-post-create-context';
|
|
4
5
|
import { useLinkCreatePlugins } from '../../../controllers/plugin-context';
|
|
6
|
+
var SCREEN = 'linkCreateEditScreen';
|
|
5
7
|
export var EditModal = function EditModal(_ref) {
|
|
6
8
|
var _activePlugin$editVie;
|
|
7
9
|
var onClose = _ref.onClose,
|
|
@@ -10,8 +12,9 @@ export var EditModal = function EditModal(_ref) {
|
|
|
10
12
|
editViewPayload = _useEditPostCreateMod.editViewPayload;
|
|
11
13
|
var _useLinkCreatePlugins = useLinkCreatePlugins(),
|
|
12
14
|
activePlugin = _useLinkCreatePlugins.activePlugin;
|
|
13
|
-
return /*#__PURE__*/React.createElement(ModalTransition, null, !!editViewPayload && /*#__PURE__*/React.createElement(Modal, {
|
|
15
|
+
return /*#__PURE__*/React.createElement(ModalTransition, null, !!editViewPayload && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
|
|
14
16
|
testId: "link-create-edit-modal",
|
|
17
|
+
screen: SCREEN,
|
|
15
18
|
onClose: onClose,
|
|
16
19
|
shouldScrollInViewport: true,
|
|
17
20
|
width: "calc(100vw - 120px)",
|
|
@@ -20,5 +23,5 @@ export var EditModal = function EditModal(_ref) {
|
|
|
20
23
|
}, activePlugin === null || activePlugin === void 0 || (_activePlugin$editVie = activePlugin.editView) === null || _activePlugin$editVie === void 0 ? void 0 : _activePlugin$editVie.call(activePlugin, {
|
|
21
24
|
payload: editViewPayload,
|
|
22
25
|
onClose: onClose
|
|
23
|
-
})));
|
|
26
|
+
}))));
|
|
24
27
|
};
|
|
@@ -6,10 +6,11 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
6
6
|
import { Fragment, useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { useIntl } from 'react-intl-next';
|
|
9
|
-
import
|
|
9
|
+
import { ModalBody, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
10
10
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
import { Box } from '@atlaskit/primitives';
|
|
12
12
|
import { CREATE_FORM_MAX_WIDTH_IN_PX } from '../../common/constants';
|
|
13
|
+
import { Modal } from '../../common/ui/ModalDialog';
|
|
13
14
|
import { LinkCreateCallbackProvider } from '../../controllers/callback-context';
|
|
14
15
|
import { EditPostCreateModalProvider } from '../../controllers/edit-post-create-context';
|
|
15
16
|
import { ExitWarningModalProvider, useExitWarningModal } from '../../controllers/exit-warning-modal-context';
|
|
@@ -19,8 +20,8 @@ import { ConfirmDismissDialog } from './confirm-dismiss-dialog';
|
|
|
19
20
|
import { EditModal } from './edit-modal';
|
|
20
21
|
import { ErrorBoundary } from './error-boundary';
|
|
21
22
|
import { messages } from './messages';
|
|
22
|
-
import TrackMount from './track-mount';
|
|
23
23
|
export var TEST_ID = 'link-create';
|
|
24
|
+
var SCREEN_ID = 'linkCreateScreen';
|
|
24
25
|
var LinkCreateContent = function LinkCreateContent(_ref) {
|
|
25
26
|
var plugins = _ref.plugins,
|
|
26
27
|
entityKey = _ref.entityKey;
|
|
@@ -100,6 +101,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
|
|
|
100
101
|
onCancel: handleCancel
|
|
101
102
|
}, jsx(ModalTransition, null, active && jsx(Modal, {
|
|
102
103
|
testId: "link-create-modal",
|
|
104
|
+
screen: SCREEN_ID,
|
|
103
105
|
onClose: handleCancel,
|
|
104
106
|
shouldScrollInViewport: true,
|
|
105
107
|
onOpenComplete: onOpenComplete,
|
|
@@ -107,7 +109,7 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
|
|
|
107
109
|
width: "".concat(CREATE_FORM_MAX_WIDTH_IN_PX, "px")
|
|
108
110
|
}, jsx(ModalHeader, null, jsx(ModalTitle, null, modalTitle || intl.formatMessage(messages.heading))), jsx(ModalBody, null, jsx(Box, {
|
|
109
111
|
testId: testId
|
|
110
|
-
}, jsx(ErrorBoundary, null, jsx(
|
|
112
|
+
}, jsx(ErrorBoundary, null, jsx(LinkCreateContent, {
|
|
111
113
|
plugins: plugins,
|
|
112
114
|
entityKey: entityKey
|
|
113
115
|
})))))), getBooleanFF('platform.linking-platform.link-create.enable-edit') && onComplete && jsx(EditModal, {
|
package/dist/esm/ui/main.js
CHANGED
|
@@ -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.9.
|
|
26
|
+
packageVersion: "1.9.5" || '',
|
|
27
27
|
componentName: COMPONENT_NAME,
|
|
28
28
|
source: COMPONENT_NAME
|
|
29
29
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
3
3
|
export declare const Button: React.ForwardRefExoticComponent<Pick<import("@atlaskit/button").ButtonProps & React.RefAttributes<HTMLElement> & {
|
|
4
|
-
actionSubjectId: "create" | "cancel" | "confirm";
|
|
4
|
+
actionSubjectId: "create" | "edit" | "cancel" | "confirm";
|
|
5
5
|
}, "key" | keyof import("@atlaskit/button").ButtonProps | "actionSubjectId"> & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
3
|
+
import { AnalyticsEventAttributes } from '../../utils/analytics/analytics.codegen';
|
|
4
|
+
type ModalProps = React.ComponentProps<typeof ModalDialog> & {
|
|
5
|
+
screen: keyof {
|
|
6
|
+
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* AkModal component with built-in analytics for screen event + open + close events + source context
|
|
11
|
+
*/
|
|
12
|
+
export declare const Modal: ({ screen, children, ...props }: ModalProps) => JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::be704bbbca0e49c927d1268b9a0f1d6a>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataType = {
|
|
@@ -18,11 +18,14 @@ export type LinkCreateAnalyticsContextType = {
|
|
|
18
18
|
appearance: 'modal' | 'popup';
|
|
19
19
|
};
|
|
20
20
|
export type LinkCreateScreenViewedAttributesType = {};
|
|
21
|
+
export type LinkCreateEditScreenViewedAttributesType = {};
|
|
21
22
|
export type LinkCreateExitWarningScreenViewedAttributesType = {};
|
|
22
23
|
export type ButtonClickedCreateAttributesType = {};
|
|
24
|
+
export type ButtonClickedEditAttributesType = {};
|
|
23
25
|
export type ButtonClickedCancelAttributesType = {};
|
|
24
26
|
export type ButtonClickedConfirmAttributesType = {};
|
|
25
27
|
export type ModalDialogClosedLinkCreateAttributesType = {};
|
|
28
|
+
export type ModalDialogOpenedLinkCreateAttributesType = {};
|
|
26
29
|
export type LinkCreateUnhandledErrorCaughtAttributesType = {
|
|
27
30
|
browserInfo: string;
|
|
28
31
|
error: string;
|
|
@@ -37,11 +40,14 @@ export type ObjectCreateFailedLinkCreateAttributesType = {
|
|
|
37
40
|
};
|
|
38
41
|
export type AnalyticsEventAttributes = {
|
|
39
42
|
'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
|
|
43
|
+
'screen.linkCreateEditScreen.viewed': LinkCreateEditScreenViewedAttributesType;
|
|
40
44
|
'screen.linkCreateExitWarningScreen.viewed': LinkCreateExitWarningScreenViewedAttributesType;
|
|
41
45
|
'ui.button.clicked.create': ButtonClickedCreateAttributesType;
|
|
46
|
+
'ui.button.clicked.edit': ButtonClickedEditAttributesType;
|
|
42
47
|
'ui.button.clicked.cancel': ButtonClickedCancelAttributesType;
|
|
43
48
|
'ui.button.clicked.confirm': ButtonClickedConfirmAttributesType;
|
|
44
49
|
'ui.modalDialog.closed.linkCreate': ModalDialogClosedLinkCreateAttributesType;
|
|
50
|
+
'ui.modalDialog.opened.linkCreate': ModalDialogOpenedLinkCreateAttributesType;
|
|
45
51
|
'operational.linkCreate.unhandledErrorCaught': LinkCreateUnhandledErrorCaughtAttributesType;
|
|
46
52
|
'track.object.created.linkCreate': ObjectCreatedLinkCreateAttributesType;
|
|
47
53
|
'track.object.createFailed.linkCreate': ObjectCreateFailedLinkCreateAttributesType;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AnalyticsEventAttributes } from './analytics.codegen';
|
|
2
|
-
type ScreenViewedEventProps = {
|
|
2
|
+
export type ScreenViewedEventProps = {
|
|
3
3
|
screen: keyof {
|
|
4
4
|
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
7
|
export declare const ScreenViewedEvent: ({ screen }: ScreenViewedEventProps) => null;
|
|
8
|
-
export {};
|
|
@@ -4,4 +4,4 @@ import { FieldMetaState } from 'react-final-form';
|
|
|
4
4
|
* to let a Field know if it should hide the error message until
|
|
5
5
|
* the next submit, or if it returns to the previous error state
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const shouldShowValidationErrors: (meta: FieldMetaState<any>) => boolean;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { LinkCreateProps
|
|
2
|
+
import { LinkCreateProps } from '../../common/types';
|
|
3
3
|
interface FormContextType {
|
|
4
|
-
getValidators: () => ValidatorMap;
|
|
5
|
-
assignValidator: (name: string, validators: Validator[]) => void;
|
|
6
4
|
setFormErrorMessage: (errorMessage?: string) => void;
|
|
7
5
|
formErrorMessage?: string;
|
|
8
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnalyticsEventAttributes } from '../../../common/utils/analytics/analytics.codegen';
|
|
3
3
|
export declare const Button: React.ForwardRefExoticComponent<Pick<import("@atlaskit/button").ButtonProps & React.RefAttributes<HTMLElement> & {
|
|
4
|
-
actionSubjectId: "create" | "cancel" | "confirm";
|
|
4
|
+
actionSubjectId: "create" | "edit" | "cancel" | "confirm";
|
|
5
5
|
}, "key" | keyof import("@atlaskit/button").ButtonProps | "actionSubjectId"> & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
3
|
+
import { AnalyticsEventAttributes } from '../../utils/analytics/analytics.codegen';
|
|
4
|
+
type ModalProps = React.ComponentProps<typeof ModalDialog> & {
|
|
5
|
+
screen: keyof {
|
|
6
|
+
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* AkModal component with built-in analytics for screen event + open + close events + source context
|
|
11
|
+
*/
|
|
12
|
+
export declare const Modal: ({ screen, children, ...props }: ModalProps) => JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::be704bbbca0e49c927d1268b9a0f1d6a>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataType = {
|
|
@@ -18,11 +18,14 @@ export type LinkCreateAnalyticsContextType = {
|
|
|
18
18
|
appearance: 'modal' | 'popup';
|
|
19
19
|
};
|
|
20
20
|
export type LinkCreateScreenViewedAttributesType = {};
|
|
21
|
+
export type LinkCreateEditScreenViewedAttributesType = {};
|
|
21
22
|
export type LinkCreateExitWarningScreenViewedAttributesType = {};
|
|
22
23
|
export type ButtonClickedCreateAttributesType = {};
|
|
24
|
+
export type ButtonClickedEditAttributesType = {};
|
|
23
25
|
export type ButtonClickedCancelAttributesType = {};
|
|
24
26
|
export type ButtonClickedConfirmAttributesType = {};
|
|
25
27
|
export type ModalDialogClosedLinkCreateAttributesType = {};
|
|
28
|
+
export type ModalDialogOpenedLinkCreateAttributesType = {};
|
|
26
29
|
export type LinkCreateUnhandledErrorCaughtAttributesType = {
|
|
27
30
|
browserInfo: string;
|
|
28
31
|
error: string;
|
|
@@ -37,11 +40,14 @@ export type ObjectCreateFailedLinkCreateAttributesType = {
|
|
|
37
40
|
};
|
|
38
41
|
export type AnalyticsEventAttributes = {
|
|
39
42
|
'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
|
|
43
|
+
'screen.linkCreateEditScreen.viewed': LinkCreateEditScreenViewedAttributesType;
|
|
40
44
|
'screen.linkCreateExitWarningScreen.viewed': LinkCreateExitWarningScreenViewedAttributesType;
|
|
41
45
|
'ui.button.clicked.create': ButtonClickedCreateAttributesType;
|
|
46
|
+
'ui.button.clicked.edit': ButtonClickedEditAttributesType;
|
|
42
47
|
'ui.button.clicked.cancel': ButtonClickedCancelAttributesType;
|
|
43
48
|
'ui.button.clicked.confirm': ButtonClickedConfirmAttributesType;
|
|
44
49
|
'ui.modalDialog.closed.linkCreate': ModalDialogClosedLinkCreateAttributesType;
|
|
50
|
+
'ui.modalDialog.opened.linkCreate': ModalDialogOpenedLinkCreateAttributesType;
|
|
45
51
|
'operational.linkCreate.unhandledErrorCaught': LinkCreateUnhandledErrorCaughtAttributesType;
|
|
46
52
|
'track.object.created.linkCreate': ObjectCreatedLinkCreateAttributesType;
|
|
47
53
|
'track.object.createFailed.linkCreate': ObjectCreateFailedLinkCreateAttributesType;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AnalyticsEventAttributes } from './analytics.codegen';
|
|
2
|
-
type ScreenViewedEventProps = {
|
|
2
|
+
export type ScreenViewedEventProps = {
|
|
3
3
|
screen: keyof {
|
|
4
4
|
[Key in keyof AnalyticsEventAttributes as Key extends `screen.${infer ScreenName}.viewed` ? ScreenName : never]: any;
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
7
|
export declare const ScreenViewedEvent: ({ screen }: ScreenViewedEventProps) => null;
|
|
8
|
-
export {};
|
|
@@ -4,4 +4,4 @@ import { FieldMetaState } from 'react-final-form';
|
|
|
4
4
|
* to let a Field know if it should hide the error message until
|
|
5
5
|
* the next submit, or if it returns to the previous error state
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const shouldShowValidationErrors: (meta: FieldMetaState<any>) => boolean;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { LinkCreateProps
|
|
2
|
+
import { LinkCreateProps } from '../../common/types';
|
|
3
3
|
interface FormContextType {
|
|
4
|
-
getValidators: () => ValidatorMap;
|
|
5
|
-
assignValidator: (name: string, validators: Validator[]) => void;
|
|
6
4
|
setFormErrorMessage: (errorMessage?: string) => void;
|
|
7
5
|
formErrorMessage?: string;
|
|
8
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-create",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5",
|
|
4
4
|
"description": "The driver component of meta creation flow",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
38
|
-
"@atlaskit/button": "^16.
|
|
38
|
+
"@atlaskit/button": "^16.17.0",
|
|
39
39
|
"@atlaskit/empty-state": "^7.6.0",
|
|
40
40
|
"@atlaskit/form": "^9.0.0",
|
|
41
41
|
"@atlaskit/icon": "^22.0.0",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
|
-
var _constants = require("../../../common/constants");
|
|
11
|
-
var _analytics = _interopRequireDefault(require("../../../common/utils/analytics/analytics.codegen"));
|
|
12
|
-
/** @jsx jsx */
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Analytics tracking for component mount (and unmount)
|
|
16
|
-
*/
|
|
17
|
-
function TrackMount() {
|
|
18
|
-
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
19
|
-
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
20
|
-
(0, _react.useLayoutEffect)(function () {
|
|
21
|
-
// Anything in here is fired on component mount.
|
|
22
|
-
createAnalyticsEvent((0, _analytics.default)('screen.linkCreateScreen.viewed', {})).fire(_constants.ANALYTICS_CHANNEL);
|
|
23
|
-
return function () {
|
|
24
|
-
// Anything in here is fired on component unmount.
|
|
25
|
-
createAnalyticsEvent((0, _analytics.default)('ui.modalDialog.closed.linkCreate', {})).fire(_constants.ANALYTICS_CHANNEL);
|
|
26
|
-
};
|
|
27
|
-
}, [createAnalyticsEvent]);
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
var _default = exports.default = TrackMount;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
-
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
5
|
-
import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Analytics tracking for component mount (and unmount)
|
|
9
|
-
*/
|
|
10
|
-
function TrackMount() {
|
|
11
|
-
const {
|
|
12
|
-
createAnalyticsEvent
|
|
13
|
-
} = useAnalyticsEvents();
|
|
14
|
-
useLayoutEffect(() => {
|
|
15
|
-
// Anything in here is fired on component mount.
|
|
16
|
-
createAnalyticsEvent(createEventPayload('screen.linkCreateScreen.viewed', {})).fire(ANALYTICS_CHANNEL);
|
|
17
|
-
return () => {
|
|
18
|
-
// Anything in here is fired on component unmount.
|
|
19
|
-
createAnalyticsEvent(createEventPayload('ui.modalDialog.closed.linkCreate', {})).fire(ANALYTICS_CHANNEL);
|
|
20
|
-
};
|
|
21
|
-
}, [createAnalyticsEvent]);
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
export default TrackMount;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
-
import { ANALYTICS_CHANNEL } from '../../../common/constants';
|
|
5
|
-
import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Analytics tracking for component mount (and unmount)
|
|
9
|
-
*/
|
|
10
|
-
function TrackMount() {
|
|
11
|
-
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
12
|
-
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
13
|
-
useLayoutEffect(function () {
|
|
14
|
-
// Anything in here is fired on component mount.
|
|
15
|
-
createAnalyticsEvent(createEventPayload('screen.linkCreateScreen.viewed', {})).fire(ANALYTICS_CHANNEL);
|
|
16
|
-
return function () {
|
|
17
|
-
// Anything in here is fired on component unmount.
|
|
18
|
-
createAnalyticsEvent(createEventPayload('ui.modalDialog.closed.linkCreate', {})).fire(ANALYTICS_CHANNEL);
|
|
19
|
-
};
|
|
20
|
-
}, [createAnalyticsEvent]);
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
export default TrackMount;
|