@atlaskit/link-picker 1.11.1 → 1.11.2

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 (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/analytics.codegen.js +1 -1
  3. package/dist/cjs/common/analytics/context.js +8 -2
  4. package/dist/cjs/ui/link-picker/index.js +22 -32
  5. package/dist/cjs/ui/link-picker/list-item/index.js +1 -1
  6. package/dist/cjs/ui/link-picker/text-input/index.js +8 -5
  7. package/dist/cjs/ui/link-picker/track-mount/index.js +47 -0
  8. package/dist/cjs/ui/link-picker/track-tab-viewed/index.js +32 -0
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/analytics.codegen.js +1 -1
  11. package/dist/es2019/common/analytics/context.js +8 -2
  12. package/dist/es2019/ui/link-picker/index.js +22 -29
  13. package/dist/es2019/ui/link-picker/list-item/index.js +1 -1
  14. package/dist/es2019/ui/link-picker/text-input/index.js +4 -1
  15. package/dist/es2019/ui/link-picker/track-mount/index.js +31 -0
  16. package/dist/es2019/ui/link-picker/track-tab-viewed/index.js +19 -0
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/analytics.codegen.js +1 -1
  19. package/dist/esm/common/analytics/context.js +8 -2
  20. package/dist/esm/ui/link-picker/index.js +23 -33
  21. package/dist/esm/ui/link-picker/list-item/index.js +1 -1
  22. package/dist/esm/ui/link-picker/text-input/index.js +4 -1
  23. package/dist/esm/ui/link-picker/track-mount/index.js +31 -0
  24. package/dist/esm/ui/link-picker/track-tab-viewed/index.js +19 -0
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/analytics.codegen.d.ts +4 -1
  27. package/dist/types/ui/link-picker/index.d.ts +2 -2
  28. package/dist/types/ui/link-picker/link-search-list/index.d.ts +0 -1
  29. package/dist/types/ui/link-picker/text-input/index.d.ts +4 -0
  30. package/dist/types/ui/link-picker/track-mount/index.d.ts +5 -0
  31. package/dist/types/ui/link-picker/track-tab-viewed/index.d.ts +4 -0
  32. package/dist/types-ts4.0/analytics.codegen.d.ts +4 -1
  33. package/dist/types-ts4.0/ui/link-picker/index.d.ts +2 -2
  34. package/dist/types-ts4.0/ui/link-picker/link-search-list/index.d.ts +0 -1
  35. package/dist/types-ts4.0/ui/link-picker/text-input/index.d.ts +4 -0
  36. package/dist/types-ts4.0/ui/link-picker/track-mount/index.d.ts +5 -0
  37. package/dist/types-ts4.0/ui/link-picker/track-tab-viewed/index.d.ts +4 -0
  38. package/package.json +17 -12
  39. package/report.api.md +19 -12
  40. package/tmp/api-report-tmp.d.ts +93 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`841110b3cf0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/841110b3cf0) - Adds tab attribute to analytics context
8
+
3
9
  ## 1.11.1
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::05d8b1c9e46066efd0d11fa9d19c32a9>>
13
+ * @codegen <<SignedSource::c0fb3bb39f50f3a7c35ebd90e8903280>>
14
14
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
15
15
  */
16
16
  function createEventPayload(eventKey, attributes) {
@@ -38,7 +38,8 @@ var DEFAULT_CONTEXT_ATTRIBUTES = {
38
38
  linkFieldContentInputMethod: null,
39
39
  linkFieldContentInputSource: null,
40
40
  displayTextFieldContent: null,
41
- displayTextFieldContentInputMethod: null
41
+ displayTextFieldContentInputMethod: null,
42
+ tab: null
42
43
  };
43
44
 
44
45
  var LinkPickerAnalyticsContext = /*#__PURE__*/_react.default.createContext({
@@ -50,14 +51,19 @@ var LinkPickerAnalyticsContext = /*#__PURE__*/_react.default.createContext({
50
51
  });
51
52
  /**
52
53
  * TODO: Should we hook this into the form state/reducer?
54
+ * This function continues to duplicate / assume logic that runs in the picker
53
55
  */
54
56
 
55
57
 
56
58
  var contextAttributesFromIntialProps = function contextAttributesFromIntialProps(props) {
59
+ var _props$plugins$0$tabK, _props$plugins, _props$plugins$;
60
+
57
61
  return {
58
62
  linkState: (0, _url.normalizeUrl)(props.url) ? 'editLink' : 'newLink',
59
63
  linkFieldContent: (0, _url.normalizeUrl)(props.url) ? 'url' : null,
60
- displayTextFieldContent: Boolean(props.displayText) ? 'text_string' : null
64
+ displayTextFieldContent: Boolean(props.displayText) ? 'text_string' : null,
65
+ // TODO: Assumes we alway load the first plugin as the current tab
66
+ tab: (_props$plugins$0$tabK = (_props$plugins = props.plugins) === null || _props$plugins === void 0 ? void 0 : (_props$plugins$ = _props$plugins[0]) === null || _props$plugins$ === void 0 ? void 0 : _props$plugins$.tabKey) !== null && _props$plugins$0$tabK !== void 0 ? _props$plugins$0$tabK : null
61
67
  };
62
68
  };
63
69
  /**
@@ -47,7 +47,7 @@ var _useFixHeight = _interopRequireDefault(require("../../controllers/use-fix-he
47
47
 
48
48
  var _messages = require("./messages");
49
49
 
50
- var _textInput = _interopRequireDefault(require("./text-input"));
50
+ var _textInput = _interopRequireWildcard(require("./text-input"));
51
51
 
52
52
  var _styled = require("./styled");
53
53
 
@@ -63,9 +63,9 @@ var _formFooter = _interopRequireWildcard(require("./form-footer"));
63
63
 
64
64
  var _utils = require("./utils");
65
65
 
66
- var _experiences = require("../../common/analytics/experiences");
66
+ var _trackTabViewed = _interopRequireDefault(require("./track-tab-viewed"));
67
67
 
68
- var _sessionProvider = require("../../controllers/session-provider");
68
+ var _trackMount = _interopRequireDefault(require("./track-mount"));
69
69
 
70
70
  var _excluded = ["component"];
71
71
 
@@ -80,15 +80,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
80
80
  var RECENT_SEARCH_LIST_SIZE = 5;
81
81
  exports.RECENT_SEARCH_LIST_SIZE = RECENT_SEARCH_LIST_SIZE;
82
82
 
83
- var testIds = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
83
+ var testIds = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
84
84
  linkPickerRoot: 'link-picker-root',
85
85
  linkPicker: 'link-picker',
86
86
  urlInputField: 'link-url',
87
87
  textInputField: 'link-text',
88
88
  searchIcon: 'link-picker-search-icon'
89
- }, _formFooter.testIds), _linkSearchError.testIds), _linkSearchList.testIds), {}, {
90
- clearUrlButton: 'clear-text',
91
- urlError: 'link-error',
89
+ }, _formFooter.testIds), _linkSearchError.testIds), _linkSearchList.testIds), _textInput.testIds), {}, {
92
90
  tabList: 'link-picker-tabs',
93
91
  tabItem: 'link-picker-tab'
94
92
  });
@@ -182,20 +180,6 @@ function LinkPicker(_ref) {
182
180
  trackAttribute = _useLinkPickerAnalyti.trackAttribute,
183
181
  getAttributes = _useLinkPickerAnalyti.getAttributes;
184
182
 
185
- var linkPickerSessionId = (0, _sessionProvider.useLinkPickerSessionId)();
186
- (0, _react.useLayoutEffect)(function () {
187
- (0, _experiences.succeedUfoExperience)(_experiences.ufoExperience.mounted, linkPickerSessionId);
188
- }, [linkPickerSessionId]);
189
- (0, _react.useEffect)(function () {
190
- // Anything in here is fired on component mount.
191
- var event = createAnalyticsEvent((0, _analytics.default)('ui.inlineDialog.viewed.linkPicker', {}));
192
- event.fire(_constants.ANALYTICS_CHANNEL);
193
- return function () {
194
- // Anything in here is fired on component unmount.
195
- var event = createAnalyticsEvent((0, _analytics.default)('ui.inlineDialog.closed.linkPicker', {}));
196
- event.fire(_constants.ANALYTICS_CHANNEL);
197
- };
198
- }, [createAnalyticsEvent]);
199
183
  (0, _react.useLayoutEffect)(function () {
200
184
  if (onContentResize) {
201
185
  onContentResize();
@@ -340,6 +324,17 @@ function LinkPicker(_ref) {
340
324
  invalidUrl: true
341
325
  });
342
326
  }, [handleInsert, isSelectedItem, selectedItem, url]);
327
+ var handleTabChange = (0, _react.useCallback)(function (activeTab) {
328
+ var _plugins$activeTab$ta, _plugins$activeTab;
329
+
330
+ dispatch({
331
+ selectedIndex: -1,
332
+ activeIndex: -1,
333
+ invalidUrl: false,
334
+ activeTab: activeTab
335
+ });
336
+ trackAttribute('tab', (_plugins$activeTab$ta = plugins === null || plugins === void 0 ? void 0 : (_plugins$activeTab = plugins[activeTab]) === null || _plugins$activeTab === void 0 ? void 0 : _plugins$activeTab.tabKey) !== null && _plugins$activeTab$ta !== void 0 ? _plugins$activeTab$ta : null);
337
+ }, [dispatch, plugins, trackAttribute]);
343
338
  var messages = isActivePlugin ? _messages.searchMessages : _messages.linkMessages;
344
339
  var screenReaderDescriptionId = 'search-recent-links-field-description';
345
340
  var linkSearchListId = 'link-picker-search-list';
@@ -359,7 +354,7 @@ function LinkPicker(_ref) {
359
354
  "data-testid": testIds.linkPicker,
360
355
  css: _styled.rootContainerStyles,
361
356
  onSubmit: handleSubmit
362
- }, screenReaderText && (0, _react2.jsx)(_announcer.default, {
357
+ }, (0, _react2.jsx)(_trackMount.default, null), screenReaderText && (0, _react2.jsx)(_announcer.default, {
363
358
  ariaLive: "assertive",
364
359
  text: screenReaderText,
365
360
  ariaRelevant: "additions",
@@ -403,20 +398,16 @@ function LinkPicker(_ref) {
403
398
  }, (0, _react2.jsx)(_tabs.default, {
404
399
  id: testIds.tabList,
405
400
  testId: testIds.tabList,
406
- onChange: function onChange(activeTab) {
407
- return dispatch({
408
- selectedIndex: -1,
409
- activeIndex: -1,
410
- invalidUrl: false,
411
- activeTab: activeTab
412
- });
413
- }
401
+ selected: activeTab,
402
+ onChange: handleTabChange
414
403
  }, (0, _react2.jsx)(_tabs.TabList, null, tabs.map(function (tab) {
415
404
  return (0, _react2.jsx)(_tabs.Tab, {
416
405
  key: tab.tabTitle,
417
406
  testId: testIds.tabItem
418
407
  }, tab.tabTitle);
419
- })))), (0, _react2.jsx)("div", (0, _extends2.default)({
408
+ }))), (0, _react2.jsx)(_trackTabViewed.default, {
409
+ activeTab: activeTab
410
+ })), (0, _react2.jsx)("div", (0, _extends2.default)({
420
411
  css: _styled.flexColumnStyles
421
412
  }, fixListHeightProps), !error && (0, _react2.jsx)(_linkSearchList.default, {
422
413
  id: linkSearchListId,
@@ -428,7 +419,6 @@ function LinkPicker(_ref) {
428
419
  onSelect: handleSelected,
429
420
  onMouseEnter: handleMouseEnterResultItem,
430
421
  onMouseLeave: handleMouseLeaveResultItem,
431
- error: error,
432
422
  hasSearchTerm: !!(queryState !== null && queryState !== void 0 && queryState.query.length)
433
423
  }), error && ((_errorFallback = errorFallback === null || errorFallback === void 0 ? void 0 : errorFallback(error, retry)) !== null && _errorFallback !== void 0 ? _errorFallback : (0, _react2.jsx)(_linkSearchError.default, null)))), (0, _react2.jsx)(_formFooter.default, {
434
424
  css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? _styled.formFooterMargin : undefined,
@@ -15,7 +15,7 @@ var _transformTimeStamp = require("../transformTimeStamp");
15
15
 
16
16
  var _styled = require("./styled");
17
17
 
18
- var _ = require("../");
18
+ var _ = require("..");
19
19
 
20
20
  /** @jsx jsx */
21
21
  var LinkSearchListItem = function LinkSearchListItem(_ref) {
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.testIds = exports.default = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
@@ -25,11 +25,14 @@ var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-c
25
25
 
26
26
  var _utils = require("../utils");
27
27
 
28
- var _ = require("../");
29
-
30
28
  var _styled = require("./styled");
31
29
 
32
30
  var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error"];
31
+ var testIds = {
32
+ urlError: 'link-error',
33
+ clearUrlButton: 'clear-text'
34
+ };
35
+ exports.testIds = testIds;
33
36
 
34
37
  var TextInput = function TextInput(_ref) {
35
38
  var name = _ref.name,
@@ -82,7 +85,7 @@ var TextInput = function TextInput(_ref) {
82
85
  type: "button",
83
86
  css: _styled.clearTextButtonStyles,
84
87
  onClick: handleClear,
85
- "data-testid": _.testIds.clearUrlButton
88
+ "data-testid": testIds.clearUrlButton
86
89
  }, (0, _react2.jsx)(_selectClear.default, {
87
90
  size: "medium",
88
91
  label: clearLabel || ''
@@ -100,7 +103,7 @@ var TextInput = function TextInput(_ref) {
100
103
  elemAfterInput: clearText,
101
104
  isInvalid: !!error
102
105
  })), error && (0, _react2.jsx)(_form.ErrorMessage, {
103
- testId: _.testIds.urlError
106
+ testId: testIds.urlError
104
107
  }, error));
105
108
  }));
106
109
  };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = require("react");
11
+
12
+ var _analyticsNext = require("@atlaskit/analytics-next");
13
+
14
+ var _experiences = require("../../../common/analytics/experiences");
15
+
16
+ var _analytics = _interopRequireDefault(require("../../../analytics.codegen"));
17
+
18
+ var _constants = require("../../../common/constants");
19
+
20
+ var _sessionProvider = require("../../../controllers/session-provider");
21
+
22
+ /** @jsx jsx */
23
+
24
+ /**
25
+ * UFO + Analytics tracking for component mount (and unmount)
26
+ */
27
+ function TrackMount() {
28
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
29
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
30
+
31
+ var linkPickerSessionId = (0, _sessionProvider.useLinkPickerSessionId)();
32
+ (0, _react.useLayoutEffect)(function () {
33
+ (0, _experiences.succeedUfoExperience)(_experiences.ufoExperience.mounted, linkPickerSessionId);
34
+ }, [linkPickerSessionId]);
35
+ (0, _react.useLayoutEffect)(function () {
36
+ // Anything in here is fired on component mount.
37
+ createAnalyticsEvent((0, _analytics.default)('ui.inlineDialog.viewed.linkPicker', {})).fire(_constants.ANALYTICS_CHANNEL);
38
+ return function () {
39
+ // Anything in here is fired on component unmount.
40
+ createAnalyticsEvent((0, _analytics.default)('ui.inlineDialog.closed.linkPicker', {})).fire(_constants.ANALYTICS_CHANNEL);
41
+ };
42
+ }, [createAnalyticsEvent]);
43
+ return null;
44
+ }
45
+
46
+ var _default = TrackMount;
47
+ exports.default = _default;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = require("react");
11
+
12
+ var _analyticsNext = require("@atlaskit/analytics-next");
13
+
14
+ var _analytics = _interopRequireDefault(require("../../../analytics.codegen"));
15
+
16
+ var _constants = require("../../../common/constants");
17
+
18
+ /** @jsx jsx */
19
+ function TrackTabViewed(_ref) {
20
+ var activeTab = _ref.activeTab;
21
+
22
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
23
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
24
+
25
+ (0, _react.useLayoutEffect)(function () {
26
+ createAnalyticsEvent((0, _analytics.default)('ui.tab.viewed', {})).fire(_constants.ANALYTICS_CHANNEL);
27
+ }, [activeTab, createAnalyticsEvent]);
28
+ return null;
29
+ }
30
+
31
+ var _default = TrackTabViewed;
32
+ exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
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::05d8b1c9e46066efd0d11fa9d19c32a9>>
6
+ * @codegen <<SignedSource::c0fb3bb39f50f3a7c35ebd90e8903280>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  function createEventPayload(eventKey, attributes) {
@@ -9,7 +9,8 @@ const DEFAULT_CONTEXT_ATTRIBUTES = {
9
9
  linkFieldContentInputMethod: null,
10
10
  linkFieldContentInputSource: null,
11
11
  displayTextFieldContent: null,
12
- displayTextFieldContentInputMethod: null
12
+ displayTextFieldContentInputMethod: null,
13
+ tab: null
13
14
  };
14
15
  const LinkPickerAnalyticsContext = /*#__PURE__*/React.createContext({
15
16
  trackAttribute: () => {},
@@ -18,13 +19,18 @@ const LinkPickerAnalyticsContext = /*#__PURE__*/React.createContext({
18
19
  });
19
20
  /**
20
21
  * TODO: Should we hook this into the form state/reducer?
22
+ * This function continues to duplicate / assume logic that runs in the picker
21
23
  */
22
24
 
23
25
  const contextAttributesFromIntialProps = props => {
26
+ var _props$plugins$0$tabK, _props$plugins, _props$plugins$;
27
+
24
28
  return {
25
29
  linkState: normalizeUrl(props.url) ? 'editLink' : 'newLink',
26
30
  linkFieldContent: normalizeUrl(props.url) ? 'url' : null,
27
- displayTextFieldContent: Boolean(props.displayText) ? 'text_string' : null
31
+ displayTextFieldContent: Boolean(props.displayText) ? 'text_string' : null,
32
+ // TODO: Assumes we alway load the first plugin as the current tab
33
+ tab: (_props$plugins$0$tabK = (_props$plugins = props.plugins) === null || _props$plugins === void 0 ? void 0 : (_props$plugins$ = _props$plugins[0]) === null || _props$plugins$ === void 0 ? void 0 : _props$plugins$.tabKey) !== null && _props$plugins$0$tabK !== void 0 ? _props$plugins$0$tabK : null
28
34
  };
29
35
  };
30
36
  /**
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { Fragment, useCallback, useEffect, useLayoutEffect, useReducer, memo } from 'react';
4
+ import { Fragment, useCallback, useLayoutEffect, useReducer, memo } from 'react';
5
5
  import { jsx } from '@emotion/react';
6
6
  import { useIntl, FormattedMessage } from 'react-intl-next';
7
7
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
@@ -16,7 +16,7 @@ import { usePlugins } from '../../services/use-plugins';
16
16
  import { useSearchQuery } from '../../services/use-search-query';
17
17
  import useFixHeight from '../../controllers/use-fix-height';
18
18
  import { searchMessages, linkMessages, formMessages, linkTextMessages } from './messages';
19
- import TextInput from './text-input';
19
+ import TextInput, { testIds as textFieldTestIds } from './text-input';
20
20
  import { rootContainerStyles, searchIconStyles, tabsWrapperStyles, flexColumnStyles, formFooterMargin } from './styled';
21
21
  import { browser } from './browser';
22
22
  import Announcer from './announcer';
@@ -24,8 +24,8 @@ import LinkSearchList, { testIds as listTestIds } from './link-search-list';
24
24
  import LinkSearchError, { testIds as searchErrorTestIds } from './link-search-error';
25
25
  import FormFooter, { testIds as formFooterTestIds } from './form-footer';
26
26
  import { getDataSource, getScreenReaderText } from './utils';
27
- import { succeedUfoExperience, ufoExperience } from '../../common/analytics/experiences';
28
- import { useLinkPickerSessionId } from '../../controllers/session-provider';
27
+ import TrackTabViewed from './track-tab-viewed';
28
+ import TrackMount from './track-mount';
29
29
  export const RECENT_SEARCH_LIST_SIZE = 5;
30
30
  export const testIds = {
31
31
  linkPickerRoot: 'link-picker-root',
@@ -36,8 +36,7 @@ export const testIds = {
36
36
  ...formFooterTestIds,
37
37
  ...searchErrorTestIds,
38
38
  ...listTestIds,
39
- clearUrlButton: 'clear-text',
40
- urlError: 'link-error',
39
+ ...textFieldTestIds,
41
40
  tabList: 'link-picker-tabs',
42
41
  tabItem: 'link-picker-tab'
43
42
  };
@@ -126,20 +125,6 @@ function LinkPicker({
126
125
  trackAttribute,
127
126
  getAttributes
128
127
  } = useLinkPickerAnalytics();
129
- const linkPickerSessionId = useLinkPickerSessionId();
130
- useLayoutEffect(() => {
131
- succeedUfoExperience(ufoExperience.mounted, linkPickerSessionId);
132
- }, [linkPickerSessionId]);
133
- useEffect(() => {
134
- // Anything in here is fired on component mount.
135
- const event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.viewed.linkPicker', {}));
136
- event.fire(ANALYTICS_CHANNEL);
137
- return () => {
138
- // Anything in here is fired on component unmount.
139
- const event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.closed.linkPicker', {}));
140
- event.fire(ANALYTICS_CHANNEL);
141
- };
142
- }, [createAnalyticsEvent]);
143
128
  useLayoutEffect(() => {
144
129
  if (onContentResize) {
145
130
  onContentResize();
@@ -285,6 +270,17 @@ function LinkPicker({
285
270
  invalidUrl: true
286
271
  });
287
272
  }, [handleInsert, isSelectedItem, selectedItem, url]);
273
+ const handleTabChange = useCallback(activeTab => {
274
+ var _plugins$activeTab$ta, _plugins$activeTab;
275
+
276
+ dispatch({
277
+ selectedIndex: -1,
278
+ activeIndex: -1,
279
+ invalidUrl: false,
280
+ activeTab
281
+ });
282
+ trackAttribute('tab', (_plugins$activeTab$ta = plugins === null || plugins === void 0 ? void 0 : (_plugins$activeTab = plugins[activeTab]) === null || _plugins$activeTab === void 0 ? void 0 : _plugins$activeTab.tabKey) !== null && _plugins$activeTab$ta !== void 0 ? _plugins$activeTab$ta : null);
283
+ }, [dispatch, plugins, trackAttribute]);
288
284
  const messages = isActivePlugin ? searchMessages : linkMessages;
289
285
  const screenReaderDescriptionId = 'search-recent-links-field-description';
290
286
  const linkSearchListId = 'link-picker-search-list';
@@ -304,7 +300,7 @@ function LinkPicker({
304
300
  "data-testid": testIds.linkPicker,
305
301
  css: rootContainerStyles,
306
302
  onSubmit: handleSubmit
307
- }, screenReaderText && jsx(Announcer, {
303
+ }, jsx(TrackMount, null), screenReaderText && jsx(Announcer, {
308
304
  ariaLive: "assertive",
309
305
  text: screenReaderText,
310
306
  ariaRelevant: "additions",
@@ -348,16 +344,14 @@ function LinkPicker({
348
344
  }, jsx(Tabs, {
349
345
  id: testIds.tabList,
350
346
  testId: testIds.tabList,
351
- onChange: activeTab => dispatch({
352
- selectedIndex: -1,
353
- activeIndex: -1,
354
- invalidUrl: false,
355
- activeTab
356
- })
347
+ selected: activeTab,
348
+ onChange: handleTabChange
357
349
  }, jsx(TabList, null, tabs.map(tab => jsx(Tab, {
358
350
  key: tab.tabTitle,
359
351
  testId: testIds.tabItem
360
- }, tab.tabTitle))))), jsx("div", _extends({
352
+ }, tab.tabTitle)))), jsx(TrackTabViewed, {
353
+ activeTab: activeTab
354
+ })), jsx("div", _extends({
361
355
  css: flexColumnStyles
362
356
  }, fixListHeightProps), !error && jsx(LinkSearchList, {
363
357
  id: linkSearchListId,
@@ -369,7 +363,6 @@ function LinkPicker({
369
363
  onSelect: handleSelected,
370
364
  onMouseEnter: handleMouseEnterResultItem,
371
365
  onMouseLeave: handleMouseLeaveResultItem,
372
- error: error,
373
366
  hasSearchTerm: !!(queryState !== null && queryState !== void 0 && queryState.query.length)
374
367
  }), error && ((_errorFallback = errorFallback === null || errorFallback === void 0 ? void 0 : errorFallback(error, retry)) !== null && _errorFallback !== void 0 ? _errorFallback : jsx(LinkSearchError, null)))), jsx(FormFooter, {
375
368
  css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? formFooterMargin : undefined,
@@ -4,7 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import { injectIntl } from 'react-intl-next';
5
5
  import { transformTimeStamp } from '../transformTimeStamp';
6
6
  import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles, listItemContainerStyles, listItemContainerInnerStyles } from './styled';
7
- import { testIds } from '../';
7
+ import { testIds } from '..';
8
8
 
9
9
  const LinkSearchListItem = ({
10
10
  item,
@@ -8,8 +8,11 @@ import Tooltip from '@atlaskit/tooltip';
8
8
  import Textfield from '@atlaskit/textfield';
9
9
  import Selectclear from '@atlaskit/icon/glyph/select-clear';
10
10
  import { isRedoEvent, isUndoEvent } from '../utils';
11
- import { testIds } from '../';
12
11
  import { clearTextButtonStyles, fieldStyles } from './styled';
12
+ export const testIds = {
13
+ urlError: 'link-error',
14
+ clearUrlButton: 'clear-text'
15
+ };
13
16
 
14
17
  const TextInput = ({
15
18
  name,
@@ -0,0 +1,31 @@
1
+ /** @jsx jsx */
2
+ import { useLayoutEffect } from 'react';
3
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import { succeedUfoExperience, ufoExperience } from '../../../common/analytics/experiences';
5
+ import createEventPayload from '../../../analytics.codegen';
6
+ import { ANALYTICS_CHANNEL } from '../../../common/constants';
7
+ import { useLinkPickerSessionId } from '../../../controllers/session-provider';
8
+ /**
9
+ * UFO + Analytics tracking for component mount (and unmount)
10
+ */
11
+
12
+ function TrackMount() {
13
+ const {
14
+ createAnalyticsEvent
15
+ } = useAnalyticsEvents();
16
+ const linkPickerSessionId = useLinkPickerSessionId();
17
+ useLayoutEffect(() => {
18
+ succeedUfoExperience(ufoExperience.mounted, linkPickerSessionId);
19
+ }, [linkPickerSessionId]);
20
+ useLayoutEffect(() => {
21
+ // Anything in here is fired on component mount.
22
+ createAnalyticsEvent(createEventPayload('ui.inlineDialog.viewed.linkPicker', {})).fire(ANALYTICS_CHANNEL);
23
+ return () => {
24
+ // Anything in here is fired on component unmount.
25
+ createAnalyticsEvent(createEventPayload('ui.inlineDialog.closed.linkPicker', {})).fire(ANALYTICS_CHANNEL);
26
+ };
27
+ }, [createAnalyticsEvent]);
28
+ return null;
29
+ }
30
+
31
+ export default TrackMount;
@@ -0,0 +1,19 @@
1
+ /** @jsx jsx */
2
+ import { useLayoutEffect } from 'react';
3
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import createEventPayload from '../../../analytics.codegen';
5
+ import { ANALYTICS_CHANNEL } from '../../../common/constants';
6
+
7
+ function TrackTabViewed({
8
+ activeTab
9
+ }) {
10
+ const {
11
+ createAnalyticsEvent
12
+ } = useAnalyticsEvents();
13
+ useLayoutEffect(() => {
14
+ createAnalyticsEvent(createEventPayload('ui.tab.viewed', {})).fire(ANALYTICS_CHANNEL);
15
+ }, [activeTab, createAnalyticsEvent]);
16
+ return null;
17
+ }
18
+
19
+ export default TrackTabViewed;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
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::05d8b1c9e46066efd0d11fa9d19c32a9>>
6
+ * @codegen <<SignedSource::c0fb3bb39f50f3a7c35ebd90e8903280>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  function createEventPayload(eventKey, attributes) {
@@ -16,7 +16,8 @@ var DEFAULT_CONTEXT_ATTRIBUTES = {
16
16
  linkFieldContentInputMethod: null,
17
17
  linkFieldContentInputSource: null,
18
18
  displayTextFieldContent: null,
19
- displayTextFieldContentInputMethod: null
19
+ displayTextFieldContentInputMethod: null,
20
+ tab: null
20
21
  };
21
22
  var LinkPickerAnalyticsContext = /*#__PURE__*/React.createContext({
22
23
  trackAttribute: function trackAttribute() {},
@@ -27,13 +28,18 @@ var LinkPickerAnalyticsContext = /*#__PURE__*/React.createContext({
27
28
  });
28
29
  /**
29
30
  * TODO: Should we hook this into the form state/reducer?
31
+ * This function continues to duplicate / assume logic that runs in the picker
30
32
  */
31
33
 
32
34
  var contextAttributesFromIntialProps = function contextAttributesFromIntialProps(props) {
35
+ var _props$plugins$0$tabK, _props$plugins, _props$plugins$;
36
+
33
37
  return {
34
38
  linkState: normalizeUrl(props.url) ? 'editLink' : 'newLink',
35
39
  linkFieldContent: normalizeUrl(props.url) ? 'url' : null,
36
- displayTextFieldContent: Boolean(props.displayText) ? 'text_string' : null
40
+ displayTextFieldContent: Boolean(props.displayText) ? 'text_string' : null,
41
+ // TODO: Assumes we alway load the first plugin as the current tab
42
+ tab: (_props$plugins$0$tabK = (_props$plugins = props.plugins) === null || _props$plugins === void 0 ? void 0 : (_props$plugins$ = _props$plugins[0]) === null || _props$plugins$ === void 0 ? void 0 : _props$plugins$.tabKey) !== null && _props$plugins$0$tabK !== void 0 ? _props$plugins$0$tabK : null
37
43
  };
38
44
  };
39
45
  /**
@@ -9,7 +9,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
9
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
10
 
11
11
  /** @jsx jsx */
12
- import { Fragment, useCallback, useEffect, useLayoutEffect, useReducer, memo } from 'react';
12
+ import { Fragment, useCallback, useLayoutEffect, useReducer, memo } from 'react';
13
13
  import { jsx } from '@emotion/react';
14
14
  import { useIntl, FormattedMessage } from 'react-intl-next';
15
15
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
@@ -24,7 +24,7 @@ import { usePlugins } from '../../services/use-plugins';
24
24
  import { useSearchQuery } from '../../services/use-search-query';
25
25
  import useFixHeight from '../../controllers/use-fix-height';
26
26
  import { searchMessages, linkMessages, formMessages, linkTextMessages } from './messages';
27
- import TextInput from './text-input';
27
+ import TextInput, { testIds as textFieldTestIds } from './text-input';
28
28
  import { rootContainerStyles, searchIconStyles, tabsWrapperStyles, flexColumnStyles, formFooterMargin } from './styled';
29
29
  import { browser } from './browser';
30
30
  import Announcer from './announcer';
@@ -32,18 +32,16 @@ import LinkSearchList, { testIds as listTestIds } from './link-search-list';
32
32
  import LinkSearchError, { testIds as searchErrorTestIds } from './link-search-error';
33
33
  import FormFooter, { testIds as formFooterTestIds } from './form-footer';
34
34
  import { getDataSource, getScreenReaderText } from './utils';
35
- import { succeedUfoExperience, ufoExperience } from '../../common/analytics/experiences';
36
- import { useLinkPickerSessionId } from '../../controllers/session-provider';
35
+ import TrackTabViewed from './track-tab-viewed';
36
+ import TrackMount from './track-mount';
37
37
  export var RECENT_SEARCH_LIST_SIZE = 5;
38
- export var testIds = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
38
+ export var testIds = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
39
39
  linkPickerRoot: 'link-picker-root',
40
40
  linkPicker: 'link-picker',
41
41
  urlInputField: 'link-url',
42
42
  textInputField: 'link-text',
43
43
  searchIcon: 'link-picker-search-icon'
44
- }, formFooterTestIds), searchErrorTestIds), listTestIds), {}, {
45
- clearUrlButton: 'clear-text',
46
- urlError: 'link-error',
44
+ }, formFooterTestIds), searchErrorTestIds), listTestIds), textFieldTestIds), {}, {
47
45
  tabList: 'link-picker-tabs',
48
46
  tabItem: 'link-picker-tab'
49
47
  });
@@ -135,20 +133,6 @@ function LinkPicker(_ref) {
135
133
  trackAttribute = _useLinkPickerAnalyti.trackAttribute,
136
134
  getAttributes = _useLinkPickerAnalyti.getAttributes;
137
135
 
138
- var linkPickerSessionId = useLinkPickerSessionId();
139
- useLayoutEffect(function () {
140
- succeedUfoExperience(ufoExperience.mounted, linkPickerSessionId);
141
- }, [linkPickerSessionId]);
142
- useEffect(function () {
143
- // Anything in here is fired on component mount.
144
- var event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.viewed.linkPicker', {}));
145
- event.fire(ANALYTICS_CHANNEL);
146
- return function () {
147
- // Anything in here is fired on component unmount.
148
- var event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.closed.linkPicker', {}));
149
- event.fire(ANALYTICS_CHANNEL);
150
- };
151
- }, [createAnalyticsEvent]);
152
136
  useLayoutEffect(function () {
153
137
  if (onContentResize) {
154
138
  onContentResize();
@@ -293,6 +277,17 @@ function LinkPicker(_ref) {
293
277
  invalidUrl: true
294
278
  });
295
279
  }, [handleInsert, isSelectedItem, selectedItem, url]);
280
+ var handleTabChange = useCallback(function (activeTab) {
281
+ var _plugins$activeTab$ta, _plugins$activeTab;
282
+
283
+ dispatch({
284
+ selectedIndex: -1,
285
+ activeIndex: -1,
286
+ invalidUrl: false,
287
+ activeTab: activeTab
288
+ });
289
+ trackAttribute('tab', (_plugins$activeTab$ta = plugins === null || plugins === void 0 ? void 0 : (_plugins$activeTab = plugins[activeTab]) === null || _plugins$activeTab === void 0 ? void 0 : _plugins$activeTab.tabKey) !== null && _plugins$activeTab$ta !== void 0 ? _plugins$activeTab$ta : null);
290
+ }, [dispatch, plugins, trackAttribute]);
296
291
  var messages = isActivePlugin ? searchMessages : linkMessages;
297
292
  var screenReaderDescriptionId = 'search-recent-links-field-description';
298
293
  var linkSearchListId = 'link-picker-search-list';
@@ -312,7 +307,7 @@ function LinkPicker(_ref) {
312
307
  "data-testid": testIds.linkPicker,
313
308
  css: rootContainerStyles,
314
309
  onSubmit: handleSubmit
315
- }, screenReaderText && jsx(Announcer, {
310
+ }, jsx(TrackMount, null), screenReaderText && jsx(Announcer, {
316
311
  ariaLive: "assertive",
317
312
  text: screenReaderText,
318
313
  ariaRelevant: "additions",
@@ -356,20 +351,16 @@ function LinkPicker(_ref) {
356
351
  }, jsx(Tabs, {
357
352
  id: testIds.tabList,
358
353
  testId: testIds.tabList,
359
- onChange: function onChange(activeTab) {
360
- return dispatch({
361
- selectedIndex: -1,
362
- activeIndex: -1,
363
- invalidUrl: false,
364
- activeTab: activeTab
365
- });
366
- }
354
+ selected: activeTab,
355
+ onChange: handleTabChange
367
356
  }, jsx(TabList, null, tabs.map(function (tab) {
368
357
  return jsx(Tab, {
369
358
  key: tab.tabTitle,
370
359
  testId: testIds.tabItem
371
360
  }, tab.tabTitle);
372
- })))), jsx("div", _extends({
361
+ }))), jsx(TrackTabViewed, {
362
+ activeTab: activeTab
363
+ })), jsx("div", _extends({
373
364
  css: flexColumnStyles
374
365
  }, fixListHeightProps), !error && jsx(LinkSearchList, {
375
366
  id: linkSearchListId,
@@ -381,7 +372,6 @@ function LinkPicker(_ref) {
381
372
  onSelect: handleSelected,
382
373
  onMouseEnter: handleMouseEnterResultItem,
383
374
  onMouseLeave: handleMouseLeaveResultItem,
384
- error: error,
385
375
  hasSearchTerm: !!(queryState !== null && queryState !== void 0 && queryState.query.length)
386
376
  }), error && ((_errorFallback = errorFallback === null || errorFallback === void 0 ? void 0 : errorFallback(error, retry)) !== null && _errorFallback !== void 0 ? _errorFallback : jsx(LinkSearchError, null)))), jsx(FormFooter, {
387
377
  css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? formFooterMargin : undefined,
@@ -4,7 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import { injectIntl } from 'react-intl-next';
5
5
  import { transformTimeStamp } from '../transformTimeStamp';
6
6
  import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles, listItemContainerStyles, listItemContainerInnerStyles } from './styled';
7
- import { testIds } from '../';
7
+ import { testIds } from '..';
8
8
 
9
9
  var LinkSearchListItem = function LinkSearchListItem(_ref) {
10
10
  var item = _ref.item,
@@ -10,8 +10,11 @@ import Tooltip from '@atlaskit/tooltip';
10
10
  import Textfield from '@atlaskit/textfield';
11
11
  import Selectclear from '@atlaskit/icon/glyph/select-clear';
12
12
  import { isRedoEvent, isUndoEvent } from '../utils';
13
- import { testIds } from '../';
14
13
  import { clearTextButtonStyles, fieldStyles } from './styled';
14
+ export var testIds = {
15
+ urlError: 'link-error',
16
+ clearUrlButton: 'clear-text'
17
+ };
15
18
 
16
19
  var TextInput = function TextInput(_ref) {
17
20
  var name = _ref.name,
@@ -0,0 +1,31 @@
1
+ /** @jsx jsx */
2
+ import { useLayoutEffect } from 'react';
3
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import { succeedUfoExperience, ufoExperience } from '../../../common/analytics/experiences';
5
+ import createEventPayload from '../../../analytics.codegen';
6
+ import { ANALYTICS_CHANNEL } from '../../../common/constants';
7
+ import { useLinkPickerSessionId } from '../../../controllers/session-provider';
8
+ /**
9
+ * UFO + Analytics tracking for component mount (and unmount)
10
+ */
11
+
12
+ function TrackMount() {
13
+ var _useAnalyticsEvents = useAnalyticsEvents(),
14
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
15
+
16
+ var linkPickerSessionId = useLinkPickerSessionId();
17
+ useLayoutEffect(function () {
18
+ succeedUfoExperience(ufoExperience.mounted, linkPickerSessionId);
19
+ }, [linkPickerSessionId]);
20
+ useLayoutEffect(function () {
21
+ // Anything in here is fired on component mount.
22
+ createAnalyticsEvent(createEventPayload('ui.inlineDialog.viewed.linkPicker', {})).fire(ANALYTICS_CHANNEL);
23
+ return function () {
24
+ // Anything in here is fired on component unmount.
25
+ createAnalyticsEvent(createEventPayload('ui.inlineDialog.closed.linkPicker', {})).fire(ANALYTICS_CHANNEL);
26
+ };
27
+ }, [createAnalyticsEvent]);
28
+ return null;
29
+ }
30
+
31
+ export default TrackMount;
@@ -0,0 +1,19 @@
1
+ /** @jsx jsx */
2
+ import { useLayoutEffect } from 'react';
3
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import createEventPayload from '../../../analytics.codegen';
5
+ import { ANALYTICS_CHANNEL } from '../../../common/constants';
6
+
7
+ function TrackTabViewed(_ref) {
8
+ var activeTab = _ref.activeTab;
9
+
10
+ var _useAnalyticsEvents = useAnalyticsEvents(),
11
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
12
+
13
+ useLayoutEffect(function () {
14
+ createAnalyticsEvent(createEventPayload('ui.tab.viewed', {})).fire(ANALYTICS_CHANNEL);
15
+ }, [activeTab, createAnalyticsEvent]);
16
+ return null;
17
+ }
18
+
19
+ export default TrackTabViewed;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
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::05d8b1c9e46066efd0d11fa9d19c32a9>>
6
+ * @codegen <<SignedSource::c0fb3bb39f50f3a7c35ebd90e8903280>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  export declare type PackageMetaDataType = {
@@ -19,12 +19,14 @@ export declare type LinkPickerAnalyticsContextType = {
19
19
  linkFieldContentInputSource: string | null;
20
20
  displayTextFieldContent: 'text_string' | null;
21
21
  displayTextFieldContentInputMethod: 'manual' | 'paste' | null;
22
+ tab: string | null;
22
23
  };
23
24
  export declare type FormSubmittedLinkPickerAttributesType = {};
24
25
  export declare type InlineDialogViewedLinkPickerAttributesType = {};
25
26
  export declare type InlineDialogClosedLinkPickerAttributesType = {};
26
27
  export declare type TextFieldUpdatedLinkFieldAttributesType = {};
27
28
  export declare type TextFieldUpdatedDisplayTextFieldAttributesType = {};
29
+ export declare type TabViewedAttributesType = {};
28
30
  export declare type LinkPickerUnhandledErrorCaughtAttributesType = {
29
31
  browserInfo: string;
30
32
  error: string;
@@ -39,6 +41,7 @@ declare type AnalyticsEventAttributes = {
39
41
  'ui.inlineDialog.closed.linkPicker': InlineDialogClosedLinkPickerAttributesType;
40
42
  'ui.textField.updated.linkField': TextFieldUpdatedLinkFieldAttributesType;
41
43
  'ui.textField.updated.displayTextField': TextFieldUpdatedDisplayTextFieldAttributesType;
44
+ 'ui.tab.viewed': TabViewedAttributesType;
42
45
  'ui.linkPicker.unhandledErrorCaught': LinkPickerUnhandledErrorCaughtAttributesType;
43
46
  'operational.resultsResolve.failed': ResultsResolveFailedAttributesType;
44
47
  };
@@ -3,10 +3,10 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { LinkInputType, LinkPickerPlugin } from '../types';
4
4
  export declare const RECENT_SEARCH_LIST_SIZE = 5;
5
5
  export declare const testIds: {
6
- readonly clearUrlButton: "clear-text";
7
- readonly urlError: "link-error";
8
6
  readonly tabList: "link-picker-tabs";
9
7
  readonly tabItem: "link-picker-tab";
8
+ readonly urlError: string;
9
+ readonly clearUrlButton: string;
10
10
  readonly resultListTitle: string;
11
11
  readonly searchResultItem: string;
12
12
  readonly searchResultList: string;
@@ -36,7 +36,6 @@ export interface LinkSearchListProps extends Omit<React.HTMLAttributes<HTMLDivEl
36
36
  ariaLabelledBy?: string;
37
37
  role?: string;
38
38
  id?: string;
39
- error?: unknown;
40
39
  hasSearchTerm?: boolean;
41
40
  }
42
41
  declare const LinkSearchList: import("react").ForwardRefExoticComponent<LinkSearchListProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -10,5 +10,9 @@ export declare type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & {
10
10
  clearLabel?: string;
11
11
  error?: string | null;
12
12
  };
13
+ export declare const testIds: {
14
+ urlError: string;
15
+ clearUrlButton: string;
16
+ };
13
17
  declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, ...restProps }: TextInputProps) => jsx.JSX.Element;
14
18
  export default TextInput;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * UFO + Analytics tracking for component mount (and unmount)
3
+ */
4
+ declare function TrackMount(): null;
5
+ export default TrackMount;
@@ -0,0 +1,4 @@
1
+ declare function TrackTabViewed({ activeTab }: {
2
+ activeTab: number | null;
3
+ }): null;
4
+ export default TrackTabViewed;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates analytics utilities from the package analytics spec yaml
5
5
  *
6
- * @codegen <<SignedSource::05d8b1c9e46066efd0d11fa9d19c32a9>>
6
+ * @codegen <<SignedSource::c0fb3bb39f50f3a7c35ebd90e8903280>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  export declare type PackageMetaDataType = {
@@ -19,12 +19,14 @@ export declare type LinkPickerAnalyticsContextType = {
19
19
  linkFieldContentInputSource: string | null;
20
20
  displayTextFieldContent: 'text_string' | null;
21
21
  displayTextFieldContentInputMethod: 'manual' | 'paste' | null;
22
+ tab: string | null;
22
23
  };
23
24
  export declare type FormSubmittedLinkPickerAttributesType = {};
24
25
  export declare type InlineDialogViewedLinkPickerAttributesType = {};
25
26
  export declare type InlineDialogClosedLinkPickerAttributesType = {};
26
27
  export declare type TextFieldUpdatedLinkFieldAttributesType = {};
27
28
  export declare type TextFieldUpdatedDisplayTextFieldAttributesType = {};
29
+ export declare type TabViewedAttributesType = {};
28
30
  export declare type LinkPickerUnhandledErrorCaughtAttributesType = {
29
31
  browserInfo: string;
30
32
  error: string;
@@ -39,6 +41,7 @@ declare type AnalyticsEventAttributes = {
39
41
  'ui.inlineDialog.closed.linkPicker': InlineDialogClosedLinkPickerAttributesType;
40
42
  'ui.textField.updated.linkField': TextFieldUpdatedLinkFieldAttributesType;
41
43
  'ui.textField.updated.displayTextField': TextFieldUpdatedDisplayTextFieldAttributesType;
44
+ 'ui.tab.viewed': TabViewedAttributesType;
42
45
  'ui.linkPicker.unhandledErrorCaught': LinkPickerUnhandledErrorCaughtAttributesType;
43
46
  'operational.resultsResolve.failed': ResultsResolveFailedAttributesType;
44
47
  };
@@ -3,10 +3,10 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { LinkInputType, LinkPickerPlugin } from '../types';
4
4
  export declare const RECENT_SEARCH_LIST_SIZE = 5;
5
5
  export declare const testIds: {
6
- readonly clearUrlButton: "clear-text";
7
- readonly urlError: "link-error";
8
6
  readonly tabList: "link-picker-tabs";
9
7
  readonly tabItem: "link-picker-tab";
8
+ readonly urlError: string;
9
+ readonly clearUrlButton: string;
10
10
  readonly resultListTitle: string;
11
11
  readonly searchResultItem: string;
12
12
  readonly searchResultList: string;
@@ -36,7 +36,6 @@ export interface LinkSearchListProps extends Omit<React.HTMLAttributes<HTMLDivEl
36
36
  ariaLabelledBy?: string;
37
37
  role?: string;
38
38
  id?: string;
39
- error?: unknown;
40
39
  hasSearchTerm?: boolean;
41
40
  }
42
41
  declare const LinkSearchList: import("react").ForwardRefExoticComponent<LinkSearchListProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -10,5 +10,9 @@ export declare type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & {
10
10
  clearLabel?: string;
11
11
  error?: string | null;
12
12
  };
13
+ export declare const testIds: {
14
+ urlError: string;
15
+ clearUrlButton: string;
16
+ };
13
17
  declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, ...restProps }: TextInputProps) => jsx.JSX.Element;
14
18
  export default TextInput;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * UFO + Analytics tracking for component mount (and unmount)
3
+ */
4
+ declare function TrackMount(): null;
5
+ export default TrackMount;
@@ -0,0 +1,4 @@
1
+ declare function TrackTabViewed({ activeTab }: {
2
+ activeTab: number | null;
3
+ }): null;
4
+ export default TrackTabViewed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -23,7 +23,8 @@
23
23
  "typesVersions": {
24
24
  ">=4.0 <4.5": {
25
25
  "*": [
26
- "dist/types-ts4.0/*"
26
+ "dist/types-ts4.0/*",
27
+ "dist/types-ts4.0/index.d.ts"
27
28
  ]
28
29
  }
29
30
  },
@@ -34,21 +35,22 @@
34
35
  },
35
36
  "scripts": {
36
37
  "ak-postbuild": "ls -d dist/* | grep -v dist/types | xargs -n 1 copyfiles -u 1 -V src/**/*.svg",
37
- "codegen-analytics": "ts-node --project ../../../tsconfig.node.json ./scripts/build/codegen-analytics"
38
+ "codegen-analytics": "ts-node --project ../../../tsconfig.node.json ./scripts/build/codegen-analytics",
39
+ "docs-analytics": "ts-node --project ../../../tsconfig.node.json ./scripts/build/docs-analytics"
38
40
  },
39
41
  "dependencies": {
40
42
  "@atlaskit/analytics-next": "^8.3.1",
41
43
  "@atlaskit/button": "^16.2.0",
42
44
  "@atlaskit/empty-state": "^7.4.0",
43
- "@atlaskit/form": "^8.5.1",
45
+ "@atlaskit/form": "^8.6.0",
44
46
  "@atlaskit/frontend-utilities": "^2.0.0",
45
- "@atlaskit/icon": "^21.10.0",
47
+ "@atlaskit/icon": "^21.11.0",
46
48
  "@atlaskit/spinner": "^15.1.0",
47
49
  "@atlaskit/tabs": "^13.3.0",
48
50
  "@atlaskit/textfield": "^5.3.0",
49
51
  "@atlaskit/theme": "^12.2.0",
50
52
  "@atlaskit/tokens": "^0.10.0",
51
- "@atlaskit/tooltip": "^17.5.0",
53
+ "@atlaskit/tooltip": "^17.6.0",
52
54
  "@atlaskit/ufo": "^0.1.0",
53
55
  "@atlaskit/visually-hidden": "^1.1.0",
54
56
  "@babel/runtime": "^7.0.0",
@@ -66,18 +68,20 @@
66
68
  "devDependencies": {
67
69
  "@af/codegen": "*",
68
70
  "@atlaskit/activity-provider": "^2.3.2",
71
+ "@atlaskit/adf-schema": "^24.0.0",
72
+ "@atlaskit/adf-utils": "^17.1.4",
69
73
  "@atlaskit/docs": "*",
70
- "@atlaskit/link-analytics": "^1.1.0",
71
- "@atlaskit/link-provider": "^1.2.9",
72
- "@atlaskit/link-test-helpers": "^1.5.0",
73
- "@atlaskit/popup": "^1.4.0",
74
+ "@atlaskit/link-analytics": "^2.0.0",
75
+ "@atlaskit/link-provider": "^1.3.0",
76
+ "@atlaskit/link-test-helpers": "^2.0.0",
77
+ "@atlaskit/popup": "^1.5.0",
74
78
  "@atlaskit/ssr": "*",
75
79
  "@atlaskit/toggle": "^12.5.0",
76
80
  "@atlaskit/visual-regression": "*",
77
81
  "@atlaskit/webdriver-runner": "*",
78
82
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
79
83
  "@atlassian/link-picker-atlassian-plugin": "^21.0.0",
80
- "@atlassian/link-picker-plugins": "^8.0.0",
84
+ "@atlassian/link-picker-plugins": "^9.0.0",
81
85
  "@atlassian/recent-work-client": "^1.6.0",
82
86
  "@atlassian/search-provider": "^2.3.0",
83
87
  "@testing-library/dom": "^8.17.1",
@@ -86,12 +90,13 @@
86
90
  "@testing-library/react-hooks": "^8.0.1",
87
91
  "@testing-library/user-event": "^14.4.3",
88
92
  "@types/js-yaml": "^3.12.5",
89
- "enzyme": "^3.10.0",
93
+ "enquirer": "^2.3.4",
90
94
  "fetch-mock": "^8.0.0",
91
95
  "jest-extended": "^0.11.2",
92
96
  "js-yaml": "^3.13.1",
93
97
  "lodash": "^4.17.21",
94
98
  "mockdate": "^3.0.2",
99
+ "node-fetch": "^2.6.7",
95
100
  "prettier": "^2.1.1",
96
101
  "react-dom": "^16.8.0",
97
102
  "sinon": "^2.2.0",
package/report.api.md CHANGED
@@ -1,12 +1,17 @@
1
+ <!-- API Report Version: 2.3 -->
2
+
1
3
  ## API Report File for "@atlaskit/link-picker"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
4
9
 
5
- <!--
6
- Generated API Report version: 2.0
7
- -->
10
+ - [Main Entry Types](#main-entry-types)
8
11
 
9
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
12
+ ### Main Entry Types
13
+
14
+ <!--SECTION START: Main Entry Types-->
10
15
 
11
16
  ```ts
12
17
  /// <reference types="react" />
@@ -33,7 +38,7 @@ export interface LinkPickerPlugin {
33
38
  // (undocumented)
34
39
  resolve: (
35
40
  state: LinkPickerState,
36
- ) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
41
+ ) => AsyncGenerator<ResolveResult, ResolveResult> | Promise<ResolveResult>;
37
42
  tabKey?: string;
38
43
  tabTitle?: string;
39
44
  }
@@ -51,7 +56,7 @@ export interface LinkPickerProps {
51
56
  children: React.ReactElement;
52
57
  }
53
58
  >;
54
- displayText?: string | null;
59
+ displayText?: null | string;
55
60
  onCancel: () => void;
56
61
  onContentResize?: () => void;
57
62
  onSubmit: (
@@ -71,11 +76,11 @@ export interface LinkPickerState {
71
76
  export interface LinkSearchListItemData {
72
77
  container?: string;
73
78
  icon:
74
- | string
75
79
  | React.ComponentType<{
76
80
  alt: string;
77
- }>;
78
- iconAlt: string | MessageDescriptor;
81
+ }>
82
+ | string;
83
+ iconAlt: MessageDescriptor | string;
79
84
  lastUpdatedDate?: Date;
80
85
  lastViewedDate?: Date;
81
86
  meta?: {
@@ -94,10 +99,10 @@ interface Meta {
94
99
 
95
100
  // @public (undocumented)
96
101
  interface OnSubmitParameter {
97
- displayText: string | null;
102
+ displayText: null | string;
98
103
  meta: Meta;
99
104
  rawUrl?: string;
100
- title: string | null;
105
+ title: null | string;
101
106
  url: string;
102
107
  }
103
108
 
@@ -109,3 +114,5 @@ interface ResolveResult {
109
114
 
110
115
  // (No @packageDocumentation comment for this package)
111
116
  ```
117
+
118
+ <!--SECTION END: Main Entry Types-->
@@ -0,0 +1,93 @@
1
+ ## API Report File for "@atlaskit/link-picker"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="react" />
8
+
9
+ import { MessageDescriptor } from 'react-intl-next';
10
+ import { default as React_2 } from 'react';
11
+ import { ReactNode } from 'react';
12
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
13
+
14
+ // @public (undocumented)
15
+ export type LinkInputType = 'manual' | 'typeAhead';
16
+
17
+ // @public (undocumented)
18
+ export const LinkPicker: React_2.MemoExoticComponent<(props: LinkPickerProps) => JSX.Element>;
19
+
20
+ // @public (undocumented)
21
+ export interface LinkPickerPlugin {
22
+ errorFallback?: LinkPickerPluginErrorFallback;
23
+ meta?: {
24
+ source?: string;
25
+ };
26
+ // (undocumented)
27
+ resolve: (state: LinkPickerState) => AsyncGenerator<ResolveResult, ResolveResult> | Promise<ResolveResult>;
28
+ tabKey?: string;
29
+ tabTitle?: string;
30
+ }
31
+
32
+ // @public (undocumented)
33
+ export type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
34
+
35
+ // @public (undocumented)
36
+ export interface LinkPickerProps {
37
+ component?: React.ComponentType<Partial<LinkPickerProps> & {
38
+ children: React.ReactElement;
39
+ }>;
40
+ displayText?: null | string;
41
+ onCancel: () => void;
42
+ onContentResize?: () => void;
43
+ onSubmit: (arg: OnSubmitParameter, analytic?: UIAnalyticsEvent | null) => void;
44
+ plugins?: LinkPickerPlugin[];
45
+ url?: string;
46
+ }
47
+
48
+ // @public (undocumented)
49
+ export interface LinkPickerState {
50
+ query: string;
51
+ }
52
+
53
+ // @public (undocumented)
54
+ export interface LinkSearchListItemData {
55
+ container?: string;
56
+ icon: React.ComponentType<{
57
+ alt: string;
58
+ }> | string;
59
+ iconAlt: MessageDescriptor | string;
60
+ lastUpdatedDate?: Date;
61
+ lastViewedDate?: Date;
62
+ meta?: {
63
+ source?: string;
64
+ };
65
+ name: string;
66
+ objectId: string;
67
+ prefetch?: boolean;
68
+ url: string;
69
+ }
70
+
71
+ // @public (undocumented)
72
+ interface Meta {
73
+ inputMethod: LinkInputType;
74
+ }
75
+
76
+ // @public (undocumented)
77
+ interface OnSubmitParameter {
78
+ displayText: null | string;
79
+ meta: Meta;
80
+ rawUrl?: string;
81
+ title: null | string;
82
+ url: string;
83
+ }
84
+
85
+ // @public (undocumented)
86
+ interface ResolveResult {
87
+ // (undocumented)
88
+ data: LinkSearchListItemData[];
89
+ }
90
+
91
+ // (No @packageDocumentation comment for this package)
92
+
93
+ ```