@atlaskit/link-picker 1.16.8 → 1.16.10

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 (154) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics.codegen.js +3 -4
  3. package/dist/cjs/common/analytics/context.js +11 -36
  4. package/dist/cjs/common/analytics/experiences.js +0 -13
  5. package/dist/cjs/common/analytics/index.js +0 -2
  6. package/dist/cjs/common/analytics/input-field-tracking.js +16 -35
  7. package/dist/cjs/common/generic-error-svg/index.js +1 -7
  8. package/dist/cjs/common/generic-error-svg/styled.js +0 -6
  9. package/dist/cjs/common/utils/errors.js +0 -15
  10. package/dist/cjs/controllers/session-provider/index.js +1 -17
  11. package/dist/cjs/controllers/use-fix-height/index.js +0 -3
  12. package/dist/cjs/i18n/cs.js +0 -1
  13. package/dist/cjs/i18n/da.js +0 -1
  14. package/dist/cjs/i18n/de.js +0 -1
  15. package/dist/cjs/i18n/en.js +0 -1
  16. package/dist/cjs/i18n/en_GB.js +0 -1
  17. package/dist/cjs/i18n/es.js +0 -1
  18. package/dist/cjs/i18n/fi.js +0 -1
  19. package/dist/cjs/i18n/fr.js +0 -1
  20. package/dist/cjs/i18n/hu.js +0 -1
  21. package/dist/cjs/i18n/it.js +0 -1
  22. package/dist/cjs/i18n/ja.js +0 -1
  23. package/dist/cjs/i18n/ko.js +0 -1
  24. package/dist/cjs/i18n/nb.js +0 -1
  25. package/dist/cjs/i18n/nl.js +0 -1
  26. package/dist/cjs/i18n/pl.js +0 -1
  27. package/dist/cjs/i18n/pt_BR.js +0 -1
  28. package/dist/cjs/i18n/ru.js +0 -1
  29. package/dist/cjs/i18n/sv.js +0 -1
  30. package/dist/cjs/i18n/th.js +0 -1
  31. package/dist/cjs/i18n/tr.js +0 -1
  32. package/dist/cjs/i18n/uk.js +0 -1
  33. package/dist/cjs/i18n/vi.js +0 -1
  34. package/dist/cjs/i18n/zh.js +0 -1
  35. package/dist/cjs/i18n/zh_TW.js +0 -1
  36. package/dist/cjs/index.js +0 -2
  37. package/dist/cjs/services/use-plugins/index.js +13 -44
  38. package/dist/cjs/services/use-plugins/reducer.js +0 -13
  39. package/dist/cjs/services/use-plugins/utils.js +9 -35
  40. package/dist/cjs/services/use-search-query/index.js +3 -9
  41. package/dist/cjs/ui/error-boundary/error-boundary-base/index.js +2 -22
  42. package/dist/cjs/ui/error-boundary/error-boundary-fallback/index.js +1 -9
  43. package/dist/cjs/ui/error-boundary/index.js +3 -18
  44. package/dist/cjs/ui/index.js +0 -13
  45. package/dist/cjs/ui/link-picker/announcer.js +15 -25
  46. package/dist/cjs/ui/link-picker/browser.js +0 -1
  47. package/dist/cjs/ui/link-picker/form-footer/index.js +6 -26
  48. package/dist/cjs/ui/link-picker/form-footer/styled.js +0 -5
  49. package/dist/cjs/ui/link-picker/form-footer/utils.js +2 -8
  50. package/dist/cjs/ui/link-picker/index.js +44 -111
  51. package/dist/cjs/ui/link-picker/link-search-error/index.js +1 -10
  52. package/dist/cjs/ui/link-picker/link-search-list/index.js +12 -38
  53. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/index.js +1 -9
  54. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +1 -5
  55. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/styled.js +0 -6
  56. package/dist/cjs/ui/link-picker/link-search-list/link-search-no-results/styled.js +0 -5
  57. package/dist/cjs/ui/link-picker/link-search-list/styled.js +0 -7
  58. package/dist/cjs/ui/link-picker/link-search-list/use-track-results-shown/index.js +11 -21
  59. package/dist/cjs/ui/link-picker/list-item/index.js +11 -32
  60. package/dist/cjs/ui/link-picker/list-item/styled.js +0 -13
  61. package/dist/cjs/ui/link-picker/messages.js +0 -2
  62. package/dist/cjs/ui/link-picker/styled.js +1 -8
  63. package/dist/cjs/ui/link-picker/text-input/index.js +9 -26
  64. package/dist/cjs/ui/link-picker/text-input/styled.js +0 -7
  65. package/dist/cjs/ui/link-picker/track-mount/index.js +1 -11
  66. package/dist/cjs/ui/link-picker/track-tab-viewed/index.js +2 -10
  67. package/dist/cjs/ui/link-picker/transformTimeStamp.js +0 -13
  68. package/dist/cjs/ui/link-picker/utils.js +11 -19
  69. package/dist/cjs/ui/loader-fallback/index.js +1 -5
  70. package/dist/cjs/ui/scrolling-tabs/index.js +6 -44
  71. package/dist/cjs/ui/scrolling-tabs/scrolling-tabs.js +4 -33
  72. package/dist/cjs/ui/scrolling-tabs/styles.js +0 -3
  73. package/dist/cjs/version.json +1 -1
  74. package/dist/es2019/analytics.codegen.js +3 -3
  75. package/dist/es2019/common/analytics/context.js +11 -13
  76. package/dist/es2019/common/analytics/experiences.js +0 -1
  77. package/dist/es2019/common/analytics/input-field-tracking.js +13 -12
  78. package/dist/es2019/common/generic-error-svg/index.js +0 -4
  79. package/dist/es2019/common/utils/errors.js +0 -1
  80. package/dist/es2019/controllers/session-provider/index.js +0 -4
  81. package/dist/es2019/controllers/use-fix-height/index.js +0 -2
  82. package/dist/es2019/services/use-plugins/index.js +2 -8
  83. package/dist/es2019/services/use-plugins/reducer.js +8 -8
  84. package/dist/es2019/services/use-plugins/utils.js +5 -6
  85. package/dist/es2019/services/use-search-query/index.js +3 -6
  86. package/dist/es2019/ui/error-boundary/error-boundary-base/index.js +0 -5
  87. package/dist/es2019/ui/error-boundary/index.js +2 -4
  88. package/dist/es2019/ui/index.js +1 -2
  89. package/dist/es2019/ui/link-picker/announcer.js +6 -1
  90. package/dist/es2019/ui/link-picker/browser.js +0 -2
  91. package/dist/es2019/ui/link-picker/form-footer/index.js +0 -5
  92. package/dist/es2019/ui/link-picker/form-footer/utils.js +2 -5
  93. package/dist/es2019/ui/link-picker/index.js +21 -37
  94. package/dist/es2019/ui/link-picker/link-search-error/index.js +0 -3
  95. package/dist/es2019/ui/link-picker/link-search-list/index.js +2 -6
  96. package/dist/es2019/ui/link-picker/link-search-list/link-search-no-results/index.js +0 -2
  97. package/dist/es2019/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +0 -3
  98. package/dist/es2019/ui/link-picker/link-search-list/styled.js +2 -2
  99. package/dist/es2019/ui/link-picker/link-search-list/use-track-results-shown/index.js +7 -5
  100. package/dist/es2019/ui/link-picker/list-item/index.js +0 -14
  101. package/dist/es2019/ui/link-picker/list-item/styled.js +2 -4
  102. package/dist/es2019/ui/link-picker/styled.js +1 -1
  103. package/dist/es2019/ui/link-picker/text-input/index.js +0 -6
  104. package/dist/es2019/ui/link-picker/track-mount/index.js +1 -2
  105. package/dist/es2019/ui/link-picker/track-tab-viewed/index.js +0 -2
  106. package/dist/es2019/ui/link-picker/transformTimeStamp.js +0 -7
  107. package/dist/es2019/ui/link-picker/utils.js +7 -5
  108. package/dist/es2019/ui/scrolling-tabs/index.js +2 -14
  109. package/dist/es2019/ui/scrolling-tabs/scrolling-tabs.js +0 -14
  110. package/dist/es2019/version.json +1 -1
  111. package/dist/esm/analytics.codegen.js +3 -3
  112. package/dist/esm/common/analytics/context.js +11 -21
  113. package/dist/esm/common/analytics/experiences.js +0 -3
  114. package/dist/esm/common/analytics/input-field-tracking.js +16 -22
  115. package/dist/esm/common/generic-error-svg/index.js +0 -4
  116. package/dist/esm/common/generic-error-svg/styled.js +0 -2
  117. package/dist/esm/common/utils/errors.js +0 -8
  118. package/dist/esm/controllers/session-provider/index.js +1 -7
  119. package/dist/esm/controllers/use-fix-height/index.js +0 -2
  120. package/dist/esm/services/use-plugins/index.js +13 -31
  121. package/dist/esm/services/use-plugins/reducer.js +0 -7
  122. package/dist/esm/services/use-plugins/utils.js +9 -22
  123. package/dist/esm/services/use-search-query/index.js +3 -6
  124. package/dist/esm/ui/error-boundary/error-boundary-base/index.js +2 -13
  125. package/dist/esm/ui/error-boundary/index.js +3 -5
  126. package/dist/esm/ui/index.js +1 -2
  127. package/dist/esm/ui/link-picker/announcer.js +20 -17
  128. package/dist/esm/ui/link-picker/browser.js +0 -2
  129. package/dist/esm/ui/link-picker/form-footer/index.js +6 -12
  130. package/dist/esm/ui/link-picker/form-footer/styled.js +0 -2
  131. package/dist/esm/ui/link-picker/form-footer/utils.js +2 -5
  132. package/dist/esm/ui/link-picker/index.js +44 -74
  133. package/dist/esm/ui/link-picker/link-search-error/index.js +0 -3
  134. package/dist/esm/ui/link-picker/link-search-list/index.js +12 -20
  135. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/index.js +0 -2
  136. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.js +0 -3
  137. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/styled.js +0 -2
  138. package/dist/esm/ui/link-picker/link-search-list/link-search-no-results/styled.js +0 -2
  139. package/dist/esm/ui/link-picker/link-search-list/styled.js +2 -4
  140. package/dist/esm/ui/link-picker/link-search-list/use-track-results-shown/index.js +11 -11
  141. package/dist/esm/ui/link-picker/list-item/index.js +10 -25
  142. package/dist/esm/ui/link-picker/list-item/styled.js +2 -6
  143. package/dist/esm/ui/link-picker/styled.js +1 -3
  144. package/dist/esm/ui/link-picker/text-input/index.js +9 -16
  145. package/dist/esm/ui/link-picker/text-input/styled.js +0 -2
  146. package/dist/esm/ui/link-picker/track-mount/index.js +2 -4
  147. package/dist/esm/ui/link-picker/track-tab-viewed/index.js +1 -5
  148. package/dist/esm/ui/link-picker/transformTimeStamp.js +0 -7
  149. package/dist/esm/ui/link-picker/utils.js +11 -9
  150. package/dist/esm/ui/scrolling-tabs/index.js +6 -28
  151. package/dist/esm/ui/scrolling-tabs/scrolling-tabs.js +4 -19
  152. package/dist/esm/version.json +1 -1
  153. package/dist/types/analytics.codegen.d.ts +2 -2
  154. package/package.json +8 -13
@@ -6,18 +6,16 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
6
  import { ANALYTICS_CHANNEL } from '../constants';
7
7
  import createEventPayload from '../../analytics.codegen';
8
8
  import { useLinkPickerAnalytics } from '.';
9
-
10
9
  var isEventWithInputType = function isEventWithInputType(e) {
11
10
  return _typeof(e) === 'object' && e !== null && 'inputType' in e;
12
11
  };
13
-
14
12
  var getChangeEventInputMethodType = function getChangeEventInputMethodType(event) {
15
13
  if (isEventWithInputType(event.nativeEvent) && typeof event.nativeEvent.inputType === 'string' && event.nativeEvent.inputType.includes('insertFromPaste')) {
16
14
  return 'paste';
17
15
  }
18
-
19
16
  return 'manual';
20
17
  };
18
+
21
19
  /**
22
20
  * Wraps an input field and connects it to the link picker analytics context to provide a baseline of analytics tracking
23
21
  * @param WrappedComponent The input field to be tracked
@@ -25,60 +23,56 @@ var getChangeEventInputMethodType = function getChangeEventInputMethodType(event
25
23
  * @param filterOnChangeEventAttrs Function to hook into and filter/customise the default attribute tracking logic
26
24
  * @returns HOC Input field with tracking
27
25
  */
28
-
29
-
30
26
  export var withInputFieldTracking = function withInputFieldTracking(WrappedComponent, field) {
31
27
  var filterOnChangeEventAttrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (_, attributes) {
32
28
  return attributes;
33
29
  };
34
30
  return function (props) {
35
31
  var onBlur = props.onBlur,
36
- onChange = props.onChange,
37
- onClear = props.onClear,
38
- onFocus = props.onFocus;
39
-
32
+ onChange = props.onChange,
33
+ onClear = props.onClear,
34
+ onFocus = props.onFocus;
40
35
  var _useLinkPickerAnalyti = useLinkPickerAnalytics(),
41
- trackAttribute = _useLinkPickerAnalyti.trackAttribute,
42
- trackAttributes = _useLinkPickerAnalyti.trackAttributes;
43
-
36
+ trackAttribute = _useLinkPickerAnalyti.trackAttribute,
37
+ trackAttributes = _useLinkPickerAnalyti.trackAttributes;
44
38
  var _useAnalyticsEvents = useAnalyticsEvents(),
45
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // Ref to track if the value of the field has changed between focus and blur
46
-
39
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
47
40
 
48
- var valueOnFocus = useRef(null); // Track the content and input method on every direct change to the input
41
+ // Ref to track if the value of the field has changed between focus and blur
42
+ var valueOnFocus = useRef(null);
49
43
 
44
+ // Track the content and input method on every direct change to the input
50
45
  var handleOnChange = useCallback(function (event) {
51
46
  var _filterOnChangeEventA;
52
-
53
47
  // TODO: See above re template literal, improve typesafety here
54
48
  // trackAttribute(`${field}FieldContent`, contentTypeFn(event.currentTarget.value));
55
49
  // trackAttribute(`${field}FieldContentInputMethod`, methodTypeFn(event));
56
50
  trackAttributes(filterOnChangeEventAttrs(event, (_filterOnChangeEventA = {}, _defineProperty(_filterOnChangeEventA, "".concat(field, "FieldContent"), Boolean(event.currentTarget.value) ? 'text_string' : null), _defineProperty(_filterOnChangeEventA, "".concat(field, "FieldContentInputMethod"), getChangeEventInputMethodType(event)), _filterOnChangeEventA)));
57
51
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
58
- }, [onChange, trackAttributes]); // Store the value of the field at the time the field is focused so we can know if it changes when the user's focus leaves
52
+ }, [onChange, trackAttributes]);
59
53
 
54
+ // Store the value of the field at the time the field is focused so we can know if it changes when the user's focus leaves
60
55
  var handleOnFocus = useCallback(function (event) {
61
56
  valueOnFocus.current = event.currentTarget.value;
62
57
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
63
- }, [onFocus]); // Fire updated events only when the user's focus leaves the field
58
+ }, [onFocus]);
64
59
 
60
+ // Fire updated events only when the user's focus leaves the field
65
61
  var handleOnBlur = useCallback(function (event) {
66
62
  // Only fire if the value has changed since the field was focused (we are only concerned with the net change to the field)
67
63
  if (event.currentTarget.value !== valueOnFocus.current) {
68
64
  createAnalyticsEvent(createEventPayload("ui.textField.updated.".concat(field, "Field"), {})).fire(ANALYTICS_CHANNEL);
69
65
  }
70
-
71
66
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
72
- }, [onBlur, createAnalyticsEvent]); // Track the values as null when the text field is cleared
67
+ }, [onBlur, createAnalyticsEvent]);
73
68
 
69
+ // Track the values as null when the text field is cleared
74
70
  var handleOnClear = useCallback(function () {
75
71
  trackAttribute("".concat(field, "FieldContent"), null);
76
72
  trackAttribute("".concat(field, "FieldContentInputMethod"), null);
77
-
78
73
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
79
74
  args[_key] = arguments[_key];
80
75
  }
81
-
82
76
  onClear === null || onClear === void 0 ? void 0 : onClear.apply(void 0, args);
83
77
  }, [onClear, trackAttribute]);
84
78
  return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
@@ -1,11 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
4
-
5
3
  /** @jsx jsx */
6
4
  import { jsx } from '@emotion/react';
7
5
  import { genericErrorStyles } from './styled';
8
-
9
6
  var GenericErrorSVG = function GenericErrorSVG(props) {
10
7
  var id = 'link-picker-ui-generic-error-svg';
11
8
  return jsx("svg", _extends({
@@ -52,5 +49,4 @@ var GenericErrorSVG = function GenericErrorSVG(props) {
52
49
  stopOpacity: ".6"
53
50
  }))));
54
51
  };
55
-
56
52
  export default GenericErrorSVG;
@@ -1,7 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
2
  var _templateObject;
4
-
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
6
4
  import { css } from '@emotion/react';
7
5
  var HEIGHT = 90;
@@ -4,27 +4,19 @@ import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
7
-
8
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
-
10
8
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
-
12
9
  export var UnauthenticatedError = /*#__PURE__*/function (_Error) {
13
10
  _inherits(UnauthenticatedError, _Error);
14
-
15
11
  var _super = _createSuper(UnauthenticatedError);
16
-
17
12
  function UnauthenticatedError(iconUrl, authUrl, description) {
18
13
  var _this;
19
-
20
14
  _classCallCheck(this, UnauthenticatedError);
21
-
22
15
  _this = _super.call(this, 'The user is not authenticated');
23
16
  _this.iconUrl = iconUrl;
24
17
  _this.authUrl = authUrl;
25
18
  _this.description = description;
26
19
  return _this;
27
20
  }
28
-
29
21
  return _createClass(UnauthenticatedError);
30
22
  }( /*#__PURE__*/_wrapNativeSuper(Error));
@@ -3,24 +3,18 @@ import { v4 as uuidv4 } from 'uuid';
3
3
  import { abortUfoExperience, startUfoExperience, ufoExperience } from '../../common/analytics/experiences';
4
4
  export var INIT_CONTEXT = 'SESSION_UNINITIALIZED';
5
5
  export var SessionContext = /*#__PURE__*/createContext(INIT_CONTEXT);
6
-
7
6
  var useConstructor = function useConstructor(callback) {
8
7
  var hasBeenFired = useRef(false);
9
-
10
8
  if (!hasBeenFired.current) {
11
9
  callback();
12
10
  hasBeenFired.current = true;
13
11
  }
14
-
15
12
  return null;
16
13
  };
17
-
18
14
  export var LinkPickerSessionProvider = function LinkPickerSessionProvider(_ref) {
19
15
  var children = _ref.children;
20
-
21
16
  var _useRef = useRef(uuidv4()),
22
- sessionId = _useRef.current;
23
-
17
+ sessionId = _useRef.current;
24
18
  useEffect(function () {
25
19
  return function () {
26
20
  return abortUfoExperience(ufoExperience.mounted, sessionId);
@@ -1,5 +1,4 @@
1
1
  import { useLayoutEffect, useRef } from 'react';
2
-
3
2
  var useFixHeight = function useFixHeight(shouldFixHeight) {
4
3
  var ref = useRef(null);
5
4
  var currentHeight = useRef(null);
@@ -15,5 +14,4 @@ var useFixHeight = function useFixHeight(shouldFixHeight) {
15
14
  } : undefined
16
15
  };
17
16
  };
18
-
19
17
  export default useFixHeight;
@@ -11,20 +11,18 @@ import { CancellationError, resolvePluginUpdates } from './utils';
11
11
  import { usePluginReducer } from './reducer';
12
12
  export function usePlugins(state, activeTab, plugins) {
13
13
  var _useAnalyticsEvents = useAnalyticsEvents(),
14
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
15
-
14
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
16
15
  var _useState = useState(0),
17
- _useState2 = _slicedToArray(_useState, 2),
18
- retries = _useState2[0],
19
- setRetries = _useState2[1];
20
-
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ retries = _useState2[0],
18
+ setRetries = _useState2[1];
21
19
  var _usePluginReducer = usePluginReducer(),
22
- _usePluginReducer2 = _slicedToArray(_usePluginReducer, 2),
23
- pluginState = _usePluginReducer2[0],
24
- dispatch = _usePluginReducer2[1];
25
-
26
- var activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab]; // This useEffect block must be called before any other to ensure onActivation is fired at before resolve
20
+ _usePluginReducer2 = _slicedToArray(_usePluginReducer, 2),
21
+ pluginState = _usePluginReducer2[0],
22
+ dispatch = _usePluginReducer2[1];
23
+ var activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab];
27
24
 
25
+ // This useEffect block must be called before any other to ensure onActivation is fired at before resolve
28
26
  useEffect(function () {
29
27
  if (activePlugin && activePlugin.UNSAFE_onActivation) {
30
28
  activePlugin.UNSAFE_onActivation();
@@ -34,42 +32,34 @@ export function usePlugins(state, activeTab, plugins) {
34
32
  if (!activePlugin) {
35
33
  return;
36
34
  }
37
-
38
35
  if (!state) {
39
36
  dispatch({
40
37
  type: 'CLEAR'
41
38
  });
42
39
  return;
43
40
  }
44
-
45
41
  dispatch({
46
42
  type: 'LOADING'
47
43
  });
48
-
49
44
  var _resolvePluginUpdates = resolvePluginUpdates(activePlugin, state),
50
- next = _resolvePluginUpdates.next,
51
- cancel = _resolvePluginUpdates.cancel;
52
-
45
+ next = _resolvePluginUpdates.next,
46
+ cancel = _resolvePluginUpdates.cancel;
53
47
  var updateResults = /*#__PURE__*/function () {
54
48
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
55
49
  var _isLoading, _yield$next, value, done;
56
-
57
50
  return _regeneratorRuntime.wrap(function _callee$(_context) {
58
51
  while (1) {
59
52
  switch (_context.prev = _context.next) {
60
53
  case 0:
61
54
  _context.prev = 0;
62
55
  _isLoading = true;
63
-
64
56
  case 2:
65
57
  if (!_isLoading) {
66
58
  _context.next = 12;
67
59
  break;
68
60
  }
69
-
70
61
  _context.next = 5;
71
62
  return next();
72
-
73
63
  case 5:
74
64
  _yield$next = _context.sent;
75
65
  value = _yield$next.value;
@@ -84,15 +74,12 @@ export function usePlugins(state, activeTab, plugins) {
84
74
  });
85
75
  _context.next = 2;
86
76
  break;
87
-
88
77
  case 12:
89
78
  _context.next = 17;
90
79
  break;
91
-
92
80
  case 14:
93
81
  _context.prev = 14;
94
82
  _context.t0 = _context["catch"](0);
95
-
96
83
  if (!(_context.t0 instanceof CancellationError)) {
97
84
  dispatch({
98
85
  type: 'ERROR',
@@ -102,7 +89,6 @@ export function usePlugins(state, activeTab, plugins) {
102
89
  error: convertToError(_context.t0).toString()
103
90
  })).fire(ANALYTICS_CHANNEL);
104
91
  }
105
-
106
92
  case 17:
107
93
  case "end":
108
94
  return _context.stop();
@@ -110,12 +96,10 @@ export function usePlugins(state, activeTab, plugins) {
110
96
  }
111
97
  }, _callee, null, [[0, 14]]);
112
98
  }));
113
-
114
99
  return function updateResults() {
115
100
  return _ref.apply(this, arguments);
116
101
  };
117
102
  }();
118
-
119
103
  updateResults();
120
104
  return cancel;
121
105
  }, [activePlugin, state, retries, createAnalyticsEvent, dispatch]);
@@ -123,7 +107,6 @@ export function usePlugins(state, activeTab, plugins) {
123
107
  if (!plugins || plugins.length <= 1) {
124
108
  return [];
125
109
  }
126
-
127
110
  return plugins.filter(function (plugin) {
128
111
  return !!plugin.tabTitle;
129
112
  }).map(function (plugin) {
@@ -138,8 +121,8 @@ export function usePlugins(state, activeTab, plugins) {
138
121
  });
139
122
  }, []);
140
123
  var items = pluginState.items,
141
- isLoading = pluginState.isLoading,
142
- error = pluginState.error;
124
+ isLoading = pluginState.isLoading,
125
+ error = pluginState.error;
143
126
  return {
144
127
  tabs: tabs,
145
128
  items: items,
@@ -151,7 +134,6 @@ export function usePlugins(state, activeTab, plugins) {
151
134
  errorFallback: activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.errorFallback
152
135
  };
153
136
  }
154
-
155
137
  function limit(items) {
156
138
  return items.slice(0, RECENT_SEARCH_LIST_SIZE);
157
139
  }
@@ -1,9 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  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; }
6
-
7
4
  import { useReducer } from 'react';
8
5
  export var ACTION_CLEAR = 'CLEAR';
9
6
  export var ACTION_LOADING = 'LOADING';
@@ -18,22 +15,18 @@ export function reducer(state, action) {
18
15
  switch (action.type) {
19
16
  case ACTION_CLEAR:
20
17
  return _objectSpread({}, INITIAL_STATE);
21
-
22
18
  case ACTION_LOADING:
23
19
  return _objectSpread(_objectSpread({}, INITIAL_STATE), {}, {
24
20
  isLoading: true
25
21
  });
26
-
27
22
  case ACTION_SUCCESS:
28
23
  return _objectSpread(_objectSpread(_objectSpread({}, state), action.payload), {}, {
29
24
  error: null
30
25
  });
31
-
32
26
  case ACTION_ERRORED:
33
27
  return _objectSpread(_objectSpread({}, INITIAL_STATE), {}, {
34
28
  error: action.payload
35
29
  });
36
-
37
30
  default:
38
31
  return state;
39
32
  }
@@ -6,22 +6,15 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
-
10
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
11
  export var CancellationError = /*#__PURE__*/function (_Error) {
15
12
  _inherits(CancellationError, _Error);
16
-
17
13
  var _super = _createSuper(CancellationError);
18
-
19
14
  function CancellationError() {
20
15
  _classCallCheck(this, CancellationError);
21
-
22
16
  return _super.apply(this, arguments);
23
17
  }
24
-
25
18
  return _createClass(CancellationError);
26
19
  }( /*#__PURE__*/_wrapNativeSuper(Error));
27
20
  export var cancellable = function cancellable(promise) {
@@ -36,19 +29,19 @@ export var cancellable = function cancellable(promise) {
36
29
  }
37
30
  };
38
31
  };
32
+
39
33
  /**
40
34
  * Wraps the resolve with a cancellation wrapper and makes promise + generator plugin resolves more compatible
41
35
  * Calling cancel for generator plugin prevents it from yielding any further updates
42
36
  */
43
-
44
37
  export var resolvePluginUpdates = function resolvePluginUpdates(plugin, state) {
45
- var updates = plugin.resolve(state); // Promise plugin
38
+ var updates = plugin.resolve(state);
46
39
 
40
+ // Promise plugin
47
41
  if (updates instanceof Promise) {
48
42
  var _cancellable = cancellable(updates),
49
- promise = _cancellable.promise,
50
- cancel = _cancellable.cancel;
51
-
43
+ promise = _cancellable.promise,
44
+ cancel = _cancellable.cancel;
52
45
  return {
53
46
  cancel: cancel,
54
47
  next: function () {
@@ -59,14 +52,12 @@ export var resolvePluginUpdates = function resolvePluginUpdates(plugin, state) {
59
52
  case 0:
60
53
  _context.next = 2;
61
54
  return promise;
62
-
63
55
  case 2:
64
56
  _context.t0 = _context.sent;
65
57
  return _context.abrupt("return", {
66
58
  value: _context.t0,
67
59
  done: true
68
60
  });
69
-
70
61
  case 4:
71
62
  case "end":
72
63
  return _context.stop();
@@ -74,17 +65,15 @@ export var resolvePluginUpdates = function resolvePluginUpdates(plugin, state) {
74
65
  }
75
66
  }, _callee);
76
67
  }));
77
-
78
68
  function next() {
79
69
  return _next.apply(this, arguments);
80
70
  }
81
-
82
71
  return next;
83
72
  }()
84
73
  };
85
- } // Generator plugin
86
-
74
+ }
87
75
 
76
+ // Generator plugin
88
77
  var cancellationCallbacks = [];
89
78
  var cancelled = false;
90
79
  return {
@@ -96,15 +85,13 @@ export var resolvePluginUpdates = function resolvePluginUpdates(plugin, state) {
96
85
  },
97
86
  next: function next() {
98
87
  var _cancellable2 = cancellable(updates.next()),
99
- promise = _cancellable2.promise,
100
- cancel = _cancellable2.cancel;
101
-
88
+ promise = _cancellable2.promise,
89
+ cancel = _cancellable2.cancel;
102
90
  if (cancelled) {
103
91
  cancel();
104
92
  } else {
105
93
  cancellationCallbacks.push(cancel);
106
94
  }
107
-
108
95
  return promise;
109
96
  }
110
97
  };
@@ -2,33 +2,30 @@ import { useRef } from 'react';
2
2
  import { isSafeUrl } from '@atlaskit/linking-common/url';
3
3
  export function useSearchQuery(state) {
4
4
  var _queryState$current;
5
-
6
5
  var queryState = useRef(null);
6
+
7
7
  /*
8
8
  * When state contains a valid url AND is NOT selected from results, and the url was updated
9
9
  * from the textbox, queryState should be null to clear the items in plugin state.
10
10
  *
11
11
  * Checking `lastEditedBy` prevents the items being cleared when the tab is changed.
12
12
  */
13
-
14
13
  if (isSafeUrl(state.url) && state.selectedIndex === -1 && !state.preventHidingRecents) {
15
14
  queryState.current = null;
16
15
  }
16
+
17
17
  /*
18
18
  * When state contains a search term e.g. Not a valid url return a query
19
19
  */
20
-
21
-
22
20
  if (((_queryState$current = queryState.current) === null || _queryState$current === void 0 ? void 0 : _queryState$current.query) !== state.url && !isSafeUrl(state.url)) {
23
21
  queryState.current = {
24
22
  query: state.url
25
23
  };
26
24
  }
25
+
27
26
  /*
28
27
  * When state contains a valid url and is selected from the list
29
28
  * return current state to prevent triger a new plugin search
30
29
  */
31
-
32
-
33
30
  return queryState.current;
34
31
  }
@@ -3,30 +3,22 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
-
7
6
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
-
9
7
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
8
  import React, { Component } from 'react';
12
9
  // eslint-disable-next-line @repo/internal/react/no-class-components
13
10
  export var BaseErrorBoundary = /*#__PURE__*/function (_Component) {
14
11
  _inherits(BaseErrorBoundary, _Component);
15
-
16
12
  var _super = _createSuper(BaseErrorBoundary);
17
-
18
13
  function BaseErrorBoundary(props) {
19
14
  var _this;
20
-
21
15
  _classCallCheck(this, BaseErrorBoundary);
22
-
23
16
  _this = _super.call(this, props);
24
17
  _this.state = {
25
18
  hasError: false
26
19
  };
27
20
  return _this;
28
21
  }
29
-
30
22
  _createClass(BaseErrorBoundary, [{
31
23
  key: "componentDidCatch",
32
24
  value: function componentDidCatch(error, info) {
@@ -40,17 +32,14 @@ export var BaseErrorBoundary = /*#__PURE__*/function (_Component) {
40
32
  key: "render",
41
33
  value: function render() {
42
34
  var _this$props = this.props,
43
- children = _this$props.children,
44
- ErrorComponent = _this$props.ErrorComponent;
35
+ children = _this$props.children,
36
+ ErrorComponent = _this$props.ErrorComponent;
45
37
  var hasError = this.state.hasError;
46
-
47
38
  if (hasError && ErrorComponent) {
48
39
  return /*#__PURE__*/React.createElement(ErrorComponent, null);
49
40
  }
50
-
51
41
  return children;
52
42
  }
53
43
  }]);
54
-
55
44
  return BaseErrorBoundary;
56
45
  }(Component);
@@ -6,21 +6,20 @@ import { failUfoExperience, ufoExperience } from '../../common/analytics/experie
6
6
  import { useLinkPickerSessionId } from '../../controllers/session-provider';
7
7
  import { ErrorBoundaryFallback } from './error-boundary-fallback';
8
8
  import { BaseErrorBoundary } from './error-boundary-base';
9
-
10
9
  function ErrorBoundary(_ref) {
11
10
  var children = _ref.children,
12
- createAnalyticsEvent = _ref.createAnalyticsEvent;
11
+ createAnalyticsEvent = _ref.createAnalyticsEvent;
13
12
  var linkPickerSessionId = useLinkPickerSessionId();
14
13
  var handleError = useCallback(function (error, info) {
15
14
  var _window, _window$navigator, _info$componentStack;
16
-
17
15
  // Fire Analytics event
18
16
  createAnalyticsEvent(createEventPayload('ui.linkPicker.unhandledErrorCaught', {
19
17
  browserInfo: ((_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent) || 'unknown',
20
18
  error: error.toString(),
21
19
  componentStack: (_info$componentStack = info === null || info === void 0 ? void 0 : info.componentStack) !== null && _info$componentStack !== void 0 ? _info$componentStack : ''
22
- })).fire(ANALYTICS_CHANNEL); // Fire UFO failed experience
20
+ })).fire(ANALYTICS_CHANNEL);
23
21
 
22
+ // Fire UFO failed experience
24
23
  failUfoExperience(ufoExperience.mounted, linkPickerSessionId);
25
24
  }, [createAnalyticsEvent, linkPickerSessionId]);
26
25
  return /*#__PURE__*/React.createElement(BaseErrorBoundary, {
@@ -28,5 +27,4 @@ function ErrorBoundary(_ref) {
28
27
  ErrorComponent: ErrorBoundaryFallback
29
28
  }, children);
30
29
  }
31
-
32
30
  export default withAnalyticsEvents()(ErrorBoundary);
@@ -13,8 +13,7 @@ export var PACKAGE_DATA = {
13
13
  source: COMPONENT_NAME
14
14
  };
15
15
  var LazyLinkPicker = lazyForPaint(function () {
16
- return import(
17
- /* webpackChunkName: "@atlaskit-internal_link-picker" */
16
+ return import( /* webpackChunkName: "@atlaskit-internal_link-picker" */
18
17
  './link-picker');
19
18
  });
20
19
  export var ComposedLinkPicker = /*#__PURE__*/memo(function (props) {
@@ -1,34 +1,37 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { forwardRef, memo, useState, useEffect } from 'react'; // How to use:
2
+ import React, { forwardRef, memo, useState, useEffect } from 'react';
3
+
4
+ // How to use:
3
5
  // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles
4
6
  // Demo: https://dequeuniversity.com/library/aria/liveregion-playground
7
+
5
8
  // Important: Strongly recommend test your solution in all supported screen readers
6
9
  // if you use non default value of properties: ariaAtomic, ariaLive, ariaRelevant, role
10
+
7
11
  // Note: Text won't be announced if the text message doesn't change after the render.
8
12
  // For using a forced announcement in this case, set the 'key' attribute - key={Date.now()}
9
13
 
10
14
  // Note: Flag 'contentRendered' resolves bug with duplicates messages (NVDA + Firefox)
11
15
  // https://github.com/nvaccess/nvda/labels/bug%2Fdouble-speaking
16
+
12
17
  var timer;
13
18
  var Announcer = /*#__PURE__*/forwardRef(function (_ref, ref) {
14
19
  var _ref$ariaAtomic = _ref.ariaAtomic,
15
- ariaAtomic = _ref$ariaAtomic === void 0 ? 'true' : _ref$ariaAtomic,
16
- _ref$ariaLive = _ref.ariaLive,
17
- ariaLive = _ref$ariaLive === void 0 ? 'polite' : _ref$ariaLive,
18
- _ref$ariaRelevant = _ref.ariaRelevant,
19
- ariaRelevant = _ref$ariaRelevant === void 0 ? 'all' : _ref$ariaRelevant,
20
- _ref$role = _ref.role,
21
- role = _ref$role === void 0 ? 'status' : _ref$role,
22
- _ref$text = _ref.text,
23
- text = _ref$text === void 0 ? '' : _ref$text,
24
- _ref$delay = _ref.delay,
25
- delay = _ref$delay === void 0 ? 0 : _ref$delay;
26
-
20
+ ariaAtomic = _ref$ariaAtomic === void 0 ? 'true' : _ref$ariaAtomic,
21
+ _ref$ariaLive = _ref.ariaLive,
22
+ ariaLive = _ref$ariaLive === void 0 ? 'polite' : _ref$ariaLive,
23
+ _ref$ariaRelevant = _ref.ariaRelevant,
24
+ ariaRelevant = _ref$ariaRelevant === void 0 ? 'all' : _ref$ariaRelevant,
25
+ _ref$role = _ref.role,
26
+ role = _ref$role === void 0 ? 'status' : _ref$role,
27
+ _ref$text = _ref.text,
28
+ text = _ref$text === void 0 ? '' : _ref$text,
29
+ _ref$delay = _ref.delay,
30
+ delay = _ref$delay === void 0 ? 0 : _ref$delay;
27
31
  var _useState = useState(false),
28
- _useState2 = _slicedToArray(_useState, 2),
29
- contentRendered = _useState2[0],
30
- setContentRendered = _useState2[1];
31
-
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ contentRendered = _useState2[0],
34
+ setContentRendered = _useState2[1];
32
35
  useEffect(function () {
33
36
  clearTimeout(timer);
34
37
  setContentRendered(false);
@@ -12,7 +12,6 @@ var result = {
12
12
  supportsIntersectionObserver: false,
13
13
  supportsResizeObserver: false
14
14
  };
15
-
16
15
  if (typeof navigator !== 'undefined') {
17
16
  var ieEdge = /Edge\/(\d+)/.exec(navigator.userAgent);
18
17
  var ieUpTo10 = /MSIE \d/.test(navigator.userAgent);
@@ -30,5 +29,4 @@ if (typeof navigator !== 'undefined') {
30
29
  result.supportsIntersectionObserver = typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype;
31
30
  result.supportsResizeObserver = typeof window !== 'undefined' && 'ResizeObserver' in window && 'ResizeObserverEntry' in window;
32
31
  }
33
-
34
32
  export { result as browser };