@atlaskit/link-datasource 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 1.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1c2a3601900`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1c2a3601900) - Add analytics context to AssetsConfigModal
8
+ - Updated dependencies
9
+
3
10
  ## 1.0.11
4
11
 
5
12
  ### Patch Changes
@@ -6,13 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.AssetsConfigModal = void 0;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
12
  var _react = require("react");
12
13
  var _react2 = require("@emotion/react");
13
14
  var _reactIntlNext = require("react-intl-next");
15
+ var _analyticsNext = require("@atlaskit/analytics-next");
14
16
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
15
17
  var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
18
+ var _analytics = require("../../../analytics");
16
19
  var _useAssetsClient2 = require("../../../hooks/useAssetsClient");
17
20
  var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
18
21
  var _modalLoadingError = require("../../common/error-state/modal-loading-error");
@@ -22,15 +25,15 @@ var _messages = require("./messages");
22
25
  var _renderAssetsContent = require("./render-assets-content");
23
26
  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); }
24
27
  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; }
25
- /** @jsx jsx */
26
-
28
+ 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; }
29
+ 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) { (0, _defineProperty2.default)(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; } /** @jsx jsx */
27
30
  var modalBodyWrapperStyles = (0, _react2.css)({
28
31
  display: 'grid',
29
32
  height: '420px',
30
33
  overflow: 'auto'
31
34
  });
32
35
  var AssetsModalTitle = (0, _react2.jsx)(_modalDialog.ModalTitle, null, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.insertObjectsTitle));
33
- var AssetsConfigModal = function AssetsConfigModal(props) {
36
+ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
34
37
  var datasourceId = props.datasourceId,
35
38
  initialParameters = props.parameters,
36
39
  onCancel = props.onCancel,
@@ -52,6 +55,8 @@ var AssetsConfigModal = function AssetsConfigModal(props) {
52
55
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
53
56
  isNewSearch = _useState8[0],
54
57
  setIsNewSearch = _useState8[1];
58
+ var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
59
+ fireEvent = _useDatasourceAnalyti.fireEvent;
55
60
 
56
61
  // If a workspaceError occurs this is a critical error
57
62
  var _useAssetsClient = (0, _useAssetsClient2.useAssetsClient)(initialParameters),
@@ -99,6 +104,9 @@ var AssetsConfigModal = function AssetsConfigModal(props) {
99
104
  // Purposely not included 'visibleColumnKeys' as a dependency to prevent infinite loop
100
105
  // eslint-disable-next-line react-hooks/exhaustive-deps
101
106
  }, [responseItems, isNewSearch]);
107
+ (0, _react.useEffect)(function () {
108
+ fireEvent('screen.datasourceModalDialog.viewed', {});
109
+ }, [fireEvent]);
102
110
  var isDisabled = !!workspaceError || status === 'rejected' || status === 'loading' || status === 'empty' || !!workspaceError || assetsClientLoading || !aql || !schemaId;
103
111
  var retrieveUrlForSmartCardRender = (0, _react.useCallback)(function () {
104
112
  var _data$key, _data$key$data;
@@ -218,4 +226,16 @@ var AssetsConfigModal = function AssetsConfigModal(props) {
218
226
  }
219
227
  }))))));
220
228
  };
229
+ var analyticsContextAttributes = {
230
+ dataProvider: 'jsm-assets'
231
+ };
232
+ var analyticsContextData = {
233
+ packageName: "@atlaskit/link-datasource",
234
+ packageVersion: "1.0.12",
235
+ source: 'datasourceConfigModal'
236
+ };
237
+ var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
238
+ attributes: _objectSpread({}, analyticsContextAttributes)
239
+ });
240
+ var AssetsConfigModal = (0, _analyticsNext.withAnalyticsContext)(contextData)(PlainAssetsConfigModal);
221
241
  exports.AssetsConfigModal = AssetsConfigModal;
@@ -348,7 +348,7 @@ var analyticsContextAttributes = {
348
348
  };
349
349
  var analyticsContextData = {
350
350
  packageName: "@atlaskit/link-datasource",
351
- packageVersion: "1.0.11",
351
+ packageVersion: "1.0.12",
352
352
  source: 'datasourceConfigModal'
353
353
  };
354
354
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -3,8 +3,10 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import { useCallback, useEffect, useMemo, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import { FormattedMessage } from 'react-intl-next';
6
+ import { withAnalyticsContext } from '@atlaskit/analytics-next';
6
7
  import Button from '@atlaskit/button/standard-button';
7
8
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
9
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
8
10
  import { useAssetsClient } from '../../../hooks/useAssetsClient';
9
11
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
10
12
  import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
@@ -18,7 +20,7 @@ const modalBodyWrapperStyles = css({
18
20
  overflow: 'auto'
19
21
  });
20
22
  const AssetsModalTitle = jsx(ModalTitle, null, jsx(FormattedMessage, modalMessages.insertObjectsTitle));
21
- export const AssetsConfigModal = props => {
23
+ const PlainAssetsConfigModal = props => {
22
24
  const {
23
25
  datasourceId,
24
26
  parameters: initialParameters,
@@ -30,6 +32,9 @@ export const AssetsConfigModal = props => {
30
32
  const [schemaId, setSchemaId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.schemaId);
31
33
  const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
32
34
  const [isNewSearch, setIsNewSearch] = useState(false);
35
+ const {
36
+ fireEvent
37
+ } = useDatasourceAnalyticsEvents();
33
38
 
34
39
  // If a workspaceError occurs this is a critical error
35
40
  const {
@@ -76,6 +81,9 @@ export const AssetsConfigModal = props => {
76
81
  // Purposely not included 'visibleColumnKeys' as a dependency to prevent infinite loop
77
82
  // eslint-disable-next-line react-hooks/exhaustive-deps
78
83
  }, [responseItems, isNewSearch]);
84
+ useEffect(() => {
85
+ fireEvent('screen.datasourceModalDialog.viewed', {});
86
+ }, [fireEvent]);
79
87
  const isDisabled = !!workspaceError || status === 'rejected' || status === 'loading' || status === 'empty' || !!workspaceError || assetsClientLoading || !aql || !schemaId;
80
88
  const retrieveUrlForSmartCardRender = useCallback(() => {
81
89
  var _data$key, _data$key$data;
@@ -191,4 +199,19 @@ export const AssetsConfigModal = props => {
191
199
  objectsCount: responseItems.length
192
200
  }
193
201
  }))))));
194
- };
202
+ };
203
+ const analyticsContextAttributes = {
204
+ dataProvider: 'jsm-assets'
205
+ };
206
+ const analyticsContextData = {
207
+ packageName: "@atlaskit/link-datasource",
208
+ packageVersion: "1.0.12",
209
+ source: 'datasourceConfigModal'
210
+ };
211
+ const contextData = {
212
+ ...analyticsContextData,
213
+ attributes: {
214
+ ...analyticsContextAttributes
215
+ }
216
+ };
217
+ export const AssetsConfigModal = withAnalyticsContext(contextData)(PlainAssetsConfigModal);
@@ -294,7 +294,7 @@ const analyticsContextAttributes = {
294
294
  };
295
295
  const analyticsContextData = {
296
296
  packageName: "@atlaskit/link-datasource",
297
- packageVersion: "1.0.11",
297
+ packageVersion: "1.0.12",
298
298
  source: 'datasourceConfigModal'
299
299
  };
300
300
  const contextData = {
@@ -1,11 +1,16 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ 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; }
5
+ 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; }
3
6
  /** @jsx jsx */
4
7
  import { useCallback, useEffect, useMemo, useState } from 'react';
5
8
  import { css, jsx } from '@emotion/react';
6
9
  import { FormattedMessage } from 'react-intl-next';
10
+ import { withAnalyticsContext } from '@atlaskit/analytics-next';
7
11
  import Button from '@atlaskit/button/standard-button';
8
12
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
13
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
9
14
  import { useAssetsClient } from '../../../hooks/useAssetsClient';
10
15
  import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
11
16
  import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
@@ -19,7 +24,7 @@ var modalBodyWrapperStyles = css({
19
24
  overflow: 'auto'
20
25
  });
21
26
  var AssetsModalTitle = jsx(ModalTitle, null, jsx(FormattedMessage, modalMessages.insertObjectsTitle));
22
- export var AssetsConfigModal = function AssetsConfigModal(props) {
27
+ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
23
28
  var datasourceId = props.datasourceId,
24
29
  initialParameters = props.parameters,
25
30
  onCancel = props.onCancel,
@@ -41,6 +46,8 @@ export var AssetsConfigModal = function AssetsConfigModal(props) {
41
46
  _useState8 = _slicedToArray(_useState7, 2),
42
47
  isNewSearch = _useState8[0],
43
48
  setIsNewSearch = _useState8[1];
49
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
50
+ fireEvent = _useDatasourceAnalyti.fireEvent;
44
51
 
45
52
  // If a workspaceError occurs this is a critical error
46
53
  var _useAssetsClient = useAssetsClient(initialParameters),
@@ -88,6 +95,9 @@ export var AssetsConfigModal = function AssetsConfigModal(props) {
88
95
  // Purposely not included 'visibleColumnKeys' as a dependency to prevent infinite loop
89
96
  // eslint-disable-next-line react-hooks/exhaustive-deps
90
97
  }, [responseItems, isNewSearch]);
98
+ useEffect(function () {
99
+ fireEvent('screen.datasourceModalDialog.viewed', {});
100
+ }, [fireEvent]);
91
101
  var isDisabled = !!workspaceError || status === 'rejected' || status === 'loading' || status === 'empty' || !!workspaceError || assetsClientLoading || !aql || !schemaId;
92
102
  var retrieveUrlForSmartCardRender = useCallback(function () {
93
103
  var _data$key, _data$key$data;
@@ -206,4 +216,16 @@ export var AssetsConfigModal = function AssetsConfigModal(props) {
206
216
  objectsCount: responseItems.length
207
217
  }
208
218
  }))))));
209
- };
219
+ };
220
+ var analyticsContextAttributes = {
221
+ dataProvider: 'jsm-assets'
222
+ };
223
+ var analyticsContextData = {
224
+ packageName: "@atlaskit/link-datasource",
225
+ packageVersion: "1.0.12",
226
+ source: 'datasourceConfigModal'
227
+ };
228
+ var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
229
+ attributes: _objectSpread({}, analyticsContextAttributes)
230
+ });
231
+ export var AssetsConfigModal = withAnalyticsContext(contextData)(PlainAssetsConfigModal);
@@ -338,7 +338,7 @@ var analyticsContextAttributes = {
338
338
  };
339
339
  var analyticsContextData = {
340
340
  packageName: "@atlaskit/link-datasource",
341
- packageVersion: "1.0.11",
341
+ packageVersion: "1.0.12",
342
342
  source: 'datasourceConfigModal'
343
343
  };
344
344
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::959aae264b9713da4bc176284dc53ca5>>
6
+ * @codegen <<SignedSource::7dd648157e3329a0b94f96c5f039ac2d>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -14,7 +14,7 @@ export type AnalyticsContextType = {
14
14
  source: 'datasourceConfigModal' | 'datasourceConfluenceEditor';
15
15
  };
16
16
  export type AnalyticsContextAttributesType = {
17
- dataProvider: 'jira-issues';
17
+ dataProvider: 'jira-issues' | 'jsm-assets';
18
18
  };
19
19
  export type DatasourceModalDialogViewedAttributesType = {};
20
20
  export type ModalReadyDatasourceAttributesType = {
@@ -1,3 +1,3 @@
1
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
2
2
  import { AssetsConfigModalProps } from '../types';
3
- export declare const AssetsConfigModal: (props: AssetsConfigModalProps) => jsx.JSX.Element;
3
+ export declare const AssetsConfigModal: import("react").ForwardRefExoticComponent<AssetsConfigModalProps & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::959aae264b9713da4bc176284dc53ca5>>
6
+ * @codegen <<SignedSource::7dd648157e3329a0b94f96c5f039ac2d>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -14,7 +14,7 @@ export type AnalyticsContextType = {
14
14
  source: 'datasourceConfigModal' | 'datasourceConfluenceEditor';
15
15
  };
16
16
  export type AnalyticsContextAttributesType = {
17
- dataProvider: 'jira-issues';
17
+ dataProvider: 'jira-issues' | 'jsm-assets';
18
18
  };
19
19
  export type DatasourceModalDialogViewedAttributesType = {};
20
20
  export type ModalReadyDatasourceAttributesType = {
@@ -1,3 +1,3 @@
1
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
2
2
  import { AssetsConfigModalProps } from '../types';
3
- export declare const AssetsConfigModal: (props: AssetsConfigModalProps) => jsx.JSX.Element;
3
+ export declare const AssetsConfigModal: import("react").ForwardRefExoticComponent<AssetsConfigModalProps & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/analytics-next": "^9.1.3",
35
35
  "@atlaskit/avatar": "^21.3.0",
36
36
  "@atlaskit/button": "^16.9.0",
37
- "@atlaskit/dropdown-menu": "^11.11.0",
37
+ "@atlaskit/dropdown-menu": "^11.12.0",
38
38
  "@atlaskit/editor-prosemirror": "^1.1.0",
39
39
  "@atlaskit/empty-state": "^7.5.0",
40
40
  "@atlaskit/form": "^8.11.0",