@atlaskit/link-datasource 1.23.1 → 1.23.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 1.23.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.23.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#75568](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75568) [`cf557c64b311`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cf557c64b311) - Updated useErrorLogger to tag Sentry events with datasourceId
14
+ Updated DatasourceRenderFailedAnalyticsWrapper to also log events with tagging to Sentry
15
+
3
16
  ## 1.23.1
4
17
 
5
18
  ### Patch Changes
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
9
  var _react = require("react");
8
10
  var _analyticsNext = require("@atlaskit/analytics-next");
11
+ var _useErrorLogger = require("../../../hooks/useErrorLogger");
9
12
  var _constants = require("../../constants");
10
13
  var _index = require("../../index");
14
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
16
  var DatasourceRenderFailedAnalyticsWrapper = (0, _analyticsNext.withAnalyticsContext)(_constants.componentMetadata.generic)(function (props) {
12
17
  var _useDatasourceAnalyti = (0, _index.useDatasourceAnalyticsEvents)(),
13
18
  fireEvent = _useDatasourceAnalyti.fireEvent;
@@ -16,6 +21,13 @@ var DatasourceRenderFailedAnalyticsWrapper = (0, _analyticsNext.withAnalyticsCon
16
21
  reason: 'internal'
17
22
  });
18
23
  }, [fireEvent]);
24
+ (0, _react.useEffect)(function () {
25
+ (0, _useErrorLogger.logToSentry)(props.error, 'link-datasource', _objectSpread(_objectSpread({}, props.datasourceId && {
26
+ datasourceId: props.datasourceId
27
+ }), props.datasourceModalType && {
28
+ datasourceModalType: props.datasourceModalType
29
+ }));
30
+ }, [props.error, props.datasourceId, props.datasourceModalType]);
19
31
  return props.children;
20
32
  });
21
33
  var _default = exports.default = DatasourceRenderFailedAnalyticsWrapper;
@@ -21,7 +21,9 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
21
21
  fieldKeys = _ref$fieldKeys === void 0 ? [] : _ref$fieldKeys;
22
22
  var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
23
23
  fireEvent = _useDatasourceAnalyti.fireEvent;
24
- var _useErrorLogger = (0, _useErrorLogger2.default)(),
24
+ var _useErrorLogger = (0, _useErrorLogger2.default)({
25
+ datasourceId: datasourceId
26
+ }),
25
27
  captureError = _useErrorLogger.captureError;
26
28
  var idFieldCount = 1;
27
29
  var keyFieldCount = 1;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.logToSentry = exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _sentry = require("@atlaskit/linking-common/sentry");
9
9
  var _utils = require("@atlaskit/linking-common/utils");
@@ -18,7 +18,21 @@ var getNetworkFields = function getNetworkFields(error) {
18
18
  status: null
19
19
  };
20
20
  };
21
- var useErrorLogger = function useErrorLogger() {
21
+ /**
22
+ * This function is just a wrapper around captureException that checks if the enable-sentry-client FF is enabled
23
+ * and error is instanceof Error. We have to override the type of error from captureException to unknown so we use
24
+ * a helper Tail type which removes the first element of the tuple
25
+ */
26
+ var logToSentry = exports.logToSentry = function logToSentry(error) {
27
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasources.enable-sentry-client') && error instanceof Error) {
28
+ for (var _len = arguments.length, captureExceptionParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
29
+ captureExceptionParams[_key - 1] = arguments[_key];
30
+ }
31
+ _sentry.captureException.apply(void 0, [error].concat(captureExceptionParams));
32
+ }
33
+ };
34
+ var useErrorLogger = function useErrorLogger(_ref) {
35
+ var datasourceId = _ref.datasourceId;
22
36
  var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
23
37
  fireEvent = _useDatasourceAnalyti.fireEvent;
24
38
 
@@ -37,10 +51,10 @@ var useErrorLogger = function useErrorLogger() {
37
51
  traceId: traceId,
38
52
  status: status
39
53
  });
40
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasources.enable-sentry-client') && error instanceof Error) {
41
- (0, _sentry.captureException)(error, 'link-datasource');
42
- }
43
- }, [fireEvent]);
54
+ logToSentry(error, 'link-datasource', {
55
+ datasourceId: datasourceId
56
+ });
57
+ }, [fireEvent, datasourceId]);
44
58
  return {
45
59
  captureError: captureError
46
60
  };
@@ -33,10 +33,13 @@ var ProviderAuthRequired = exports.ProviderAuthRequired = function ProviderAuthR
33
33
  onAuthSuccess = _ref.onAuthSuccess,
34
34
  onAuthError = _ref.onAuthError,
35
35
  extensionKey = _ref.extensionKey,
36
- providerName = _ref.providerName;
36
+ providerName = _ref.providerName,
37
+ datasourceId = _ref.datasourceId;
37
38
  var _useIntl = (0, _reactIntlNext.useIntl)(),
38
39
  formatMessage = _useIntl.formatMessage;
39
- var _useErrorLogger = (0, _useErrorLogger2.default)(),
40
+ var _useErrorLogger = (0, _useErrorLogger2.default)({
41
+ datasourceId: datasourceId
42
+ }),
40
43
  captureError = _useErrorLogger.captureError;
41
44
  var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
42
45
  fireEvent = _useDatasourceAnalyti.fireEvent;
@@ -140,7 +140,8 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
140
140
  extensionKey: extensionKey,
141
141
  providerName: providerName,
142
142
  onAuthSuccess: forcedReset,
143
- onAuthError: forcedReset
143
+ onAuthError: forcedReset,
144
+ datasourceId: datasourceId
144
145
  }) : (0, _react2.jsx)(_accessRequired.AccessRequired, {
145
146
  url: url
146
147
  });
@@ -1,5 +1,6 @@
1
1
  import { useEffect } from 'react';
2
2
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
3
+ import { logToSentry } from '../../../hooks/useErrorLogger';
3
4
  import { componentMetadata } from '../../constants';
4
5
  import { useDatasourceAnalyticsEvents } from '../../index';
5
6
  const DatasourceRenderFailedAnalyticsWrapper = withAnalyticsContext(componentMetadata.generic)(props => {
@@ -11,6 +12,16 @@ const DatasourceRenderFailedAnalyticsWrapper = withAnalyticsContext(componentMet
11
12
  reason: 'internal'
12
13
  });
13
14
  }, [fireEvent]);
15
+ useEffect(() => {
16
+ logToSentry(props.error, 'link-datasource', {
17
+ ...(props.datasourceId && {
18
+ datasourceId: props.datasourceId
19
+ }),
20
+ ...(props.datasourceModalType && {
21
+ datasourceModalType: props.datasourceModalType
22
+ })
23
+ });
24
+ }, [props.error, props.datasourceId, props.datasourceModalType]);
14
25
  return props.children;
15
26
  });
16
27
  export default DatasourceRenderFailedAnalyticsWrapper;
@@ -13,7 +13,9 @@ export const useDatasourceTableState = ({
13
13
  } = useDatasourceAnalyticsEvents();
14
14
  const {
15
15
  captureError
16
- } = useErrorLogger();
16
+ } = useErrorLogger({
17
+ datasourceId
18
+ });
17
19
  const idFieldCount = 1;
18
20
  const keyFieldCount = 1;
19
21
  const [initialEmptyArray] = useState([]);
@@ -12,7 +12,19 @@ const getNetworkFields = error => {
12
12
  status: null
13
13
  };
14
14
  };
15
- const useErrorLogger = () => {
15
+ /**
16
+ * This function is just a wrapper around captureException that checks if the enable-sentry-client FF is enabled
17
+ * and error is instanceof Error. We have to override the type of error from captureException to unknown so we use
18
+ * a helper Tail type which removes the first element of the tuple
19
+ */
20
+ export const logToSentry = (error, ...captureExceptionParams) => {
21
+ if (getBooleanFF('platform.linking-platform.datasources.enable-sentry-client') && error instanceof Error) {
22
+ captureException(error, ...captureExceptionParams);
23
+ }
24
+ };
25
+ const useErrorLogger = ({
26
+ datasourceId
27
+ }) => {
16
28
  const {
17
29
  fireEvent
18
30
  } = useDatasourceAnalyticsEvents();
@@ -33,10 +45,10 @@ const useErrorLogger = () => {
33
45
  traceId,
34
46
  status
35
47
  });
36
- if (getBooleanFF('platform.linking-platform.datasources.enable-sentry-client') && error instanceof Error) {
37
- captureException(error, 'link-datasource');
38
- }
39
- }, [fireEvent]);
48
+ logToSentry(error, 'link-datasource', {
49
+ datasourceId
50
+ });
51
+ }, [fireEvent, datasourceId]);
40
52
  return {
41
53
  captureError
42
54
  };
@@ -18,14 +18,17 @@ export const ProviderAuthRequired = ({
18
18
  onAuthSuccess,
19
19
  onAuthError,
20
20
  extensionKey,
21
- providerName
21
+ providerName,
22
+ datasourceId
22
23
  }) => {
23
24
  const {
24
25
  formatMessage
25
26
  } = useIntl();
26
27
  const {
27
28
  captureError
28
- } = useErrorLogger();
29
+ } = useErrorLogger({
30
+ datasourceId
31
+ });
29
32
  const {
30
33
  fireEvent
31
34
  } = useDatasourceAnalyticsEvents();
@@ -135,7 +135,8 @@ const DatasourceTableViewWithoutAnalytics = ({
135
135
  extensionKey: extensionKey,
136
136
  providerName: providerName,
137
137
  onAuthSuccess: forcedReset,
138
- onAuthError: forcedReset
138
+ onAuthError: forcedReset,
139
+ datasourceId: datasourceId
139
140
  }) : jsx(AccessRequired, {
140
141
  url: url
141
142
  });
@@ -1,5 +1,9 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import { useEffect } from 'react';
2
5
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
6
+ import { logToSentry } from '../../../hooks/useErrorLogger';
3
7
  import { componentMetadata } from '../../constants';
4
8
  import { useDatasourceAnalyticsEvents } from '../../index';
5
9
  var DatasourceRenderFailedAnalyticsWrapper = withAnalyticsContext(componentMetadata.generic)(function (props) {
@@ -10,6 +14,13 @@ var DatasourceRenderFailedAnalyticsWrapper = withAnalyticsContext(componentMetad
10
14
  reason: 'internal'
11
15
  });
12
16
  }, [fireEvent]);
17
+ useEffect(function () {
18
+ logToSentry(props.error, 'link-datasource', _objectSpread(_objectSpread({}, props.datasourceId && {
19
+ datasourceId: props.datasourceId
20
+ }), props.datasourceModalType && {
21
+ datasourceModalType: props.datasourceModalType
22
+ }));
23
+ }, [props.error, props.datasourceId, props.datasourceModalType]);
13
24
  return props.children;
14
25
  });
15
26
  export default DatasourceRenderFailedAnalyticsWrapper;
@@ -14,7 +14,9 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
14
14
  fieldKeys = _ref$fieldKeys === void 0 ? [] : _ref$fieldKeys;
15
15
  var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
16
16
  fireEvent = _useDatasourceAnalyti.fireEvent;
17
- var _useErrorLogger = useErrorLogger(),
17
+ var _useErrorLogger = useErrorLogger({
18
+ datasourceId: datasourceId
19
+ }),
18
20
  captureError = _useErrorLogger.captureError;
19
21
  var idFieldCount = 1;
20
22
  var keyFieldCount = 1;
@@ -12,7 +12,21 @@ var getNetworkFields = function getNetworkFields(error) {
12
12
  status: null
13
13
  };
14
14
  };
15
- var useErrorLogger = function useErrorLogger() {
15
+ /**
16
+ * This function is just a wrapper around captureException that checks if the enable-sentry-client FF is enabled
17
+ * and error is instanceof Error. We have to override the type of error from captureException to unknown so we use
18
+ * a helper Tail type which removes the first element of the tuple
19
+ */
20
+ export var logToSentry = function logToSentry(error) {
21
+ if (getBooleanFF('platform.linking-platform.datasources.enable-sentry-client') && error instanceof Error) {
22
+ for (var _len = arguments.length, captureExceptionParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
23
+ captureExceptionParams[_key - 1] = arguments[_key];
24
+ }
25
+ captureException.apply(void 0, [error].concat(captureExceptionParams));
26
+ }
27
+ };
28
+ var useErrorLogger = function useErrorLogger(_ref) {
29
+ var datasourceId = _ref.datasourceId;
16
30
  var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
17
31
  fireEvent = _useDatasourceAnalyti.fireEvent;
18
32
 
@@ -31,10 +45,10 @@ var useErrorLogger = function useErrorLogger() {
31
45
  traceId: traceId,
32
46
  status: status
33
47
  });
34
- if (getBooleanFF('platform.linking-platform.datasources.enable-sentry-client') && error instanceof Error) {
35
- captureException(error, 'link-datasource');
36
- }
37
- }, [fireEvent]);
48
+ logToSentry(error, 'link-datasource', {
49
+ datasourceId: datasourceId
50
+ });
51
+ }, [fireEvent, datasourceId]);
38
52
  return {
39
53
  captureError: captureError
40
54
  };
@@ -22,10 +22,13 @@ export var ProviderAuthRequired = function ProviderAuthRequired(_ref) {
22
22
  onAuthSuccess = _ref.onAuthSuccess,
23
23
  onAuthError = _ref.onAuthError,
24
24
  extensionKey = _ref.extensionKey,
25
- providerName = _ref.providerName;
25
+ providerName = _ref.providerName,
26
+ datasourceId = _ref.datasourceId;
26
27
  var _useIntl = useIntl(),
27
28
  formatMessage = _useIntl.formatMessage;
28
- var _useErrorLogger = useErrorLogger(),
29
+ var _useErrorLogger = useErrorLogger({
30
+ datasourceId: datasourceId
31
+ }),
29
32
  captureError = _useErrorLogger.captureError;
30
33
  var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
31
34
  fireEvent = _useDatasourceAnalyti.fireEvent;
@@ -132,7 +132,8 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
132
132
  extensionKey: extensionKey,
133
133
  providerName: providerName,
134
134
  onAuthSuccess: forcedReset,
135
- onAuthError: forcedReset
135
+ onAuthError: forcedReset,
136
+ datasourceId: datasourceId
136
137
  }) : jsx(AccessRequired, {
137
138
  url: url
138
139
  });
@@ -1,4 +1,15 @@
1
- declare const useErrorLogger: () => {
1
+ /**
2
+ * This function is just a wrapper around captureException that checks if the enable-sentry-client FF is enabled
3
+ * and error is instanceof Error. We have to override the type of error from captureException to unknown so we use
4
+ * a helper Tail type which removes the first element of the tuple
5
+ */
6
+ export declare const logToSentry: (error: unknown, packageName: string, tags?: {
7
+ [key: string]: import("@sentry/types").Primitive;
8
+ } | undefined) => void;
9
+ interface UseErrorLoggerProps {
10
+ datasourceId: string;
11
+ }
12
+ declare const useErrorLogger: ({ datasourceId }: UseErrorLoggerProps) => {
2
13
  captureError: (errorLocation: string, error: unknown) => void;
3
14
  };
4
15
  export default useErrorLogger;
@@ -6,6 +6,7 @@ interface ProviderAuthRequiredProps {
6
6
  onAuthError: () => void;
7
7
  extensionKey: string | null;
8
8
  providerName: DatasourceMeta['providerName'];
9
+ datasourceId: string;
9
10
  }
10
- export declare const ProviderAuthRequired: ({ auth, onAuthSuccess, onAuthError, extensionKey, providerName, }: ProviderAuthRequiredProps) => jsx.JSX.Element;
11
+ export declare const ProviderAuthRequired: ({ auth, onAuthSuccess, onAuthError, extensionKey, providerName, datasourceId, }: ProviderAuthRequiredProps) => jsx.JSX.Element;
11
12
  export {};
@@ -1,4 +1,15 @@
1
- declare const useErrorLogger: () => {
1
+ /**
2
+ * This function is just a wrapper around captureException that checks if the enable-sentry-client FF is enabled
3
+ * and error is instanceof Error. We have to override the type of error from captureException to unknown so we use
4
+ * a helper Tail type which removes the first element of the tuple
5
+ */
6
+ export declare const logToSentry: (error: unknown, packageName: string, tags?: {
7
+ [key: string]: import("@sentry/types").Primitive;
8
+ } | undefined) => void;
9
+ interface UseErrorLoggerProps {
10
+ datasourceId: string;
11
+ }
12
+ declare const useErrorLogger: ({ datasourceId }: UseErrorLoggerProps) => {
2
13
  captureError: (errorLocation: string, error: unknown) => void;
3
14
  };
4
15
  export default useErrorLogger;
@@ -6,6 +6,7 @@ interface ProviderAuthRequiredProps {
6
6
  onAuthError: () => void;
7
7
  extensionKey: string | null;
8
8
  providerName: DatasourceMeta['providerName'];
9
+ datasourceId: string;
9
10
  }
10
- export declare const ProviderAuthRequired: ({ auth, onAuthSuccess, onAuthError, extensionKey, providerName, }: ProviderAuthRequiredProps) => jsx.JSX.Element;
11
+ export declare const ProviderAuthRequired: ({ auth, onAuthSuccess, onAuthError, extensionKey, providerName, datasourceId, }: ProviderAuthRequiredProps) => jsx.JSX.Element;
11
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.23.1",
3
+ "version": "1.23.3",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,7 +36,7 @@
36
36
  "@atlaskit/avatar-group": "^9.5.0",
37
37
  "@atlaskit/badge": "^15.2.0",
38
38
  "@atlaskit/button": "^17.6.0",
39
- "@atlaskit/dropdown-menu": "^12.5.0",
39
+ "@atlaskit/dropdown-menu": "^12.6.0",
40
40
  "@atlaskit/editor-prosemirror": "3.0.0",
41
41
  "@atlaskit/empty-state": "^7.7.0",
42
42
  "@atlaskit/form": "^9.0.3",
@@ -59,14 +59,14 @@
59
59
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
60
60
  "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.0.0",
61
61
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.0.0",
62
- "@atlaskit/primitives": "^3.0.0",
62
+ "@atlaskit/primitives": "^4.0.0",
63
63
  "@atlaskit/select": "^17.1.0",
64
64
  "@atlaskit/smart-card": "^26.48.0",
65
65
  "@atlaskit/spinner": "^16.0.0",
66
66
  "@atlaskit/tag": "^12.0.0",
67
67
  "@atlaskit/textfield": "6.0.1",
68
68
  "@atlaskit/theme": "^12.6.0",
69
- "@atlaskit/tokens": "^1.38.0",
69
+ "@atlaskit/tokens": "^1.39.0",
70
70
  "@atlaskit/tooltip": "^18.1.0",
71
71
  "@atlaskit/ufo": "^0.2.4",
72
72
  "@atlaskit/width-detector": "^4.1.7",