@atlaskit/link-create 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-create
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`41d73aab05c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41d73aab05c) - EDM-6938: pass spaceName into onCreate submit for confluence-create and pass as optional meta data into link-create."
8
+
3
9
  ## 0.7.0
4
10
 
5
11
  ### Minor Changes
@@ -55,7 +55,7 @@ var LinkCreate = (0, _formContext.withLinkCreateFormContext)(function (_ref2) {
55
55
  break;
56
56
  }
57
57
  _context.next = 4;
58
- return onCreate(result.url);
58
+ return onCreate(result);
59
59
  case 4:
60
60
  case "end":
61
61
  return _context.stop();
@@ -74,9 +74,9 @@ var LinkCreate = (0, _formContext.withLinkCreateFormContext)(function (_ref2) {
74
74
  return (0, _react2.jsx)("div", {
75
75
  "data-testid": testId
76
76
  }, (0, _react2.jsx)(_errorBoundary.ErrorBoundary, null, (0, _react2.jsx)(_callbackContext.LinkCreateCallbackProvider, {
77
+ onCancel: onCancel,
77
78
  onCreate: handleCreate,
78
- onFailure: handleFailure,
79
- onCancel: onCancel
79
+ onFailure: handleFailure
80
80
  }, (0, _react2.jsx)(_trackMount.default, null), (0, _react2.jsx)(LinkCreateContent, restProps))));
81
81
  });
82
82
  var LinkCreateWithModal = function LinkCreateWithModal(_ref4) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "sideEffects": false
5
5
  }
@@ -33,7 +33,7 @@ const LinkCreate = withLinkCreateFormContext(({
33
33
  // Reset the form error message
34
34
  setFormErrorMessage(undefined);
35
35
  if (onCreate) {
36
- await onCreate(result.url);
36
+ await onCreate(result);
37
37
  }
38
38
  }, [onCreate, setFormErrorMessage]);
39
39
  const handleFailure = useCallback(errorMessage => {
@@ -44,9 +44,9 @@ const LinkCreate = withLinkCreateFormContext(({
44
44
  return jsx("div", {
45
45
  "data-testid": testId
46
46
  }, jsx(ErrorBoundary, null, jsx(LinkCreateCallbackProvider, {
47
+ onCancel: onCancel,
47
48
  onCreate: handleCreate,
48
- onFailure: handleFailure,
49
- onCancel: onCancel
49
+ onFailure: handleFailure
50
50
  }, jsx(TrackMount, null), jsx(LinkCreateContent, restProps))));
51
51
  });
52
52
  const LinkCreateWithModal = ({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "sideEffects": false
5
5
  }
@@ -45,7 +45,7 @@ var LinkCreate = withLinkCreateFormContext(function (_ref2) {
45
45
  break;
46
46
  }
47
47
  _context.next = 4;
48
- return onCreate(result.url);
48
+ return onCreate(result);
49
49
  case 4:
50
50
  case "end":
51
51
  return _context.stop();
@@ -64,9 +64,9 @@ var LinkCreate = withLinkCreateFormContext(function (_ref2) {
64
64
  return jsx("div", {
65
65
  "data-testid": testId
66
66
  }, jsx(ErrorBoundary, null, jsx(LinkCreateCallbackProvider, {
67
+ onCancel: onCancel,
67
68
  onCreate: handleCreate,
68
- onFailure: handleFailure,
69
- onCancel: onCancel
69
+ onFailure: handleFailure
70
70
  }, jsx(TrackMount, null), jsx(LinkCreateContent, restProps))));
71
71
  });
72
72
  var LinkCreateWithModal = function LinkCreateWithModal(_ref4) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "sideEffects": false
5
5
  }
@@ -44,6 +44,17 @@ export interface LinkCreatePlugin {
44
44
  */
45
45
  form: ReactNode;
46
46
  }
47
+ /** The object that is returned on successful callback of create function*/
48
+ export type CreatePayload = {
49
+ /** The url to the resource created by the create plugin */
50
+ url: string;
51
+ /** The object identifier for the resource created by the create plugin (for analytics) */
52
+ objectId: string;
53
+ /** The type of object created (for analytics) */
54
+ objectType: string;
55
+ /** The raw object returned from the create plugin */
56
+ data?: Record<string, unknown>;
57
+ };
47
58
  export interface LinkCreateProps {
48
59
  /**
49
60
  * A `testId` prop is provided for specified elements, which is a unique
@@ -66,7 +77,7 @@ export interface LinkCreateProps {
66
77
  /**
67
78
  * This callback for when the resource has been successfully created.
68
79
  */
69
- onCreate?: (url: string) => Promise<void> | void;
80
+ onCreate?: (payload: CreatePayload) => Promise<void> | void;
70
81
  /**
71
82
  * This callback for any errors
72
83
  */
@@ -1,13 +1,10 @@
1
1
  import React from 'react';
2
+ import { CreatePayload } from '../../common/types';
2
3
  interface LinkCreateCallbackProviderProps {
3
4
  /**
4
5
  * This callback for when the resource has been successfully created.
5
6
  */
6
- onCreate?: (result: {
7
- url: string;
8
- objectId: string;
9
- objectType: string;
10
- }) => Promise<void> | void;
7
+ onCreate?: (result: CreatePayload) => Promise<void> | void;
11
8
  /**
12
9
  * This callback for any errors
13
10
  */
@@ -1,5 +1,5 @@
1
1
  export type { CreateFormProps } from './ui/index';
2
- export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, } from './common/types';
2
+ export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, } from './common/types';
3
3
  export { default, TextField, CreateForm, AsyncSelect, CreateFormLoader, } from './ui/index';
4
4
  export { useLinkCreateCallback, LinkCreateCallbackProvider, } from './controllers/callback-context';
5
5
  export { FormContextProvider, useFormContext, } from './controllers/form-context';
@@ -44,6 +44,17 @@ export interface LinkCreatePlugin {
44
44
  */
45
45
  form: ReactNode;
46
46
  }
47
+ /** The object that is returned on successful callback of create function*/
48
+ export type CreatePayload = {
49
+ /** The url to the resource created by the create plugin */
50
+ url: string;
51
+ /** The object identifier for the resource created by the create plugin (for analytics) */
52
+ objectId: string;
53
+ /** The type of object created (for analytics) */
54
+ objectType: string;
55
+ /** The raw object returned from the create plugin */
56
+ data?: Record<string, unknown>;
57
+ };
47
58
  export interface LinkCreateProps {
48
59
  /**
49
60
  * A `testId` prop is provided for specified elements, which is a unique
@@ -66,7 +77,7 @@ export interface LinkCreateProps {
66
77
  /**
67
78
  * This callback for when the resource has been successfully created.
68
79
  */
69
- onCreate?: (url: string) => Promise<void> | void;
80
+ onCreate?: (payload: CreatePayload) => Promise<void> | void;
70
81
  /**
71
82
  * This callback for any errors
72
83
  */
@@ -1,13 +1,10 @@
1
1
  import React from 'react';
2
+ import { CreatePayload } from '../../common/types';
2
3
  interface LinkCreateCallbackProviderProps {
3
4
  /**
4
5
  * This callback for when the resource has been successfully created.
5
6
  */
6
- onCreate?: (result: {
7
- url: string;
8
- objectId: string;
9
- objectType: string;
10
- }) => Promise<void> | void;
7
+ onCreate?: (result: CreatePayload) => Promise<void> | void;
11
8
  /**
12
9
  * This callback for any errors
13
10
  */
@@ -1,5 +1,5 @@
1
1
  export type { CreateFormProps } from './ui/index';
2
- export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, } from './common/types';
2
+ export type { LinkCreateProps, LinkCreatePlugin, LinkCreateWithModalProps, CreatePayload, } from './common/types';
3
3
  export { default, TextField, CreateForm, AsyncSelect, CreateFormLoader, } from './ui/index';
4
4
  export { useLinkCreateCallback, LinkCreateCallbackProvider, } from './controllers/callback-context';
5
5
  export { FormContextProvider, useFormContext, } from './controllers/form-context';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,15 +35,15 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@atlaskit/analytics-next": "^9.1.0",
38
- "@atlaskit/button": "^16.7.0",
39
- "@atlaskit/empty-state": "^7.5.0",
38
+ "@atlaskit/button": "^16.8.0",
39
+ "@atlaskit/empty-state": "^7.6.0",
40
40
  "@atlaskit/form": "^8.11.0",
41
41
  "@atlaskit/icon": "^21.12.0",
42
42
  "@atlaskit/modal-dialog": "^12.6.0",
43
43
  "@atlaskit/select": "^16.5.0",
44
44
  "@atlaskit/spinner": "^15.4.0",
45
45
  "@atlaskit/textfield": "^5.5.0",
46
- "@atlaskit/tokens": "^1.5.0",
46
+ "@atlaskit/tokens": "^1.9.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@emotion/react": "^11.7.1"
49
49
  },
@@ -53,14 +53,14 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@atlaskit/docs": "*",
56
- "@atlaskit/link-picker": "^1.24.0",
56
+ "@atlaskit/link-picker": "^1.25.0",
57
57
  "@atlaskit/link-test-helpers": "^4.0.0",
58
- "@atlaskit/popup": "^1.6.0",
58
+ "@atlaskit/popup": "^1.7.0",
59
59
  "@atlaskit/visual-regression": "*",
60
60
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
61
61
  "@atlassian/link-create-confluence": "^8.0.0",
62
62
  "@atlassian/link-create-presets": "^6.0.0",
63
- "@atlassian/link-picker-atlassian-plugin": "^33.3.0",
63
+ "@atlassian/link-picker-atlassian-plugin": "^34.0.0",
64
64
  "@testing-library/react": "^12.1.5",
65
65
  "@testing-library/user-event": "^14.4.3",
66
66
  "fetch-mock": "^8.0.0",
package/report.api.md CHANGED
@@ -86,6 +86,14 @@ export interface CreateFormProps<FormData> {
86
86
  testId?: string;
87
87
  }
88
88
 
89
+ // @public
90
+ export type CreatePayload = {
91
+ url: string;
92
+ objectId: string;
93
+ objectType: string;
94
+ data?: Record<string, unknown>;
95
+ };
96
+
89
97
  // @public (undocumented)
90
98
  export const FormContextProvider: React_2.FC<{}>;
91
99
 
@@ -114,11 +122,7 @@ export const LinkCreateCallbackProvider: React_2.FC<LinkCreateCallbackProviderPr
114
122
  // @public (undocumented)
115
123
  interface LinkCreateCallbackProviderProps {
116
124
  onCancel?: () => void;
117
- onCreate?: (result: {
118
- url: string;
119
- objectId: string;
120
- objectType: string;
121
- }) => Promise<void> | void;
125
+ onCreate?: (result: CreatePayload) => Promise<void> | void;
122
126
  onFailure?: (errorMessage: string) => void;
123
127
  }
124
128
 
@@ -136,7 +140,7 @@ export interface LinkCreateProps {
136
140
  entityKey: string;
137
141
  groupKey?: string;
138
142
  onCancel?: () => void;
139
- onCreate?: (url: string) => Promise<void> | void;
143
+ onCreate?: (payload: CreatePayload) => Promise<void> | void;
140
144
  onFailure?: (error: unknown) => void;
141
145
  // (undocumented)
142
146
  plugins: LinkCreatePlugin[];
@@ -55,6 +55,14 @@ export interface CreateFormProps<FormData> {
55
55
  testId?: string;
56
56
  }
57
57
 
58
+ // @public
59
+ export type CreatePayload = {
60
+ url: string;
61
+ objectId: string;
62
+ objectType: string;
63
+ data?: Record<string, unknown>;
64
+ };
65
+
58
66
  // @public (undocumented)
59
67
  export const FormContextProvider: React_2.FC<{}>;
60
68
 
@@ -83,11 +91,7 @@ export const LinkCreateCallbackProvider: React_2.FC<LinkCreateCallbackProviderPr
83
91
  // @public (undocumented)
84
92
  interface LinkCreateCallbackProviderProps {
85
93
  onCancel?: () => void;
86
- onCreate?: (result: {
87
- url: string;
88
- objectId: string;
89
- objectType: string;
90
- }) => Promise<void> | void;
94
+ onCreate?: (result: CreatePayload) => Promise<void> | void;
91
95
  onFailure?: (errorMessage: string) => void;
92
96
  }
93
97
 
@@ -105,7 +109,7 @@ export interface LinkCreateProps {
105
109
  entityKey: string;
106
110
  groupKey?: string;
107
111
  onCancel?: () => void;
108
- onCreate?: (url: string) => Promise<void> | void;
112
+ onCreate?: (payload: CreatePayload) => Promise<void> | void;
109
113
  onFailure?: (error: unknown) => void;
110
114
  // (undocumented)
111
115
  plugins: LinkCreatePlugin[];