@atlaskit/link-datasource 2.12.0 → 2.12.1
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 +8 -0
- package/dist/cjs/hooks/useDatasourceTableFlag.js +15 -1
- package/dist/es2019/hooks/useDatasourceTableFlag.js +16 -1
- package/dist/esm/hooks/useDatasourceTableFlag.js +15 -1
- package/dist/types/analytics/generated/analytics.types.d.ts +7 -1
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#137443](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137443)
|
|
8
|
+
[`1be2afe0863d9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1be2afe0863d9) -
|
|
9
|
+
Fire analytic event `ui.error.shown.inlineEdit` when error flag is shown
|
|
10
|
+
|
|
3
11
|
## 2.12.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -12,11 +12,20 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
13
|
var _flag = require("@atlaskit/flag");
|
|
14
14
|
var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/cross-circle"));
|
|
15
|
+
var _analytics = require("../analytics");
|
|
15
16
|
var _messages = require("../ui/issue-like-table/messages");
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
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; }
|
|
19
20
|
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; }
|
|
21
|
+
var getErrorReason = function getErrorReason(status) {
|
|
22
|
+
switch (status) {
|
|
23
|
+
case 403:
|
|
24
|
+
return 'access_denied';
|
|
25
|
+
default:
|
|
26
|
+
return 'request_failed';
|
|
27
|
+
}
|
|
28
|
+
};
|
|
20
29
|
var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
21
30
|
switch (status) {
|
|
22
31
|
case 403:
|
|
@@ -34,6 +43,8 @@ var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
|
34
43
|
var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
35
44
|
var _useFlags = (0, _flag.useFlags)(),
|
|
36
45
|
showFlag = _useFlags.showFlag;
|
|
46
|
+
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
47
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
37
48
|
var showErrorFlag = (0, _react.useCallback)(function (args) {
|
|
38
49
|
showFlag(_objectSpread(_objectSpread({
|
|
39
50
|
// We need IconTile in order to scale the new icon to 24px
|
|
@@ -45,7 +56,10 @@ var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDataso
|
|
|
45
56
|
id: (0, _uuid.default)(),
|
|
46
57
|
isAutoDismiss: true
|
|
47
58
|
}, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
|
|
48
|
-
|
|
59
|
+
fireEvent('ui.error.shown.inlineEdit', {
|
|
60
|
+
reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
|
|
61
|
+
});
|
|
62
|
+
}, [fireEvent, showFlag]);
|
|
49
63
|
return {
|
|
50
64
|
showErrorFlag: showErrorFlag
|
|
51
65
|
};
|
|
@@ -3,7 +3,16 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import { useFlags } from '@atlaskit/flag';
|
|
5
5
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
6
7
|
import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
|
|
8
|
+
const getErrorReason = status => {
|
|
9
|
+
switch (status) {
|
|
10
|
+
case 403:
|
|
11
|
+
return 'access_denied';
|
|
12
|
+
default:
|
|
13
|
+
return 'request_failed';
|
|
14
|
+
}
|
|
15
|
+
};
|
|
7
16
|
const getGenericErrorMessage = status => {
|
|
8
17
|
switch (status) {
|
|
9
18
|
case 403:
|
|
@@ -22,6 +31,9 @@ export const useDatasourceTableFlag = options => {
|
|
|
22
31
|
const {
|
|
23
32
|
showFlag
|
|
24
33
|
} = useFlags();
|
|
34
|
+
const {
|
|
35
|
+
fireEvent
|
|
36
|
+
} = useDatasourceAnalyticsEvents();
|
|
25
37
|
const showErrorFlag = useCallback(args => {
|
|
26
38
|
showFlag({
|
|
27
39
|
// We need IconTile in order to scale the new icon to 24px
|
|
@@ -35,7 +47,10 @@ export const useDatasourceTableFlag = options => {
|
|
|
35
47
|
...getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status),
|
|
36
48
|
...args
|
|
37
49
|
});
|
|
38
|
-
|
|
50
|
+
fireEvent('ui.error.shown.inlineEdit', {
|
|
51
|
+
reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
|
|
52
|
+
});
|
|
53
|
+
}, [fireEvent, showFlag]);
|
|
39
54
|
return {
|
|
40
55
|
showErrorFlag
|
|
41
56
|
};
|
|
@@ -6,7 +6,16 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
6
6
|
import uuid from 'uuid';
|
|
7
7
|
import { useFlags } from '@atlaskit/flag';
|
|
8
8
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
9
|
+
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
9
10
|
import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
|
|
11
|
+
var getErrorReason = function getErrorReason(status) {
|
|
12
|
+
switch (status) {
|
|
13
|
+
case 403:
|
|
14
|
+
return 'access_denied';
|
|
15
|
+
default:
|
|
16
|
+
return 'request_failed';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
10
19
|
var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
11
20
|
switch (status) {
|
|
12
21
|
case 403:
|
|
@@ -24,6 +33,8 @@ var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
|
24
33
|
export var useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
25
34
|
var _useFlags = useFlags(),
|
|
26
35
|
showFlag = _useFlags.showFlag;
|
|
36
|
+
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
37
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
27
38
|
var showErrorFlag = useCallback(function (args) {
|
|
28
39
|
showFlag(_objectSpread(_objectSpread({
|
|
29
40
|
// We need IconTile in order to scale the new icon to 24px
|
|
@@ -35,7 +46,10 @@ export var useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
|
35
46
|
id: uuid(),
|
|
36
47
|
isAutoDismiss: true
|
|
37
48
|
}, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
|
|
38
|
-
|
|
49
|
+
fireEvent('ui.error.shown.inlineEdit', {
|
|
50
|
+
reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
|
|
51
|
+
});
|
|
52
|
+
}, [fireEvent, showFlag]);
|
|
39
53
|
return {
|
|
40
54
|
showErrorFlag: showErrorFlag
|
|
41
55
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::87bb81d0c3b90473d208f9c02285004e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
8
|
*/
|
|
9
9
|
export type ComponentMetaDataType = {
|
|
@@ -157,6 +157,9 @@ export type InlineEditClickedDatasourceAttributesType = {
|
|
|
157
157
|
integrationKey: string;
|
|
158
158
|
fieldKey: string;
|
|
159
159
|
};
|
|
160
|
+
export type ErrorShownInlineEditAttributesType = {
|
|
161
|
+
reason: 'access_denied' | 'request_failed';
|
|
162
|
+
};
|
|
160
163
|
export type AnalyticsEventAttributes = {
|
|
161
164
|
/**
|
|
162
165
|
* Fires when user sees modal dialog. */
|
|
@@ -278,5 +281,8 @@ export type AnalyticsEventAttributes = {
|
|
|
278
281
|
/**
|
|
279
282
|
* Fired when inline edit is clicked to show edit mode */
|
|
280
283
|
'ui.inlineEdit.clicked.datasource': InlineEditClickedDatasourceAttributesType;
|
|
284
|
+
/**
|
|
285
|
+
* Fired when the inline edit failed and the error flag is shown. */
|
|
286
|
+
'ui.error.shown.inlineEdit': ErrorShownInlineEditAttributesType;
|
|
281
287
|
};
|
|
282
288
|
export type EventKey = keyof AnalyticsEventAttributes;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::87bb81d0c3b90473d208f9c02285004e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
8
|
*/
|
|
9
9
|
export type ComponentMetaDataType = {
|
|
@@ -157,6 +157,9 @@ export type InlineEditClickedDatasourceAttributesType = {
|
|
|
157
157
|
integrationKey: string;
|
|
158
158
|
fieldKey: string;
|
|
159
159
|
};
|
|
160
|
+
export type ErrorShownInlineEditAttributesType = {
|
|
161
|
+
reason: 'access_denied' | 'request_failed';
|
|
162
|
+
};
|
|
160
163
|
export type AnalyticsEventAttributes = {
|
|
161
164
|
/**
|
|
162
165
|
* Fires when user sees modal dialog. */
|
|
@@ -278,5 +281,8 @@ export type AnalyticsEventAttributes = {
|
|
|
278
281
|
/**
|
|
279
282
|
* Fired when inline edit is clicked to show edit mode */
|
|
280
283
|
'ui.inlineEdit.clicked.datasource': InlineEditClickedDatasourceAttributesType;
|
|
284
|
+
/**
|
|
285
|
+
* Fired when the inline edit failed and the error flag is shown. */
|
|
286
|
+
'ui.error.shown.inlineEdit': ErrorShownInlineEditAttributesType;
|
|
281
287
|
};
|
|
282
288
|
export type EventKey = keyof AnalyticsEventAttributes;
|