@atlaskit/link-picker 1.9.4 → 1.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7dbc77d866a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7dbc77d866a) - Adds support for plugins providing metadata about resolved links.
8
+
3
9
  ## 1.9.4
4
10
 
5
11
  ### Patch Changes
@@ -10,7 +10,7 @@ exports.default = void 0;
10
10
  *
11
11
  * Generates analytics utilities from the package analytics spec yaml
12
12
  *
13
- * @codegen <<SignedSource::3c46f1d8f463b6898a7a0e1e1f4676b4>>
13
+ * @codegen <<SignedSource::e8a730530bb93e19d0b85114da0581c8>>
14
14
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
15
15
  */
16
16
  function createEventPayload(eventKey, attributes) {
@@ -36,6 +36,7 @@ var DEFAULT_CONTEXT_ATTRIBUTES = {
36
36
  linkState: 'newLink',
37
37
  linkFieldContent: null,
38
38
  linkFieldContentInputMethod: null,
39
+ linkFieldContentInputSource: null,
39
40
  displayTextFieldContent: null,
40
41
  displayTextFieldContentInputMethod: null
41
42
  };
@@ -144,6 +144,7 @@ function usePlugins(state, activeTab, plugins) {
144
144
  tabs: tabs,
145
145
  items: items,
146
146
  isLoading: isLoading,
147
+ activePlugin: activePlugin,
147
148
  isActivePlugin: !!activePlugin,
148
149
  error: error,
149
150
  retry: handleRetry,
@@ -61,6 +61,8 @@ var _linkSearchError = _interopRequireWildcard(require("./link-search-error"));
61
61
 
62
62
  var _formFooter = _interopRequireWildcard(require("./form-footer"));
63
63
 
64
+ var _utils = require("./utils");
65
+
64
66
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
65
67
 
66
68
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -160,6 +162,7 @@ function LinkPicker(_ref) {
160
162
  items = _usePlugins.items,
161
163
  isLoading = _usePlugins.isLoading,
162
164
  isActivePlugin = _usePlugins.isActivePlugin,
165
+ activePlugin = _usePlugins.activePlugin,
163
166
  tabs = _usePlugins.tabs,
164
167
  error = _usePlugins.error,
165
168
  retry = _usePlugins.retry,
@@ -190,10 +193,12 @@ function LinkPicker(_ref) {
190
193
  }
191
194
  }, [onContentResize, items, isLoading, isActivePlugin, tabs]);
192
195
  var handleChangeUrl = (0, _react.useCallback)(function (e) {
196
+ /** Any on change event is triggered by manual input or paste, so source is null */
197
+ trackAttribute('linkFieldContentInputSource', null);
193
198
  dispatch({
194
199
  url: e.currentTarget.value
195
200
  });
196
- }, []);
201
+ }, [trackAttribute]);
197
202
  var handleChangeText = (0, _react.useCallback)(function (e) {
198
203
  dispatch({
199
204
  displayText: e.currentTarget.value
@@ -224,23 +229,30 @@ function LinkPicker(_ref) {
224
229
  break;
225
230
  }
226
231
 
227
- if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && items[updatedIndex]) {
232
+ var item = items[updatedIndex];
233
+
234
+ if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && item) {
228
235
  /**
229
236
  * Manually track that the url has been updated using searchResult method
230
237
  */
231
- trackAttribute('linkFieldContent', getLinkFieldContent(items[updatedIndex].url));
238
+ trackAttribute('linkFieldContent', getLinkFieldContent(item.url));
232
239
  trackAttribute('linkFieldContentInputMethod', 'searchResult');
240
+ trackAttribute('linkFieldContentInputSource', (0, _utils.getDataSource)(item, activePlugin));
233
241
  dispatch({
234
242
  activeIndex: updatedIndex,
235
243
  selectedIndex: updatedIndex,
236
- url: items[updatedIndex].url,
244
+ url: item.url,
237
245
  invalidUrl: false
238
246
  });
239
247
  }
240
- }, [activeIndex, items, trackAttribute]);
248
+ }, [activeIndex, items, trackAttribute, activePlugin]);
241
249
  var handleClear = (0, _react.useCallback)(function (field) {
242
250
  dispatch((0, _defineProperty2.default)({}, field, ''));
243
251
  }, []);
252
+ var handleUrlClear = (0, _react.useCallback)(function () {
253
+ trackAttribute('linkFieldContentInputSource', null);
254
+ handleClear('url');
255
+ }, [trackAttribute, handleClear]);
244
256
  var handleMouseEnterResultItem = (0, _react.useCallback)(function (objectId) {
245
257
  var index = items === null || items === void 0 ? void 0 : items.findIndex(function (item) {
246
258
  return item.objectId === objectId;
@@ -291,16 +303,17 @@ function LinkPicker(_ref) {
291
303
  if (selectedItem) {
292
304
  var _url = selectedItem.url,
293
305
  name = selectedItem.name;
294
- dispatchEvent(new Event('submit'));
295
306
  /**
296
307
  * Manually track that the url has been updated using searchResult method
297
308
  */
298
309
 
310
+ dispatchEvent(new Event('submit'));
299
311
  trackAttribute('linkFieldContent', getLinkFieldContent(_url));
300
312
  trackAttribute('linkFieldContentInputMethod', 'searchResult');
313
+ trackAttribute('linkFieldContentInputSource', (0, _utils.getDataSource)(selectedItem, activePlugin));
301
314
  handleInsert(_url, name, 'typeAhead');
302
315
  }
303
- }, [handleInsert, trackAttribute, items]);
316
+ }, [handleInsert, trackAttribute, items, activePlugin]);
304
317
  var handleSubmit = (0, _react.useCallback)(function (event) {
305
318
  event.preventDefault();
306
319
 
@@ -361,7 +374,7 @@ function LinkPicker(_ref) {
361
374
  "aria-activedescendant": ariaActiveDescendant,
362
375
  "aria-describedby": screenReaderDescriptionId,
363
376
  error: invalidUrl ? intl.formatMessage(_messages.messages.linkInvalid) : null,
364
- onClear: handleClear,
377
+ onClear: handleUrlClear,
365
378
  onKeyDown: handleKeyDown,
366
379
  onChange: handleChangeUrl
367
380
  }), (0, _react2.jsx)(DisplayTextInputField, {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isUndoEvent = exports.isRedoEvent = void 0;
6
+ exports.isUndoEvent = exports.isRedoEvent = exports.getDataSource = void 0;
7
7
 
8
8
  var _browser = require("./browser");
9
9
 
@@ -23,5 +23,17 @@ var isRedoEvent = function isRedoEvent(e) {
23
23
  !_browser.browser.mac && e.ctrlKey && e.keyCode === KeyYCode || _browser.browser.mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
24
24
  );
25
25
  };
26
+ /**
27
+ * Retrieve the data source for a link given the item and the plugin that resolved it
28
+ */
26
29
 
27
- exports.isRedoEvent = isRedoEvent;
30
+
31
+ exports.isRedoEvent = isRedoEvent;
32
+
33
+ var getDataSource = function getDataSource(item, plugin) {
34
+ var _ref, _item$meta$source, _item$meta, _plugin$meta;
35
+
36
+ return (_ref = (_item$meta$source = (_item$meta = item.meta) === null || _item$meta === void 0 ? void 0 : _item$meta.source) !== null && _item$meta$source !== void 0 ? _item$meta$source : plugin === null || plugin === void 0 ? void 0 : (_plugin$meta = plugin.meta) === null || _plugin$meta === void 0 ? void 0 : _plugin$meta.source) !== null && _ref !== void 0 ? _ref : 'unknown';
37
+ };
38
+
39
+ exports.getDataSource = getDataSource;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates analytics utilities from the package analytics spec yaml
5
5
  *
6
- * @codegen <<SignedSource::3c46f1d8f463b6898a7a0e1e1f4676b4>>
6
+ * @codegen <<SignedSource::e8a730530bb93e19d0b85114da0581c8>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  function createEventPayload(eventKey, attributes) {
@@ -7,6 +7,7 @@ const DEFAULT_CONTEXT_ATTRIBUTES = {
7
7
  linkState: 'newLink',
8
8
  linkFieldContent: null,
9
9
  linkFieldContentInputMethod: null,
10
+ linkFieldContentInputSource: null,
10
11
  displayTextFieldContent: null,
11
12
  displayTextFieldContentInputMethod: null
12
13
  };
@@ -78,6 +78,7 @@ export function usePlugins(state, activeTab, plugins) {
78
78
  tabs,
79
79
  items,
80
80
  isLoading,
81
+ activePlugin,
81
82
  isActivePlugin: !!activePlugin,
82
83
  error,
83
84
  retry: handleRetry,
@@ -24,6 +24,7 @@ import { transformTimeStamp } from './transformTimeStamp';
24
24
  import LinkSearchList, { testIds as listTestIds } from './link-search-list';
25
25
  import LinkSearchError, { testIds as searchErrorTestIds } from './link-search-error';
26
26
  import FormFooter, { testIds as formFooterTestIds } from './form-footer';
27
+ import { getDataSource } from './utils';
27
28
  export const RECENT_SEARCH_LIST_SIZE = 5;
28
29
  export const CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
29
30
  export const testIds = {
@@ -110,6 +111,7 @@ function LinkPicker({
110
111
  items,
111
112
  isLoading,
112
113
  isActivePlugin,
114
+ activePlugin,
113
115
  tabs,
114
116
  error,
115
117
  retry,
@@ -139,10 +141,12 @@ function LinkPicker({
139
141
  }
140
142
  }, [onContentResize, items, isLoading, isActivePlugin, tabs]);
141
143
  const handleChangeUrl = useCallback(e => {
144
+ /** Any on change event is triggered by manual input or paste, so source is null */
145
+ trackAttribute('linkFieldContentInputSource', null);
142
146
  dispatch({
143
147
  url: e.currentTarget.value
144
148
  });
145
- }, []);
149
+ }, [trackAttribute]);
146
150
  const handleChangeText = useCallback(e => {
147
151
  dispatch({
148
152
  displayText: e.currentTarget.value
@@ -175,25 +179,32 @@ function LinkPicker({
175
179
  break;
176
180
  }
177
181
 
178
- if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && items[updatedIndex]) {
182
+ const item = items[updatedIndex];
183
+
184
+ if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && item) {
179
185
  /**
180
186
  * Manually track that the url has been updated using searchResult method
181
187
  */
182
- trackAttribute('linkFieldContent', getLinkFieldContent(items[updatedIndex].url));
188
+ trackAttribute('linkFieldContent', getLinkFieldContent(item.url));
183
189
  trackAttribute('linkFieldContentInputMethod', 'searchResult');
190
+ trackAttribute('linkFieldContentInputSource', getDataSource(item, activePlugin));
184
191
  dispatch({
185
192
  activeIndex: updatedIndex,
186
193
  selectedIndex: updatedIndex,
187
- url: items[updatedIndex].url,
194
+ url: item.url,
188
195
  invalidUrl: false
189
196
  });
190
197
  }
191
- }, [activeIndex, items, trackAttribute]);
198
+ }, [activeIndex, items, trackAttribute, activePlugin]);
192
199
  const handleClear = useCallback(field => {
193
200
  dispatch({
194
201
  [field]: ''
195
202
  });
196
203
  }, []);
204
+ const handleUrlClear = useCallback(() => {
205
+ trackAttribute('linkFieldContentInputSource', null);
206
+ handleClear('url');
207
+ }, [trackAttribute, handleClear]);
197
208
  const handleMouseEnterResultItem = useCallback(objectId => {
198
209
  const index = items === null || items === void 0 ? void 0 : items.findIndex(item => item.objectId === objectId);
199
210
  dispatch({
@@ -241,16 +252,17 @@ function LinkPicker({
241
252
  url,
242
253
  name
243
254
  } = selectedItem;
244
- dispatchEvent(new Event('submit'));
245
255
  /**
246
256
  * Manually track that the url has been updated using searchResult method
247
257
  */
248
258
 
259
+ dispatchEvent(new Event('submit'));
249
260
  trackAttribute('linkFieldContent', getLinkFieldContent(url));
250
261
  trackAttribute('linkFieldContentInputMethod', 'searchResult');
262
+ trackAttribute('linkFieldContentInputSource', getDataSource(selectedItem, activePlugin));
251
263
  handleInsert(url, name, 'typeAhead');
252
264
  }
253
- }, [handleInsert, trackAttribute, items]);
265
+ }, [handleInsert, trackAttribute, items, activePlugin]);
254
266
  const handleSubmit = useCallback(event => {
255
267
  event.preventDefault();
256
268
 
@@ -311,7 +323,7 @@ function LinkPicker({
311
323
  "aria-activedescendant": ariaActiveDescendant,
312
324
  "aria-describedby": screenReaderDescriptionId,
313
325
  error: invalidUrl ? intl.formatMessage(messages.linkInvalid) : null,
314
- onClear: handleClear,
326
+ onClear: handleUrlClear,
315
327
  onKeyDown: handleKeyDown,
316
328
  onChange: handleChangeUrl
317
329
  }), jsx(DisplayTextInputField, {
@@ -10,4 +10,13 @@ export const isRedoEvent = e => {
10
10
  return (// ctrl + y for non-mac
11
11
  !browser.mac && e.ctrlKey && e.keyCode === KeyYCode || browser.mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
12
12
  );
13
+ };
14
+ /**
15
+ * Retrieve the data source for a link given the item and the plugin that resolved it
16
+ */
17
+
18
+ export const getDataSource = (item, plugin) => {
19
+ var _ref, _item$meta$source, _item$meta, _plugin$meta;
20
+
21
+ return (_ref = (_item$meta$source = (_item$meta = item.meta) === null || _item$meta === void 0 ? void 0 : _item$meta.source) !== null && _item$meta$source !== void 0 ? _item$meta$source : plugin === null || plugin === void 0 ? void 0 : (_plugin$meta = plugin.meta) === null || _plugin$meta === void 0 ? void 0 : _plugin$meta.source) !== null && _ref !== void 0 ? _ref : 'unknown';
13
22
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates analytics utilities from the package analytics spec yaml
5
5
  *
6
- * @codegen <<SignedSource::3c46f1d8f463b6898a7a0e1e1f4676b4>>
6
+ * @codegen <<SignedSource::e8a730530bb93e19d0b85114da0581c8>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  function createEventPayload(eventKey, attributes) {
@@ -14,6 +14,7 @@ var DEFAULT_CONTEXT_ATTRIBUTES = {
14
14
  linkState: 'newLink',
15
15
  linkFieldContent: null,
16
16
  linkFieldContentInputMethod: null,
17
+ linkFieldContentInputSource: null,
17
18
  displayTextFieldContent: null,
18
19
  displayTextFieldContentInputMethod: null
19
20
  };
@@ -128,6 +128,7 @@ export function usePlugins(state, activeTab, plugins) {
128
128
  tabs: tabs,
129
129
  items: items,
130
130
  isLoading: isLoading,
131
+ activePlugin: activePlugin,
131
132
  isActivePlugin: !!activePlugin,
132
133
  error: error,
133
134
  retry: handleRetry,
@@ -30,6 +30,7 @@ import { transformTimeStamp } from './transformTimeStamp';
30
30
  import LinkSearchList, { testIds as listTestIds } from './link-search-list';
31
31
  import LinkSearchError, { testIds as searchErrorTestIds } from './link-search-error';
32
32
  import FormFooter, { testIds as formFooterTestIds } from './form-footer';
33
+ import { getDataSource } from './utils';
33
34
  export var RECENT_SEARCH_LIST_SIZE = 5;
34
35
  export var CONTACT_SUPPORT_LINK = 'https://support.atlassian.com/contact/';
35
36
  export var testIds = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
@@ -116,6 +117,7 @@ function LinkPicker(_ref) {
116
117
  items = _usePlugins.items,
117
118
  isLoading = _usePlugins.isLoading,
118
119
  isActivePlugin = _usePlugins.isActivePlugin,
120
+ activePlugin = _usePlugins.activePlugin,
119
121
  tabs = _usePlugins.tabs,
120
122
  error = _usePlugins.error,
121
123
  retry = _usePlugins.retry,
@@ -146,10 +148,12 @@ function LinkPicker(_ref) {
146
148
  }
147
149
  }, [onContentResize, items, isLoading, isActivePlugin, tabs]);
148
150
  var handleChangeUrl = useCallback(function (e) {
151
+ /** Any on change event is triggered by manual input or paste, so source is null */
152
+ trackAttribute('linkFieldContentInputSource', null);
149
153
  dispatch({
150
154
  url: e.currentTarget.value
151
155
  });
152
- }, []);
156
+ }, [trackAttribute]);
153
157
  var handleChangeText = useCallback(function (e) {
154
158
  dispatch({
155
159
  displayText: e.currentTarget.value
@@ -180,23 +184,30 @@ function LinkPicker(_ref) {
180
184
  break;
181
185
  }
182
186
 
183
- if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && items[updatedIndex]) {
187
+ var item = items[updatedIndex];
188
+
189
+ if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && item) {
184
190
  /**
185
191
  * Manually track that the url has been updated using searchResult method
186
192
  */
187
- trackAttribute('linkFieldContent', getLinkFieldContent(items[updatedIndex].url));
193
+ trackAttribute('linkFieldContent', getLinkFieldContent(item.url));
188
194
  trackAttribute('linkFieldContentInputMethod', 'searchResult');
195
+ trackAttribute('linkFieldContentInputSource', getDataSource(item, activePlugin));
189
196
  dispatch({
190
197
  activeIndex: updatedIndex,
191
198
  selectedIndex: updatedIndex,
192
- url: items[updatedIndex].url,
199
+ url: item.url,
193
200
  invalidUrl: false
194
201
  });
195
202
  }
196
- }, [activeIndex, items, trackAttribute]);
203
+ }, [activeIndex, items, trackAttribute, activePlugin]);
197
204
  var handleClear = useCallback(function (field) {
198
205
  dispatch(_defineProperty({}, field, ''));
199
206
  }, []);
207
+ var handleUrlClear = useCallback(function () {
208
+ trackAttribute('linkFieldContentInputSource', null);
209
+ handleClear('url');
210
+ }, [trackAttribute, handleClear]);
200
211
  var handleMouseEnterResultItem = useCallback(function (objectId) {
201
212
  var index = items === null || items === void 0 ? void 0 : items.findIndex(function (item) {
202
213
  return item.objectId === objectId;
@@ -247,16 +258,17 @@ function LinkPicker(_ref) {
247
258
  if (selectedItem) {
248
259
  var _url = selectedItem.url,
249
260
  name = selectedItem.name;
250
- dispatchEvent(new Event('submit'));
251
261
  /**
252
262
  * Manually track that the url has been updated using searchResult method
253
263
  */
254
264
 
265
+ dispatchEvent(new Event('submit'));
255
266
  trackAttribute('linkFieldContent', getLinkFieldContent(_url));
256
267
  trackAttribute('linkFieldContentInputMethod', 'searchResult');
268
+ trackAttribute('linkFieldContentInputSource', getDataSource(selectedItem, activePlugin));
257
269
  handleInsert(_url, name, 'typeAhead');
258
270
  }
259
- }, [handleInsert, trackAttribute, items]);
271
+ }, [handleInsert, trackAttribute, items, activePlugin]);
260
272
  var handleSubmit = useCallback(function (event) {
261
273
  event.preventDefault();
262
274
 
@@ -317,7 +329,7 @@ function LinkPicker(_ref) {
317
329
  "aria-activedescendant": ariaActiveDescendant,
318
330
  "aria-describedby": screenReaderDescriptionId,
319
331
  error: invalidUrl ? intl.formatMessage(messages.linkInvalid) : null,
320
- onClear: handleClear,
332
+ onClear: handleUrlClear,
321
333
  onKeyDown: handleKeyDown,
322
334
  onChange: handleChangeUrl
323
335
  }), jsx(DisplayTextInputField, {
@@ -10,4 +10,13 @@ export var isRedoEvent = function isRedoEvent(e) {
10
10
  return (// ctrl + y for non-mac
11
11
  !browser.mac && e.ctrlKey && e.keyCode === KeyYCode || browser.mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
12
12
  );
13
+ };
14
+ /**
15
+ * Retrieve the data source for a link given the item and the plugin that resolved it
16
+ */
17
+
18
+ export var getDataSource = function getDataSource(item, plugin) {
19
+ var _ref, _item$meta$source, _item$meta, _plugin$meta;
20
+
21
+ return (_ref = (_item$meta$source = (_item$meta = item.meta) === null || _item$meta === void 0 ? void 0 : _item$meta.source) !== null && _item$meta$source !== void 0 ? _item$meta$source : plugin === null || plugin === void 0 ? void 0 : (_plugin$meta = plugin.meta) === null || _plugin$meta === void 0 ? void 0 : _plugin$meta.source) !== null && _ref !== void 0 ? _ref : 'unknown';
13
22
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates analytics utilities from the package analytics spec yaml
5
5
  *
6
- * @codegen <<SignedSource::3c46f1d8f463b6898a7a0e1e1f4676b4>>
6
+ * @codegen <<SignedSource::e8a730530bb93e19d0b85114da0581c8>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  export declare type PackageMetaDataType = {
@@ -16,6 +16,7 @@ export declare type LinkPickerAnalyticsContextType = {
16
16
  linkState: 'editLink' | 'newLink';
17
17
  linkFieldContent: 'url' | 'text_string' | null;
18
18
  linkFieldContentInputMethod: 'manual' | 'paste' | 'searchResult' | null;
19
+ linkFieldContentInputSource: string | null;
19
20
  displayTextFieldContent: 'text_string' | null;
20
21
  displayTextFieldContentInputMethod: 'manual' | 'paste' | null;
21
22
  };
@@ -27,7 +28,7 @@ export declare type TextFieldUpdatedDisplayTextFieldAttributesType = {};
27
28
  export declare type LinkPickerUnhandledErrorCaughtAttributesType = {
28
29
  browserInfo: string;
29
30
  error: string;
30
- componentStack: string;
31
+ componentStack: string | null;
31
32
  };
32
33
  declare type AnalyticsEventAttributes = {
33
34
  'ui.form.submitted.linkPicker': FormSubmittedLinkPickerAttributesType;
@@ -3,6 +3,7 @@ export interface LinkPickerPluginsService {
3
3
  items: LinkSearchListItemData[] | null;
4
4
  isLoading: boolean;
5
5
  isActivePlugin: boolean;
6
+ activePlugin?: LinkPickerPlugin;
6
7
  tabs: {
7
8
  tabTitle: string;
8
9
  }[];
@@ -1,3 +1,8 @@
1
1
  import { KeyboardEvent } from 'react';
2
+ import { LinkPickerPlugin, LinkSearchListItemData } from '../types';
2
3
  export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
3
4
  export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
5
+ /**
6
+ * Retrieve the data source for a link given the item and the plugin that resolved it
7
+ */
8
+ export declare const getDataSource: (item: LinkSearchListItemData, plugin?: LinkPickerPlugin | undefined) => string;
@@ -22,6 +22,11 @@ export interface LinkSearchListItemData {
22
22
  lastUpdatedDate?: Date;
23
23
  /** Whether the result is pre-fetched from activity provider */
24
24
  prefetch?: boolean;
25
+ /** Metadata about the result */
26
+ meta?: {
27
+ /** The data source that provided the result */
28
+ source?: string;
29
+ };
25
30
  }
26
31
  export declare type ListItemTimeStamp = {
27
32
  pageAction: string;
@@ -43,5 +48,10 @@ export interface LinkPickerPlugin {
43
48
  tabTitle?: string;
44
49
  /** Render function to customise the UI that is displayed when an error occurs resolving results */
45
50
  errorFallback?: LinkPickerPluginErrorFallback;
51
+ /** Metadata about the plugin */
52
+ meta?: {
53
+ /** The data source that provides all results provided by the plugin */
54
+ source?: string;
55
+ };
46
56
  }
47
57
  export declare type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -57,15 +57,15 @@
57
57
  "@atlaskit/activity-provider": "^2.3.2",
58
58
  "@atlaskit/docs": "*",
59
59
  "@atlaskit/link-analytics": "^1.1.0",
60
- "@atlaskit/link-test-helpers": "^1.4.0",
60
+ "@atlaskit/link-test-helpers": "^1.5.0",
61
61
  "@atlaskit/popup": "^1.4.0",
62
62
  "@atlaskit/ssr": "*",
63
63
  "@atlaskit/toggle": "^12.5.0",
64
64
  "@atlaskit/visual-regression": "*",
65
65
  "@atlaskit/webdriver-runner": "*",
66
66
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
67
- "@atlassian/link-picker-atlassian-plugin": "^19.0.0",
68
- "@atlassian/link-picker-plugins": "^6.0.0",
67
+ "@atlassian/link-picker-atlassian-plugin": "^20.0.0",
68
+ "@atlassian/link-picker-plugins": "^7.0.0",
69
69
  "@atlassian/recent-work-client": "^1.6.0",
70
70
  "@atlassian/search-provider": "^2.3.0",
71
71
  "@testing-library/dom": "^8.17.1",
package/report.api.md CHANGED
@@ -28,6 +28,11 @@ export declare interface LinkPickerPlugin {
28
28
  tabTitle?: string;
29
29
  /** Render function to customise the UI that is displayed when an error occurs resolving results */
30
30
  errorFallback?: LinkPickerPluginErrorFallback;
31
+ /** Metadata about the plugin */
32
+ meta?: {
33
+ /** The data source that provides all results provided by the plugin */
34
+ source?: string;
35
+ };
31
36
  }
32
37
 
33
38
  export declare type LinkPickerPluginErrorFallback = (
@@ -83,6 +88,11 @@ export declare interface LinkSearchListItemData {
83
88
  lastUpdatedDate?: Date;
84
89
  /** Whether the result is pre-fetched from activity provider */
85
90
  prefetch?: boolean;
91
+ /** Metadata about the result */
92
+ meta?: {
93
+ /** The data source that provided the result */
94
+ source?: string;
95
+ };
86
96
  }
87
97
 
88
98
  declare interface Meta {