@atlaskit/link-picker 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/analytics.codegen.js +1 -1
- package/dist/cjs/{ui/link-picker → common/utils}/url.js +0 -0
- package/dist/cjs/services/use-search-query/index.js +1 -1
- package/dist/cjs/services/with-link-picker-analytics/index.js +33 -0
- package/dist/cjs/ui/link-picker/index.js +5 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics.codegen.js +1 -1
- package/dist/es2019/{ui/link-picker → common/utils}/url.js +0 -0
- package/dist/es2019/services/use-search-query/index.js +1 -1
- package/dist/es2019/services/with-link-picker-analytics/index.js +15 -0
- package/dist/es2019/ui/link-picker/index.js +4 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics.codegen.js +1 -1
- package/dist/esm/{ui/link-picker → common/utils}/url.js +0 -0
- package/dist/esm/services/use-search-query/index.js +1 -1
- package/dist/esm/services/with-link-picker-analytics/index.js +17 -0
- package/dist/esm/ui/link-picker/index.js +4 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics.codegen.d.ts +7 -4
- package/dist/types/{ui/link-picker → common/utils}/url.d.ts +0 -0
- package/dist/types/services/with-link-picker-analytics/index.d.ts +4 -0
- package/dist/types/ui/link-picker/index.d.ts +3 -3
- package/package.json +1 -1
- package/report.api.md +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -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::
|
|
13
|
+
* @codegen <<SignedSource::115bafba068f36f76da67200ee2d08c4>>
|
|
14
14
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
15
15
|
*/
|
|
16
16
|
function createEventPayload(eventKey, attributes) {
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.withLinkPickerAnalyticsContext = withLinkPickerAnalyticsContext;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
|
+
|
|
14
|
+
var _url = require("../../common/utils/url");
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function withLinkPickerAnalyticsContext(WrappedComponent) {
|
|
21
|
+
return function (props) {
|
|
22
|
+
var data = (0, _react.useMemo)(function () {
|
|
23
|
+
return {
|
|
24
|
+
attributes: {
|
|
25
|
+
linkState: (0, _url.normalizeUrl)(props.url) ? 'editLink' : 'newLink'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}, [props.url]);
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
|
|
30
|
+
data: data
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -41,13 +41,15 @@ var _usePlugins2 = require("../../services/use-plugins");
|
|
|
41
41
|
|
|
42
42
|
var _useSearchQuery = require("../../services/use-search-query");
|
|
43
43
|
|
|
44
|
+
var _withLinkPickerAnalytics = require("../../services/with-link-picker-analytics");
|
|
45
|
+
|
|
44
46
|
var _messages = require("./messages");
|
|
45
47
|
|
|
46
48
|
var _textInput = _interopRequireDefault(require("./text-input"));
|
|
47
49
|
|
|
48
50
|
var _linkSearchList = _interopRequireDefault(require("./link-search-list"));
|
|
49
51
|
|
|
50
|
-
var _url2 = require("
|
|
52
|
+
var _url2 = require("../../common/utils/url");
|
|
51
53
|
|
|
52
54
|
var _styled = require("./styled");
|
|
53
55
|
|
|
@@ -414,7 +416,8 @@ function LinkPicker(_ref) {
|
|
|
414
416
|
}, intl.formatMessage(insertButtonMsg)))));
|
|
415
417
|
}
|
|
416
418
|
|
|
417
|
-
var _default = LinkPicker;
|
|
419
|
+
var _default = (0, _withLinkPickerAnalytics.withLinkPickerAnalyticsContext)( /*#__PURE__*/(0, _react.memo)(LinkPicker));
|
|
420
|
+
|
|
418
421
|
exports.default = _default;
|
|
419
422
|
|
|
420
423
|
function getScreenReaderText(items, selectedIndex, intl) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates analytics utilities from the package analytics spec yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::115bafba068f36f76da67200ee2d08c4>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
function createEventPayload(eventKey, attributes) {
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
3
|
+
import { normalizeUrl } from '../../common/utils/url';
|
|
4
|
+
export function withLinkPickerAnalyticsContext(WrappedComponent) {
|
|
5
|
+
return props => {
|
|
6
|
+
const data = useMemo(() => ({
|
|
7
|
+
attributes: {
|
|
8
|
+
linkState: normalizeUrl(props.url) ? 'editLink' : 'newLink'
|
|
9
|
+
}
|
|
10
|
+
}), [props.url]);
|
|
11
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
12
|
+
data: data
|
|
13
|
+
}, /*#__PURE__*/React.createElement(WrappedComponent, props));
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -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 } from 'react';
|
|
4
|
+
import { Fragment, useCallback, useEffect, 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';
|
|
@@ -14,10 +14,11 @@ import createEventPayload from '../../analytics.codegen';
|
|
|
14
14
|
import { ANALYTICS_CHANNEL } from '../../common/constants';
|
|
15
15
|
import { usePlugins } from '../../services/use-plugins';
|
|
16
16
|
import { useSearchQuery } from '../../services/use-search-query';
|
|
17
|
+
import { withLinkPickerAnalyticsContext } from '../../services/with-link-picker-analytics';
|
|
17
18
|
import { messages } from './messages';
|
|
18
19
|
import PanelTextInput from './text-input';
|
|
19
20
|
import LinkSearchList from './link-search-list';
|
|
20
|
-
import { normalizeUrl, isSafeUrl } from '
|
|
21
|
+
import { normalizeUrl, isSafeUrl } from '../../common/utils/url';
|
|
21
22
|
import { rootContainerStyles, searchIconStyles, listTitleStyles, tabsWrapperStyles } from './styled';
|
|
22
23
|
import { browser } from './browser';
|
|
23
24
|
import Announcer from './announcer';
|
|
@@ -361,7 +362,7 @@ function LinkPicker({
|
|
|
361
362
|
}, intl.formatMessage(insertButtonMsg)))));
|
|
362
363
|
}
|
|
363
364
|
|
|
364
|
-
export default LinkPicker;
|
|
365
|
+
export default withLinkPickerAnalyticsContext( /*#__PURE__*/memo(LinkPicker));
|
|
365
366
|
|
|
366
367
|
function getScreenReaderText(items, selectedIndex, intl) {
|
|
367
368
|
if (items.length && selectedIndex > -1) {
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates analytics utilities from the package analytics spec yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::115bafba068f36f76da67200ee2d08c4>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
8
|
*/
|
|
9
9
|
function createEventPayload(eventKey, attributes) {
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
3
|
+
import { normalizeUrl } from '../../common/utils/url';
|
|
4
|
+
export function withLinkPickerAnalyticsContext(WrappedComponent) {
|
|
5
|
+
return function (props) {
|
|
6
|
+
var data = useMemo(function () {
|
|
7
|
+
return {
|
|
8
|
+
attributes: {
|
|
9
|
+
linkState: normalizeUrl(props.url) ? 'editLink' : 'newLink'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}, [props.url]);
|
|
13
|
+
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
14
|
+
data: data
|
|
15
|
+
}, /*#__PURE__*/React.createElement(WrappedComponent, props));
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -7,7 +7,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
9
9
|
/** @jsx jsx */
|
|
10
|
-
import { Fragment, useCallback, useEffect, useLayoutEffect, useReducer } from 'react';
|
|
10
|
+
import { Fragment, useCallback, useEffect, useLayoutEffect, useReducer, memo } from 'react';
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
12
|
import { useIntl, FormattedMessage } from 'react-intl-next';
|
|
13
13
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -20,10 +20,11 @@ import createEventPayload from '../../analytics.codegen';
|
|
|
20
20
|
import { ANALYTICS_CHANNEL } from '../../common/constants';
|
|
21
21
|
import { usePlugins } from '../../services/use-plugins';
|
|
22
22
|
import { useSearchQuery } from '../../services/use-search-query';
|
|
23
|
+
import { withLinkPickerAnalyticsContext } from '../../services/with-link-picker-analytics';
|
|
23
24
|
import { messages } from './messages';
|
|
24
25
|
import PanelTextInput from './text-input';
|
|
25
26
|
import LinkSearchList from './link-search-list';
|
|
26
|
-
import { normalizeUrl, isSafeUrl } from '
|
|
27
|
+
import { normalizeUrl, isSafeUrl } from '../../common/utils/url';
|
|
27
28
|
import { rootContainerStyles, searchIconStyles, listTitleStyles, tabsWrapperStyles } from './styled';
|
|
28
29
|
import { browser } from './browser';
|
|
29
30
|
import Announcer from './announcer';
|
|
@@ -372,7 +373,7 @@ function LinkPicker(_ref) {
|
|
|
372
373
|
}, intl.formatMessage(insertButtonMsg)))));
|
|
373
374
|
}
|
|
374
375
|
|
|
375
|
-
export default LinkPicker;
|
|
376
|
+
export default withLinkPickerAnalyticsContext( /*#__PURE__*/memo(LinkPicker));
|
|
376
377
|
|
|
377
378
|
function getScreenReaderText(items, selectedIndex, intl) {
|
|
378
379
|
if (items.length && selectedIndex > -1) {
|
package/dist/esm/version.json
CHANGED
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates analytics utilities from the package analytics spec yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::115bafba068f36f76da67200ee2d08c4>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
|
|
8
8
|
*/
|
|
9
|
-
declare type
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export declare type LinkPickerAnalyticsContextType = {
|
|
10
|
+
linkState: 'editLink' | 'newLink';
|
|
11
|
+
};
|
|
12
|
+
export declare type FormSubmittedLinkPickerAttributesType = {};
|
|
13
|
+
export declare type InlineDialogViewedLinkPickerAttributesType = {};
|
|
14
|
+
export declare type InlineDialogClosedLinkPickerAttributesType = {};
|
|
12
15
|
declare type AnalyticsEventAttributes = {
|
|
13
16
|
'ui.form.submitted.linkPicker': FormSubmittedLinkPickerAttributesType;
|
|
14
17
|
'ui.inlineDialog.viewed.linkPicker': InlineDialogViewedLinkPickerAttributesType;
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { LinkInputType, LinkPickerPlugin } from '../types';
|
|
3
3
|
export declare const RECENT_SEARCH_LIST_SIZE = 5;
|
|
4
4
|
export declare const CONTACT_SUPPORT_LINK = "https://support.atlassian.com/contact/";
|
|
@@ -63,5 +63,5 @@ export interface PickerState {
|
|
|
63
63
|
invalidUrl: boolean;
|
|
64
64
|
activeTab: number;
|
|
65
65
|
}
|
|
66
|
-
declare
|
|
67
|
-
export default
|
|
66
|
+
declare const _default: import("react").ComponentType<LinkPickerProps>;
|
|
67
|
+
export default _default;
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
+
/// <reference types="react" />
|
|
9
|
+
|
|
8
10
|
import { MessageDescriptor } from 'react-intl-next';
|
|
9
11
|
import { default as React_2 } from 'react';
|
|
10
12
|
import { ReactNode } from 'react';
|