@atlaskit/link-create 1.9.5 → 1.11.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 (72) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/analytics.spec.yaml +29 -3
  3. package/dist/cjs/common/messages.js +14 -0
  4. package/dist/cjs/common/ui/error-boundary-ui/index.js +4 -3
  5. package/dist/cjs/common/ui/error-boundary-ui/messages.js +0 -5
  6. package/dist/cjs/common/utils/analytics/analytics.codegen.js +1 -1
  7. package/dist/cjs/common/utils/errors/index.js +39 -0
  8. package/dist/cjs/controllers/callback-context/main.js +23 -7
  9. package/dist/cjs/controllers/experience-tracker/index.js +85 -0
  10. package/dist/cjs/index.js +7 -0
  11. package/dist/cjs/ui/create-form/async-select/main.js +62 -20
  12. package/dist/cjs/ui/create-form/form-footer/edit-button/index.js +1 -1
  13. package/dist/cjs/ui/create-form/form-footer/edit-button/messages.js +4 -4
  14. package/dist/cjs/ui/create-form/main.js +62 -7
  15. package/dist/cjs/ui/link-create/error-boundary/index.js +14 -9
  16. package/dist/cjs/ui/link-create/main.js +5 -3
  17. package/dist/cjs/ui/main.js +9 -9
  18. package/dist/es2019/common/messages.js +8 -0
  19. package/dist/es2019/common/ui/error-boundary-ui/index.js +2 -1
  20. package/dist/es2019/common/ui/error-boundary-ui/messages.js +0 -5
  21. package/dist/es2019/common/utils/analytics/analytics.codegen.js +1 -1
  22. package/dist/es2019/common/utils/errors/index.js +31 -0
  23. package/dist/es2019/controllers/callback-context/main.js +19 -3
  24. package/dist/es2019/controllers/experience-tracker/index.js +75 -0
  25. package/dist/es2019/index.js +1 -0
  26. package/dist/es2019/ui/create-form/async-select/main.js +32 -1
  27. package/dist/es2019/ui/create-form/form-footer/edit-button/index.js +1 -1
  28. package/dist/es2019/ui/create-form/form-footer/edit-button/messages.js +4 -4
  29. package/dist/es2019/ui/create-form/main.js +47 -3
  30. package/dist/es2019/ui/link-create/error-boundary/index.js +14 -9
  31. package/dist/es2019/ui/link-create/main.js +5 -3
  32. package/dist/es2019/ui/main.js +10 -9
  33. package/dist/esm/common/messages.js +8 -0
  34. package/dist/esm/common/ui/error-boundary-ui/index.js +2 -1
  35. package/dist/esm/common/ui/error-boundary-ui/messages.js +0 -5
  36. package/dist/esm/common/utils/analytics/analytics.codegen.js +1 -1
  37. package/dist/esm/common/utils/errors/index.js +32 -0
  38. package/dist/esm/controllers/callback-context/main.js +23 -7
  39. package/dist/esm/controllers/experience-tracker/index.js +75 -0
  40. package/dist/esm/index.js +1 -0
  41. package/dist/esm/ui/create-form/async-select/main.js +62 -20
  42. package/dist/esm/ui/create-form/form-footer/edit-button/index.js +1 -1
  43. package/dist/esm/ui/create-form/form-footer/edit-button/messages.js +4 -4
  44. package/dist/esm/ui/create-form/main.js +62 -7
  45. package/dist/esm/ui/link-create/error-boundary/index.js +14 -9
  46. package/dist/esm/ui/link-create/main.js +5 -3
  47. package/dist/esm/ui/main.js +10 -10
  48. package/dist/types/common/messages.d.ts +8 -0
  49. package/dist/types/common/types.d.ts +1 -1
  50. package/dist/types/common/ui/error-boundary-ui/messages.d.ts +0 -5
  51. package/dist/types/common/utils/analytics/analytics.codegen.d.ts +11 -2
  52. package/dist/types/common/utils/errors/index.d.ts +10 -0
  53. package/dist/types/controllers/callback-context/main.d.ts +1 -1
  54. package/dist/types/controllers/experience-tracker/index.d.ts +22 -0
  55. package/dist/types/index.d.ts +1 -0
  56. package/dist/types/ui/create-form/async-select/main.d.ts +1 -1
  57. package/dist/types/ui/create-form/form-footer/edit-button/messages.d.ts +1 -1
  58. package/dist/types/ui/create-form/main.d.ts +18 -1
  59. package/dist/types-ts4.5/common/messages.d.ts +8 -0
  60. package/dist/types-ts4.5/common/types.d.ts +1 -1
  61. package/dist/types-ts4.5/common/ui/error-boundary-ui/messages.d.ts +0 -5
  62. package/dist/types-ts4.5/common/utils/analytics/analytics.codegen.d.ts +11 -2
  63. package/dist/types-ts4.5/common/utils/errors/index.d.ts +10 -0
  64. package/dist/types-ts4.5/controllers/callback-context/main.d.ts +1 -1
  65. package/dist/types-ts4.5/controllers/experience-tracker/index.d.ts +22 -0
  66. package/dist/types-ts4.5/index.d.ts +1 -0
  67. package/dist/types-ts4.5/ui/create-form/async-select/main.d.ts +1 -1
  68. package/dist/types-ts4.5/ui/create-form/form-footer/edit-button/messages.d.ts +1 -1
  69. package/dist/types-ts4.5/ui/create-form/main.d.ts +18 -1
  70. package/package.json +9 -5
  71. package/report.api.md +12 -9
  72. package/tmp/api-report-tmp.d.ts +10 -9
@@ -5,20 +5,24 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
5
  import { ANALYTICS_CHANNEL } from '../../../common/constants';
6
6
  import { ErrorBoundaryUI } from '../../../common/ui/error-boundary-ui';
7
7
  import createEventPayload from '../../../common/utils/analytics/analytics.codegen';
8
+ import { useExperience } from '../../../controllers/experience-tracker';
8
9
  import { BaseErrorBoundary } from './error-boundary-base';
9
10
  export var ErrorBoundary = function ErrorBoundary(_ref) {
10
11
  var children = _ref.children,
11
12
  errorComponent = _ref.errorComponent;
12
13
  var _useAnalyticsEvents = useAnalyticsEvents(),
13
14
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
15
+ var experience = getBooleanFF('platform.linking-platform.link-create.better-observability') ?
16
+ // eslint-disable-next-line react-hooks/rules-of-hooks
17
+ useExperience() : null;
14
18
  var handleError = useCallback(function (error, info) {
15
19
  var _window, _window2, _info$componentStack;
16
- if (getBooleanFF('platform.linking-platform.link-create.enable-sentry-client')) {
17
- // Capture exception to Sentry
18
- captureException(error, 'link-create');
20
+ if (!getBooleanFF('platform.linking-platform.link-create.better-observability')) {
21
+ if (getBooleanFF('platform.linking-platform.link-create.enable-sentry-client')) {
22
+ // Capture exception to Sentry
23
+ captureException(error, 'link-create');
24
+ }
19
25
  }
20
-
21
- // Fire Analytics event
22
26
  createAnalyticsEvent(createEventPayload('operational.linkCreate.unhandledErrorCaught', getBooleanFF('platform.linking-platform.link-create.enable-sentry-client') ? {
23
27
  browserInfo: ((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) || 'unknown',
24
28
  error: error.name,
@@ -28,10 +32,11 @@ export var ErrorBoundary = function ErrorBoundary(_ref) {
28
32
  error: error.toString(),
29
33
  componentStack: (_info$componentStack = info === null || info === void 0 ? void 0 : info.componentStack) !== null && _info$componentStack !== void 0 ? _info$componentStack : ''
30
34
  })).fire(ANALYTICS_CHANNEL);
31
-
32
- // Fire UFO failed experience
33
- // failUfoExperience(ufoExperience.mounted);
34
- }, [createAnalyticsEvent]);
35
+ if (getBooleanFF('platform.linking-platform.link-create.better-observability')) {
36
+ // Track experience as failed for SLO
37
+ experience === null || experience === void 0 || experience.failure(error);
38
+ }
39
+ }, [createAnalyticsEvent, experience]);
35
40
  return /*#__PURE__*/React.createElement(BaseErrorBoundary, {
36
41
  onError: handleError,
37
42
  errorComponent: errorComponent !== null && errorComponent !== void 0 ? errorComponent : /*#__PURE__*/React.createElement(ErrorBoundaryUI, null)
@@ -74,7 +74,9 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
74
74
  }(), [onCreate, setFormErrorMessage]);
75
75
  var handleFailure = useCallback(function (error) {
76
76
  // Set the form error message
77
- setFormErrorMessage(error.message);
77
+ if (error instanceof Error) {
78
+ setFormErrorMessage(error.message);
79
+ }
78
80
  onFailure && onFailure(error);
79
81
  }, [onFailure, setFormErrorMessage]);
80
82
  var _useExitWarningModal = useExitWarningModal(),
@@ -96,8 +98,8 @@ var LinkCreateWithModal = function LinkCreateWithModal(_ref2) {
96
98
  return setShowExitWarning(false);
97
99
  }, []);
98
100
  return jsx(LinkCreateCallbackProvider, {
99
- onCreate: handleCreate,
100
- onFailure: handleFailure,
101
+ onCreate: getBooleanFF('platform.linking-platform.link-create.better-observability') ? onCreate : handleCreate,
102
+ onFailure: getBooleanFF('platform.linking-platform.link-create.better-observability') ? onFailure : handleFailure,
101
103
  onCancel: handleCancel
102
104
  }, jsx(ModalTransition, null, active && jsx(Modal, {
103
105
  testId: "link-create-modal",
@@ -1,31 +1,31 @@
1
- import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
2
- import _extends from "@babel/runtime/helpers/extends";
3
1
  /** @jsx jsx */
4
- import { memo } from 'react';
2
+ import { Fragment, memo } from 'react';
5
3
  import { jsx } from '@emotion/react';
6
4
  import { AnalyticsContext } from '@atlaskit/analytics-next';
7
5
  import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
7
  import { COMPONENT_NAME } from '../common/constants';
9
8
  import { ErrorBoundaryModal } from '../common/ui/error-boundary-modal';
10
9
  import { withLinkCreateAnalyticsContext } from '../common/utils/analytics';
11
10
  import { fetchMessagesForLocale } from '../common/utils/locale/fetch-messages-for-locale';
11
+ import { Experience } from '../controllers/experience-tracker';
12
12
  import i18nEN from '../i18n/en';
13
13
  import LinkCreate from './link-create';
14
14
  import { ErrorBoundary } from './link-create/error-boundary';
15
- var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (_ref) {
16
- var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
17
- return jsx(ErrorBoundary, {
15
+ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__*/memo(function (props) {
16
+ var ExperienceProvider = getBooleanFF('platform.linking-platform.link-create.better-observability') ? Experience : Fragment;
17
+ return jsx(ExperienceProvider, null, jsx(ErrorBoundary, {
18
18
  errorComponent: jsx(ErrorBoundaryModal, {
19
19
  active: props.active,
20
20
  onClose: props.onCancel
21
21
  })
22
- }, jsx(LinkCreate, props));
22
+ }, jsx(LinkCreate, props)));
23
23
  }));
24
24
  export var PACKAGE_DATA = {
25
25
  packageName: "@atlaskit/link-create" || '',
26
- packageVersion: "1.9.5" || '',
27
- componentName: COMPONENT_NAME,
28
- source: COMPONENT_NAME
26
+ packageVersion: "1.11.0" || '',
27
+ component: COMPONENT_NAME,
28
+ componentName: COMPONENT_NAME
29
29
  };
30
30
  var ComposedLinkCreate = /*#__PURE__*/memo(function (props) {
31
31
  return jsx(AnalyticsContext, {
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ genericErrorMessage: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
8
+ export default _default;
@@ -70,7 +70,7 @@ export type CreatePayload = {
70
70
  * https://stash.atlassian.com/projects/JIRACLOUD/repos/jira-frontend/browse/src/packages/issue-create/issue-create-embed/src/ui/index.tsx
71
71
  * https://stash.atlassian.com/projects/JIRACLOUD/repos/jira-frontend/pull-requests/103587/overview?commentId=5778323
72
72
  */
73
- ari: string | undefined;
73
+ ari?: string | undefined;
74
74
  /** The object identifier for the resource created by the create plugin (for analytics) */
75
75
  objectId: string;
76
76
  /** The type of object created (for analytics) */
@@ -1,9 +1,4 @@
1
1
  declare const _default: {
2
- heading: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
2
  description: {
8
3
  id: string;
9
4
  defaultMessage: string;
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::be704bbbca0e49c927d1268b9a0f1d6a>>
6
+ * @codegen <<SignedSource::20562f2db603daab7d5b7a5c5ba1c04b>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
8
8
  */
9
9
  export type PackageMetaDataType = {
10
10
  packageName: string;
11
11
  packageVersion: string;
12
- source: 'linkCreate';
12
+ component: 'linkCreate';
13
13
  componentName: 'linkCreate';
14
14
  };
15
15
  export type LinkCreateAnalyticsContextType = {
@@ -38,6 +38,14 @@ export type ObjectCreatedLinkCreateAttributesType = {
38
38
  export type ObjectCreateFailedLinkCreateAttributesType = {
39
39
  failureType: string;
40
40
  };
41
+ export type OperationFailedLinkCreateAttributesType = {
42
+ errorType: string | null;
43
+ experienceStatus: 'SUCCEEDED' | 'FAILED';
44
+ previousExperienceStatus: 'STARTED' | 'SUCCEEDED' | 'FAILED';
45
+ path: string | null;
46
+ status: number | null;
47
+ traceId: string | null;
48
+ };
41
49
  export type AnalyticsEventAttributes = {
42
50
  'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
43
51
  'screen.linkCreateEditScreen.viewed': LinkCreateEditScreenViewedAttributesType;
@@ -51,6 +59,7 @@ export type AnalyticsEventAttributes = {
51
59
  'operational.linkCreate.unhandledErrorCaught': LinkCreateUnhandledErrorCaughtAttributesType;
52
60
  'track.object.created.linkCreate': ObjectCreatedLinkCreateAttributesType;
53
61
  'track.object.createFailed.linkCreate': ObjectCreateFailedLinkCreateAttributesType;
62
+ 'operational.operation.failed.linkCreate': OperationFailedLinkCreateAttributesType;
54
63
  };
55
64
  declare function createEventPayload<K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]): {
56
65
  eventType: string;
@@ -0,0 +1,10 @@
1
+ export declare const getNetworkFields: (error: unknown) => {
2
+ traceId: string | null;
3
+ status: number;
4
+ path: string;
5
+ } | {
6
+ traceId: null;
7
+ status: null;
8
+ path: null;
9
+ };
10
+ export declare const getErrorType: (error: unknown) => string;
@@ -8,7 +8,7 @@ interface LinkCreateCallbackProviderProps {
8
8
  /**
9
9
  * This callback for any errors
10
10
  */
11
- onFailure?: (error: Error) => void;
11
+ onFailure?: (error: unknown) => void;
12
12
  /**
13
13
  * This callback for when the form was manually discarded by user
14
14
  */
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export type ExperienceProps = {
3
+ children: React.ReactNode;
4
+ };
5
+ type ExperienceContextValue = {
6
+ /**
7
+ * Mark the experience as successful.
8
+ */
9
+ success: () => void;
10
+ /**
11
+ * Mark the experience as failed.
12
+ * Sends an analytics event to track experience as failed.
13
+ */
14
+ failure: (error: unknown) => void;
15
+ };
16
+ /**
17
+ * Experience provider that simply keeps track of the state of the experience.
18
+ * Fires an operational event when experience state changes to FAILED.
19
+ */
20
+ export declare const Experience: ({ children }: ExperienceProps) => JSX.Element;
21
+ export declare const useExperience: () => ExperienceContextValue;
22
+ export {};
@@ -1,3 +1,4 @@
1
+ export { FORM_ERROR } from 'final-form';
1
2
  export type { CreateFormProps } from './ui/index';
2
3
  export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, EditViewProps, } from './common/types';
3
4
  export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, } from './ui/index';
@@ -8,4 +8,4 @@ export declare const TEST_ID = "link-create-async-select";
8
8
  * errors returned by the handleSubmit function passed to the form <Form> that
9
9
  * have a key matching the `name` of this field are shown below the field.
10
10
  */
11
- export declare function AsyncSelect<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;
11
+ export declare function AsyncSelect<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions: loadOptionsFn, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  export declare const messages: {
2
- edit: {
2
+ createAndOpen: {
3
3
  id: string;
4
4
  defaultMessage: string;
5
5
  description: string;
@@ -9,11 +9,28 @@ type DisallowReservedFields<T> = T & {
9
9
  [Field in (typeof RESERVED_FIELDS)[number]]?: never;
10
10
  };
11
11
  type OmitReservedFields<T> = Omit<T, keyof ReservedFields>;
12
+ type Errors = Record<string, string>;
12
13
  export interface CreateFormProps<FormData> {
14
+ /**
15
+ * Should resolve to void, or resolve to an object of
16
+ * keys (field names) with error messages (key values)
17
+ */
18
+ onSubmit: (data: OmitReservedFields<FormData>) => void | Errors | Promise<void | Errors>;
19
+ /**
20
+ * Children to render in the form (form fields)
21
+ */
13
22
  children: ReactNode;
23
+ /**
24
+ * Test id to render on the form element
25
+ */
14
26
  testId?: string;
15
- onSubmit: (data: OmitReservedFields<FormData>) => void;
27
+ /**
28
+ * Callback when the cancel button is fired
29
+ */
16
30
  onCancel?: () => void;
31
+ /**
32
+ * Renders a spinner when true
33
+ */
17
34
  isLoading?: boolean;
18
35
  /**
19
36
  * Hides the rendering of the footer buttons
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ genericErrorMessage: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
8
+ export default _default;
@@ -70,7 +70,7 @@ export type CreatePayload = {
70
70
  * https://stash.atlassian.com/projects/JIRACLOUD/repos/jira-frontend/browse/src/packages/issue-create/issue-create-embed/src/ui/index.tsx
71
71
  * https://stash.atlassian.com/projects/JIRACLOUD/repos/jira-frontend/pull-requests/103587/overview?commentId=5778323
72
72
  */
73
- ari: string | undefined;
73
+ ari?: string | undefined;
74
74
  /** The object identifier for the resource created by the create plugin (for analytics) */
75
75
  objectId: string;
76
76
  /** The type of object created (for analytics) */
@@ -1,9 +1,4 @@
1
1
  declare const _default: {
2
- heading: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
2
  description: {
8
3
  id: string;
9
4
  defaultMessage: string;
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::be704bbbca0e49c927d1268b9a0f1d6a>>
6
+ * @codegen <<SignedSource::20562f2db603daab7d5b7a5c5ba1c04b>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
8
8
  */
9
9
  export type PackageMetaDataType = {
10
10
  packageName: string;
11
11
  packageVersion: string;
12
- source: 'linkCreate';
12
+ component: 'linkCreate';
13
13
  componentName: 'linkCreate';
14
14
  };
15
15
  export type LinkCreateAnalyticsContextType = {
@@ -38,6 +38,14 @@ export type ObjectCreatedLinkCreateAttributesType = {
38
38
  export type ObjectCreateFailedLinkCreateAttributesType = {
39
39
  failureType: string;
40
40
  };
41
+ export type OperationFailedLinkCreateAttributesType = {
42
+ errorType: string | null;
43
+ experienceStatus: 'SUCCEEDED' | 'FAILED';
44
+ previousExperienceStatus: 'STARTED' | 'SUCCEEDED' | 'FAILED';
45
+ path: string | null;
46
+ status: number | null;
47
+ traceId: string | null;
48
+ };
41
49
  export type AnalyticsEventAttributes = {
42
50
  'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
43
51
  'screen.linkCreateEditScreen.viewed': LinkCreateEditScreenViewedAttributesType;
@@ -51,6 +59,7 @@ export type AnalyticsEventAttributes = {
51
59
  'operational.linkCreate.unhandledErrorCaught': LinkCreateUnhandledErrorCaughtAttributesType;
52
60
  'track.object.created.linkCreate': ObjectCreatedLinkCreateAttributesType;
53
61
  'track.object.createFailed.linkCreate': ObjectCreateFailedLinkCreateAttributesType;
62
+ 'operational.operation.failed.linkCreate': OperationFailedLinkCreateAttributesType;
54
63
  };
55
64
  declare function createEventPayload<K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]): {
56
65
  eventType: string;
@@ -0,0 +1,10 @@
1
+ export declare const getNetworkFields: (error: unknown) => {
2
+ traceId: string | null;
3
+ status: number;
4
+ path: string;
5
+ } | {
6
+ traceId: null;
7
+ status: null;
8
+ path: null;
9
+ };
10
+ export declare const getErrorType: (error: unknown) => string;
@@ -8,7 +8,7 @@ interface LinkCreateCallbackProviderProps {
8
8
  /**
9
9
  * This callback for any errors
10
10
  */
11
- onFailure?: (error: Error) => void;
11
+ onFailure?: (error: unknown) => void;
12
12
  /**
13
13
  * This callback for when the form was manually discarded by user
14
14
  */
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export type ExperienceProps = {
3
+ children: React.ReactNode;
4
+ };
5
+ type ExperienceContextValue = {
6
+ /**
7
+ * Mark the experience as successful.
8
+ */
9
+ success: () => void;
10
+ /**
11
+ * Mark the experience as failed.
12
+ * Sends an analytics event to track experience as failed.
13
+ */
14
+ failure: (error: unknown) => void;
15
+ };
16
+ /**
17
+ * Experience provider that simply keeps track of the state of the experience.
18
+ * Fires an operational event when experience state changes to FAILED.
19
+ */
20
+ export declare const Experience: ({ children }: ExperienceProps) => JSX.Element;
21
+ export declare const useExperience: () => ExperienceContextValue;
22
+ export {};
@@ -1,3 +1,4 @@
1
+ export { FORM_ERROR } from 'final-form';
1
2
  export type { CreateFormProps } from './ui/index';
2
3
  export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, EditViewProps, } from './common/types';
3
4
  export { default, TextField, CreateForm, Select, AsyncSelect, CreateFormLoader, FormSpy, } from './ui/index';
@@ -8,4 +8,4 @@ export declare const TEST_ID = "link-create-async-select";
8
8
  * errors returned by the handleSubmit function passed to the form <Form> that
9
9
  * have a key matching the `name` of this field are shown below the field.
10
10
  */
11
- export declare function AsyncSelect<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;
11
+ export declare function AsyncSelect<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions: loadOptionsFn, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  export declare const messages: {
2
- edit: {
2
+ createAndOpen: {
3
3
  id: string;
4
4
  defaultMessage: string;
5
5
  description: string;
@@ -11,11 +11,28 @@ type DisallowReservedFields<T> = T & {
11
11
  [Field in (typeof RESERVED_FIELDS)[number]]?: never;
12
12
  };
13
13
  type OmitReservedFields<T> = Omit<T, keyof ReservedFields>;
14
+ type Errors = Record<string, string>;
14
15
  export interface CreateFormProps<FormData> {
16
+ /**
17
+ * Should resolve to void, or resolve to an object of
18
+ * keys (field names) with error messages (key values)
19
+ */
20
+ onSubmit: (data: OmitReservedFields<FormData>) => void | Errors | Promise<void | Errors>;
21
+ /**
22
+ * Children to render in the form (form fields)
23
+ */
15
24
  children: ReactNode;
25
+ /**
26
+ * Test id to render on the form element
27
+ */
16
28
  testId?: string;
17
- onSubmit: (data: OmitReservedFields<FormData>) => void;
29
+ /**
30
+ * Callback when the cancel button is fired
31
+ */
18
32
  onCancel?: () => void;
33
+ /**
34
+ * Renders a spinner when true
35
+ */
19
36
  isLoading?: boolean;
20
37
  /**
21
38
  * Hides the rendering of the footer buttons
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "1.9.5",
3
+ "version": "1.11.0",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,14 +40,14 @@
40
40
  "@atlaskit/form": "^9.0.0",
41
41
  "@atlaskit/icon": "^22.0.0",
42
42
  "@atlaskit/intl-messages-provider": "^1.0.0",
43
- "@atlaskit/linking-common": "^4.18.0",
44
- "@atlaskit/modal-dialog": "^12.8.0",
43
+ "@atlaskit/linking-common": "^4.21.0",
44
+ "@atlaskit/modal-dialog": "^12.9.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.2.1",
46
- "@atlaskit/primitives": "^1.11.0",
46
+ "@atlaskit/primitives": "^1.12.0",
47
47
  "@atlaskit/select": "^17.0.0",
48
48
  "@atlaskit/spinner": "^16.0.0",
49
49
  "@atlaskit/textfield": "^6.0.0",
50
- "@atlaskit/tokens": "^1.28.0",
50
+ "@atlaskit/tokens": "^1.29.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@emotion/react": "^11.7.1",
53
53
  "debounce-promise": "^3.1.2",
@@ -59,6 +59,7 @@
59
59
  "react-intl-next": "npm:react-intl@^5.18.1"
60
60
  },
61
61
  "devDependencies": {
62
+ "@af/integration-testing": "*",
62
63
  "@af/visual-regression": "*",
63
64
  "@atlaskit/link-test-helpers": "^6.2.0",
64
65
  "@atlaskit/visual-regression": "*",
@@ -121,6 +122,9 @@
121
122
  },
122
123
  "platform.linking-platform.link-create.enable-sentry-client": {
123
124
  "type": "boolean"
125
+ },
126
+ "platform.linking-platform.link-create.better-observability": {
127
+ "type": "boolean"
124
128
  }
125
129
  }
126
130
  }
package/report.api.md CHANGED
@@ -18,6 +18,7 @@
18
18
  /// <reference types="react" />
19
19
 
20
20
  import { AsyncSelectProps as AsyncSelectProps_2 } from '@atlaskit/select';
21
+ import { FORM_ERROR } from 'final-form';
21
22
  import { GroupType } from '@atlaskit/select';
22
23
  import { jsx } from '@emotion/react';
23
24
  import { MemoExoticComponent } from 'react';
@@ -39,7 +40,7 @@ export function AsyncSelect<T = OptionType>({
39
40
  validationHelpText,
40
41
  testId,
41
42
  defaultOption: propsDefaultValue,
42
- loadOptions,
43
+ loadOptions: loadOptionsFn,
43
44
  ...restProps
44
45
  }: AsyncSelectProps<T>): jsx.JSX.Element;
45
46
 
@@ -81,24 +82,21 @@ export function CreateFormLoader({
81
82
 
82
83
  // @public (undocumented)
83
84
  export interface CreateFormProps<FormData> {
84
- // (undocumented)
85
85
  children: ReactNode;
86
86
  hideFooter?: boolean;
87
87
  initialValues?: DisallowReservedFields<FormData>;
88
- // (undocumented)
89
88
  isLoading?: boolean;
90
- // (undocumented)
91
89
  onCancel?: () => void;
92
- // (undocumented)
93
- onSubmit: (data: OmitReservedFields<FormData>) => void;
94
- // (undocumented)
90
+ onSubmit: (
91
+ data: OmitReservedFields<FormData>,
92
+ ) => Errors | Promise<Errors | void> | void;
95
93
  testId?: string;
96
94
  }
97
95
 
98
96
  // @public
99
97
  export type CreatePayload = {
100
98
  url: string;
101
- ari: string | undefined;
99
+ ari?: string | undefined;
102
100
  objectId: string;
103
101
  objectType: string;
104
102
  data?: Record<string, unknown>;
@@ -115,6 +113,11 @@ export type EditViewProps = {
115
113
  onClose: () => void;
116
114
  };
117
115
 
116
+ // @public (undocumented)
117
+ type Errors = Record<string, string>;
118
+
119
+ export { FORM_ERROR };
120
+
118
121
  // @public
119
122
  export const FormSpy: <T extends Record<string, unknown>>({
120
123
  children,
@@ -139,7 +142,7 @@ export const LinkCreateCallbackProvider: React_2.FC<LinkCreateCallbackProviderPr
139
142
  interface LinkCreateCallbackProviderProps {
140
143
  onCancel?: () => void;
141
144
  onCreate?: (result: CreatePayload) => Promise<void> | void;
142
- onFailure?: (error: Error) => void;
145
+ onFailure?: (error: unknown) => void;
143
146
  }
144
147
 
145
148
  // @public (undocumented)
@@ -7,6 +7,7 @@
7
7
  /// <reference types="react" />
8
8
 
9
9
  import { AsyncSelectProps as AsyncSelectProps_2 } from '@atlaskit/select';
10
+ import { FORM_ERROR } from 'final-form';
10
11
  import { GroupType } from '@atlaskit/select';
11
12
  import { jsx } from '@emotion/react';
12
13
  import { MemoExoticComponent } from 'react';
@@ -19,7 +20,7 @@ import { SpinnerProps } from '@atlaskit/spinner';
19
20
  import { TextFieldProps as TextFieldProps_2 } from '@atlaskit/textfield';
20
21
 
21
22
  // @public
22
- export function AsyncSelect<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;
23
+ export function AsyncSelect<T = OptionType>({ id, name, label, isRequired, validators, validationHelpText, testId, defaultOption: propsDefaultValue, loadOptions: loadOptionsFn, ...restProps }: AsyncSelectProps<T>): jsx.JSX.Element;
23
24
 
24
25
  // @public (undocumented)
25
26
  type AsyncSelectProps<T = OptionType> = Omit<AsyncSelectProps_2<T>, 'loadOptions'> & {
@@ -44,24 +45,19 @@ export function CreateFormLoader({ size }: Partial<SpinnerProps>): jsx.JSX.Eleme
44
45
 
45
46
  // @public (undocumented)
46
47
  export interface CreateFormProps<FormData> {
47
- // (undocumented)
48
48
  children: ReactNode;
49
49
  hideFooter?: boolean;
50
50
  initialValues?: DisallowReservedFields<FormData>;
51
- // (undocumented)
52
51
  isLoading?: boolean;
53
- // (undocumented)
54
52
  onCancel?: () => void;
55
- // (undocumented)
56
- onSubmit: (data: OmitReservedFields<FormData>) => void;
57
- // (undocumented)
53
+ onSubmit: (data: OmitReservedFields<FormData>) => Errors | Promise<Errors | void> | void;
58
54
  testId?: string;
59
55
  }
60
56
 
61
57
  // @public
62
58
  export type CreatePayload = {
63
59
  url: string;
64
- ari: string | undefined;
60
+ ari?: string | undefined;
65
61
  objectId: string;
66
62
  objectType: string;
67
63
  data?: Record<string, unknown>;
@@ -78,6 +74,11 @@ export type EditViewProps = {
78
74
  onClose: () => void;
79
75
  };
80
76
 
77
+ // @public (undocumented)
78
+ type Errors = Record<string, string>;
79
+
80
+ export { FORM_ERROR }
81
+
81
82
  // @public
82
83
  export const FormSpy: <T extends Record<string, unknown>>({ children, }: FormSpyProps<T>) => JSX.Element;
83
84
 
@@ -102,7 +103,7 @@ export const LinkCreateCallbackProvider: React_2.FC<LinkCreateCallbackProviderPr
102
103
  interface LinkCreateCallbackProviderProps {
103
104
  onCancel?: () => void;
104
105
  onCreate?: (result: CreatePayload) => Promise<void> | void;
105
- onFailure?: (error: Error) => void;
106
+ onFailure?: (error: unknown) => void;
106
107
  }
107
108
 
108
109
  // @public (undocumented)