@atlaskit/give-kudos 4.0.4 → 4.1.0
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 +18 -0
- package/dist/cjs/messages.js +6 -1
- package/dist/cjs/ui/GiveKudosLauncher/main.js +29 -6
- package/dist/es2019/messages.js +6 -1
- package/dist/es2019/ui/GiveKudosLauncher/main.js +28 -7
- package/dist/esm/messages.js +6 -1
- package/dist/esm/ui/GiveKudosLauncher/main.js +30 -7
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/types.d.ts +4 -1
- package/dist/types-ts4.5/messages.d.ts +5 -0
- package/dist/types-ts4.5/types.d.ts +4 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlassian/give-kudos
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#144593](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/144593)
|
|
8
|
+
[`5ca0075ee0408`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5ca0075ee0408) -
|
|
9
|
+
PTC-11485 Updated title for create team flag, added actions and exposed onCreateKudosSuccess to
|
|
10
|
+
Kudos
|
|
11
|
+
- [#143734](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/143734)
|
|
12
|
+
[`aeb5f206e7d70`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aeb5f206e7d70) -
|
|
13
|
+
Added teamid to create kudos opened event to track team active status
|
|
14
|
+
|
|
15
|
+
## 4.0.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 4.0.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/messages.js
CHANGED
|
@@ -13,7 +13,7 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
13
13
|
},
|
|
14
14
|
kudosCreatedFlag: {
|
|
15
15
|
id: 'team-central.give-kudos.created.title.flag',
|
|
16
|
-
defaultMessage: 'Kudos created',
|
|
16
|
+
defaultMessage: 'Kudos has been created',
|
|
17
17
|
description: 'Title text for kudos creation flag.'
|
|
18
18
|
},
|
|
19
19
|
kudosCreatedDescriptionFlag: {
|
|
@@ -21,6 +21,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
21
21
|
defaultMessage: 'Your kudos has been sent. <a>View kudos</a>',
|
|
22
22
|
description: 'Description text for the kudos created flag. This includes a link to view the newly created kudos.'
|
|
23
23
|
},
|
|
24
|
+
kudosCreatedActionFlag: {
|
|
25
|
+
id: 'team-central.give-kudos.created.action.flag',
|
|
26
|
+
defaultMessage: 'View Kudos',
|
|
27
|
+
description: 'Action text for the kudos created flag to view the newly created kudos.'
|
|
28
|
+
},
|
|
24
29
|
kudosCreationFailedFlag: {
|
|
25
30
|
id: 'team-central.give-kudos.creation.failed.title.flag',
|
|
26
31
|
defaultMessage: 'Something went wrong',
|
|
@@ -19,11 +19,13 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
19
19
|
var _new = require("@atlaskit/button/new");
|
|
20
20
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
21
21
|
var _compiled = require("@atlaskit/drawer/compiled");
|
|
22
|
+
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
22
23
|
var _arrowLeft = _interopRequireDefault(require("@atlaskit/icon/core/migration/arrow-left"));
|
|
23
24
|
var _intlMessagesProvider = require("@atlaskit/intl-messages-provider");
|
|
24
25
|
var _link = _interopRequireDefault(require("@atlaskit/link"));
|
|
25
26
|
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
26
27
|
var _portal = _interopRequireDefault(require("@atlaskit/portal"));
|
|
28
|
+
var _primitives = require("@atlaskit/primitives");
|
|
27
29
|
var _constants = require("@atlaskit/theme/constants");
|
|
28
30
|
var _fetchMessagesForLocale = require("../../common/utils/fetch-messages-for-locale");
|
|
29
31
|
var _en = _interopRequireDefault(require("../../i18n/en"));
|
|
@@ -39,7 +41,7 @@ var styles = {
|
|
|
39
41
|
};
|
|
40
42
|
var ANALYTICS_CHANNEL = 'atlas';
|
|
41
43
|
var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
42
|
-
var _props$
|
|
44
|
+
var _props$recipient4;
|
|
43
45
|
var _useState = (0, _react.useState)(false),
|
|
44
46
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
45
47
|
isCloseConfirmModalOpen = _useState2[0],
|
|
@@ -58,21 +60,27 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
58
60
|
teamCentralBaseUrl = props.teamCentralBaseUrl,
|
|
59
61
|
analyticsSource = props.analyticsSource,
|
|
60
62
|
onClose = props.onClose,
|
|
61
|
-
testId = props.testId
|
|
63
|
+
testId = props.testId,
|
|
64
|
+
onCreateKudosSuccess = props.onCreateKudosSuccess,
|
|
65
|
+
isActionsEnabled = props.isActionsEnabled;
|
|
62
66
|
var shouldBlockTransition = (0, _react.useCallback)(function (e) {
|
|
63
67
|
e.preventDefault();
|
|
64
68
|
e.returnValue = intl.formatMessage(_messages.default.unsavedKudosWarning);
|
|
65
69
|
}, [intl]);
|
|
66
70
|
var sendAnalytic = (0, _react.useCallback)(function (action, options) {
|
|
71
|
+
var _props$recipient, _props$recipient2, _props$recipient3;
|
|
67
72
|
var analyticsEvent = createAnalyticsEvent({
|
|
68
73
|
action: action,
|
|
69
74
|
actionSubject: 'createKudos',
|
|
70
75
|
attributes: _objectSpread(_objectSpread({}, options), {}, {
|
|
71
|
-
analyticsSource: analyticsSource
|
|
76
|
+
analyticsSource: analyticsSource,
|
|
77
|
+
teamId: ((_props$recipient = props.recipient) === null || _props$recipient === void 0 ? void 0 : _props$recipient.type) === _types.KudosType.TEAM ? props.recipient.recipientId : undefined,
|
|
78
|
+
KudosType: (_props$recipient2 = props.recipient) === null || _props$recipient2 === void 0 ? void 0 : _props$recipient2.type,
|
|
79
|
+
recipientId: (_props$recipient3 = props.recipient) === null || _props$recipient3 === void 0 ? void 0 : _props$recipient3.recipientId
|
|
72
80
|
})
|
|
73
81
|
});
|
|
74
82
|
analyticsEvent.fire(ANALYTICS_CHANNEL);
|
|
75
|
-
}, [analyticsSource, createAnalyticsEvent]);
|
|
83
|
+
}, [analyticsSource, createAnalyticsEvent, props.recipient]);
|
|
76
84
|
var closeDrawer = (0, _react.useCallback)(function () {
|
|
77
85
|
setIsDirty(false);
|
|
78
86
|
setIsCloseConfirmModalOpen(false);
|
|
@@ -85,6 +93,7 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
85
93
|
var handleCreateOrFail = function handleCreateOrFail(addFlagConfig) {
|
|
86
94
|
closeDrawer();
|
|
87
95
|
addFlag && addFlag(addFlagConfig);
|
|
96
|
+
onCreateKudosSuccess && addFlagConfig.type === 'success' && onCreateKudosSuccess(flagEvent);
|
|
88
97
|
};
|
|
89
98
|
switch (flagEvent.eventType) {
|
|
90
99
|
case _types.FlagEventType.KUDOS_CREATED:
|
|
@@ -100,6 +109,20 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
100
109
|
}
|
|
101
110
|
}
|
|
102
111
|
})),
|
|
112
|
+
actions: isActionsEnabled ? [{
|
|
113
|
+
content: /*#__PURE__*/React.createElement(_primitives.Inline, {
|
|
114
|
+
space: "space.050",
|
|
115
|
+
alignBlock: "center"
|
|
116
|
+
}, /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, _messages.default.kudosCreatedActionFlag), /*#__PURE__*/React.createElement(_linkExternal.default, {
|
|
117
|
+
label: "",
|
|
118
|
+
color: "currentColor"
|
|
119
|
+
})),
|
|
120
|
+
href: "".concat(teamCentralBaseUrl, "/people/kudos/").concat(flagEvent.kudosUuid),
|
|
121
|
+
target: '_blank',
|
|
122
|
+
onClick: function onClick() {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
}] : undefined,
|
|
103
126
|
type: 'success'
|
|
104
127
|
});
|
|
105
128
|
break;
|
|
@@ -160,7 +183,7 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
160
183
|
// Not a known FlagEventType
|
|
161
184
|
return;
|
|
162
185
|
}
|
|
163
|
-
}, [addFlag, closeDrawer, teamCentralBaseUrl]);
|
|
186
|
+
}, [addFlag, closeDrawer, teamCentralBaseUrl, onCreateKudosSuccess, isActionsEnabled]);
|
|
164
187
|
var messageListener = (0, _react.useCallback)(function (event) {
|
|
165
188
|
if (!props.isOpen) {
|
|
166
189
|
return;
|
|
@@ -246,7 +269,7 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
246
269
|
className: (0, _runtime.ax)([styles.iframe])
|
|
247
270
|
}));
|
|
248
271
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
249
|
-
}, [(_props$
|
|
272
|
+
}, [(_props$recipient4 = props.recipient) === null || _props$recipient4 === void 0 ? void 0 : _props$recipient4.recipientId, props.isOpen]);
|
|
250
273
|
return /*#__PURE__*/React.createElement(_portal.default, {
|
|
251
274
|
zIndex: _constants.layers.modal()
|
|
252
275
|
}, /*#__PURE__*/React.createElement("div", {
|
package/dist/es2019/messages.js
CHANGED
|
@@ -7,7 +7,7 @@ const messages = defineMessages({
|
|
|
7
7
|
},
|
|
8
8
|
kudosCreatedFlag: {
|
|
9
9
|
id: 'team-central.give-kudos.created.title.flag',
|
|
10
|
-
defaultMessage: 'Kudos created',
|
|
10
|
+
defaultMessage: 'Kudos has been created',
|
|
11
11
|
description: 'Title text for kudos creation flag.'
|
|
12
12
|
},
|
|
13
13
|
kudosCreatedDescriptionFlag: {
|
|
@@ -15,6 +15,11 @@ const messages = defineMessages({
|
|
|
15
15
|
defaultMessage: 'Your kudos has been sent. <a>View kudos</a>',
|
|
16
16
|
description: 'Description text for the kudos created flag. This includes a link to view the newly created kudos.'
|
|
17
17
|
},
|
|
18
|
+
kudosCreatedActionFlag: {
|
|
19
|
+
id: 'team-central.give-kudos.created.action.flag',
|
|
20
|
+
defaultMessage: 'View Kudos',
|
|
21
|
+
description: 'Action text for the kudos created flag to view the newly created kudos.'
|
|
22
|
+
},
|
|
18
23
|
kudosCreationFailedFlag: {
|
|
19
24
|
id: 'team-central.give-kudos.creation.failed.title.flag',
|
|
20
25
|
defaultMessage: 'Something went wrong',
|
|
@@ -9,23 +9,25 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
9
9
|
import { IconButton } from '@atlaskit/button/new';
|
|
10
10
|
import Button from '@atlaskit/button/standard-button';
|
|
11
11
|
import { Drawer } from '@atlaskit/drawer/compiled';
|
|
12
|
+
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
12
13
|
import ArrowLeft from '@atlaskit/icon/core/migration/arrow-left';
|
|
13
14
|
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
14
15
|
import Link from '@atlaskit/link';
|
|
15
16
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
16
17
|
import Portal from '@atlaskit/portal';
|
|
18
|
+
import { Inline } from '@atlaskit/primitives';
|
|
17
19
|
import { layers } from '@atlaskit/theme/constants';
|
|
18
20
|
import { fetchMessagesForLocale } from '../../common/utils/fetch-messages-for-locale';
|
|
19
21
|
import i18nEN from '../../i18n/en';
|
|
20
22
|
import messages from '../../messages';
|
|
21
|
-
import { FlagEventType, isFlagEventTypeValue } from '../../types';
|
|
23
|
+
import { FlagEventType, isFlagEventTypeValue, KudosType } from '../../types';
|
|
22
24
|
const styles = {
|
|
23
25
|
drawerCloseButtonContainer: "_kqswstnw _154ipxbi _1ltvpxbi",
|
|
24
26
|
iframe: "_19itglyw"
|
|
25
27
|
};
|
|
26
28
|
const ANALYTICS_CHANNEL = 'atlas';
|
|
27
29
|
const GiveKudosLauncher = props => {
|
|
28
|
-
var _props$
|
|
30
|
+
var _props$recipient4;
|
|
29
31
|
const [isCloseConfirmModalOpen, setIsCloseConfirmModalOpen] = useState(false);
|
|
30
32
|
const [isDirty, setIsDirty] = useState(false);
|
|
31
33
|
const iframeEl = useRef(null);
|
|
@@ -40,23 +42,29 @@ const GiveKudosLauncher = props => {
|
|
|
40
42
|
teamCentralBaseUrl,
|
|
41
43
|
analyticsSource,
|
|
42
44
|
onClose,
|
|
43
|
-
testId
|
|
45
|
+
testId,
|
|
46
|
+
onCreateKudosSuccess,
|
|
47
|
+
isActionsEnabled
|
|
44
48
|
} = props;
|
|
45
49
|
const shouldBlockTransition = useCallback(e => {
|
|
46
50
|
e.preventDefault();
|
|
47
51
|
e.returnValue = intl.formatMessage(messages.unsavedKudosWarning);
|
|
48
52
|
}, [intl]);
|
|
49
53
|
const sendAnalytic = useCallback((action, options) => {
|
|
54
|
+
var _props$recipient, _props$recipient2, _props$recipient3;
|
|
50
55
|
const analyticsEvent = createAnalyticsEvent({
|
|
51
56
|
action: action,
|
|
52
57
|
actionSubject: 'createKudos',
|
|
53
58
|
attributes: {
|
|
54
59
|
...options,
|
|
55
|
-
analyticsSource
|
|
60
|
+
analyticsSource,
|
|
61
|
+
teamId: ((_props$recipient = props.recipient) === null || _props$recipient === void 0 ? void 0 : _props$recipient.type) === KudosType.TEAM ? props.recipient.recipientId : undefined,
|
|
62
|
+
KudosType: (_props$recipient2 = props.recipient) === null || _props$recipient2 === void 0 ? void 0 : _props$recipient2.type,
|
|
63
|
+
recipientId: (_props$recipient3 = props.recipient) === null || _props$recipient3 === void 0 ? void 0 : _props$recipient3.recipientId
|
|
56
64
|
}
|
|
57
65
|
});
|
|
58
66
|
analyticsEvent.fire(ANALYTICS_CHANNEL);
|
|
59
|
-
}, [analyticsSource, createAnalyticsEvent]);
|
|
67
|
+
}, [analyticsSource, createAnalyticsEvent, props.recipient]);
|
|
60
68
|
const closeDrawer = useCallback(() => {
|
|
61
69
|
setIsDirty(false);
|
|
62
70
|
setIsCloseConfirmModalOpen(false);
|
|
@@ -69,6 +77,7 @@ const GiveKudosLauncher = props => {
|
|
|
69
77
|
const handleCreateOrFail = addFlagConfig => {
|
|
70
78
|
closeDrawer();
|
|
71
79
|
addFlag && addFlag(addFlagConfig);
|
|
80
|
+
onCreateKudosSuccess && addFlagConfig.type === 'success' && onCreateKudosSuccess(flagEvent);
|
|
72
81
|
};
|
|
73
82
|
switch (flagEvent.eventType) {
|
|
74
83
|
case FlagEventType.KUDOS_CREATED:
|
|
@@ -82,6 +91,18 @@ const GiveKudosLauncher = props => {
|
|
|
82
91
|
}, s)
|
|
83
92
|
}
|
|
84
93
|
})),
|
|
94
|
+
actions: isActionsEnabled ? [{
|
|
95
|
+
content: /*#__PURE__*/React.createElement(Inline, {
|
|
96
|
+
space: "space.050",
|
|
97
|
+
alignBlock: "center"
|
|
98
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.kudosCreatedActionFlag), /*#__PURE__*/React.createElement(LinkExternalIcon, {
|
|
99
|
+
label: "",
|
|
100
|
+
color: "currentColor"
|
|
101
|
+
})),
|
|
102
|
+
href: `${teamCentralBaseUrl}/people/kudos/${flagEvent.kudosUuid}`,
|
|
103
|
+
target: '_blank',
|
|
104
|
+
onClick: () => undefined
|
|
105
|
+
}] : undefined,
|
|
85
106
|
type: 'success'
|
|
86
107
|
});
|
|
87
108
|
break;
|
|
@@ -142,7 +163,7 @@ const GiveKudosLauncher = props => {
|
|
|
142
163
|
// Not a known FlagEventType
|
|
143
164
|
return;
|
|
144
165
|
}
|
|
145
|
-
}, [addFlag, closeDrawer, teamCentralBaseUrl]);
|
|
166
|
+
}, [addFlag, closeDrawer, teamCentralBaseUrl, onCreateKudosSuccess, isActionsEnabled]);
|
|
146
167
|
const messageListener = useCallback(event => {
|
|
147
168
|
if (!props.isOpen) {
|
|
148
169
|
return;
|
|
@@ -228,7 +249,7 @@ const GiveKudosLauncher = props => {
|
|
|
228
249
|
className: ax([styles.iframe])
|
|
229
250
|
}));
|
|
230
251
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
231
|
-
}, [(_props$
|
|
252
|
+
}, [(_props$recipient4 = props.recipient) === null || _props$recipient4 === void 0 ? void 0 : _props$recipient4.recipientId, props.isOpen]);
|
|
232
253
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
233
254
|
zIndex: layers.modal()
|
|
234
255
|
}, /*#__PURE__*/React.createElement("div", {
|
package/dist/esm/messages.js
CHANGED
|
@@ -7,7 +7,7 @@ var messages = defineMessages({
|
|
|
7
7
|
},
|
|
8
8
|
kudosCreatedFlag: {
|
|
9
9
|
id: 'team-central.give-kudos.created.title.flag',
|
|
10
|
-
defaultMessage: 'Kudos created',
|
|
10
|
+
defaultMessage: 'Kudos has been created',
|
|
11
11
|
description: 'Title text for kudos creation flag.'
|
|
12
12
|
},
|
|
13
13
|
kudosCreatedDescriptionFlag: {
|
|
@@ -15,6 +15,11 @@ var messages = defineMessages({
|
|
|
15
15
|
defaultMessage: 'Your kudos has been sent. <a>View kudos</a>',
|
|
16
16
|
description: 'Description text for the kudos created flag. This includes a link to view the newly created kudos.'
|
|
17
17
|
},
|
|
18
|
+
kudosCreatedActionFlag: {
|
|
19
|
+
id: 'team-central.give-kudos.created.action.flag',
|
|
20
|
+
defaultMessage: 'View Kudos',
|
|
21
|
+
description: 'Action text for the kudos created flag to view the newly created kudos.'
|
|
22
|
+
},
|
|
18
23
|
kudosCreationFailedFlag: {
|
|
19
24
|
id: 'team-central.give-kudos.creation.failed.title.flag',
|
|
20
25
|
defaultMessage: 'Something went wrong',
|
|
@@ -13,23 +13,25 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
13
13
|
import { IconButton } from '@atlaskit/button/new';
|
|
14
14
|
import Button from '@atlaskit/button/standard-button';
|
|
15
15
|
import { Drawer } from '@atlaskit/drawer/compiled';
|
|
16
|
+
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
16
17
|
import ArrowLeft from '@atlaskit/icon/core/migration/arrow-left';
|
|
17
18
|
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
18
19
|
import Link from '@atlaskit/link';
|
|
19
20
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
20
21
|
import Portal from '@atlaskit/portal';
|
|
22
|
+
import { Inline } from '@atlaskit/primitives';
|
|
21
23
|
import { layers } from '@atlaskit/theme/constants';
|
|
22
24
|
import { fetchMessagesForLocale } from '../../common/utils/fetch-messages-for-locale';
|
|
23
25
|
import i18nEN from '../../i18n/en';
|
|
24
26
|
import messages from '../../messages';
|
|
25
|
-
import { FlagEventType, isFlagEventTypeValue } from '../../types';
|
|
27
|
+
import { FlagEventType, isFlagEventTypeValue, KudosType } from '../../types';
|
|
26
28
|
var styles = {
|
|
27
29
|
drawerCloseButtonContainer: "_kqswstnw _154ipxbi _1ltvpxbi",
|
|
28
30
|
iframe: "_19itglyw"
|
|
29
31
|
};
|
|
30
32
|
var ANALYTICS_CHANNEL = 'atlas';
|
|
31
33
|
var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
32
|
-
var _props$
|
|
34
|
+
var _props$recipient4;
|
|
33
35
|
var _useState = useState(false),
|
|
34
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
37
|
isCloseConfirmModalOpen = _useState2[0],
|
|
@@ -48,21 +50,27 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
48
50
|
teamCentralBaseUrl = props.teamCentralBaseUrl,
|
|
49
51
|
analyticsSource = props.analyticsSource,
|
|
50
52
|
onClose = props.onClose,
|
|
51
|
-
testId = props.testId
|
|
53
|
+
testId = props.testId,
|
|
54
|
+
onCreateKudosSuccess = props.onCreateKudosSuccess,
|
|
55
|
+
isActionsEnabled = props.isActionsEnabled;
|
|
52
56
|
var shouldBlockTransition = useCallback(function (e) {
|
|
53
57
|
e.preventDefault();
|
|
54
58
|
e.returnValue = intl.formatMessage(messages.unsavedKudosWarning);
|
|
55
59
|
}, [intl]);
|
|
56
60
|
var sendAnalytic = useCallback(function (action, options) {
|
|
61
|
+
var _props$recipient, _props$recipient2, _props$recipient3;
|
|
57
62
|
var analyticsEvent = createAnalyticsEvent({
|
|
58
63
|
action: action,
|
|
59
64
|
actionSubject: 'createKudos',
|
|
60
65
|
attributes: _objectSpread(_objectSpread({}, options), {}, {
|
|
61
|
-
analyticsSource: analyticsSource
|
|
66
|
+
analyticsSource: analyticsSource,
|
|
67
|
+
teamId: ((_props$recipient = props.recipient) === null || _props$recipient === void 0 ? void 0 : _props$recipient.type) === KudosType.TEAM ? props.recipient.recipientId : undefined,
|
|
68
|
+
KudosType: (_props$recipient2 = props.recipient) === null || _props$recipient2 === void 0 ? void 0 : _props$recipient2.type,
|
|
69
|
+
recipientId: (_props$recipient3 = props.recipient) === null || _props$recipient3 === void 0 ? void 0 : _props$recipient3.recipientId
|
|
62
70
|
})
|
|
63
71
|
});
|
|
64
72
|
analyticsEvent.fire(ANALYTICS_CHANNEL);
|
|
65
|
-
}, [analyticsSource, createAnalyticsEvent]);
|
|
73
|
+
}, [analyticsSource, createAnalyticsEvent, props.recipient]);
|
|
66
74
|
var closeDrawer = useCallback(function () {
|
|
67
75
|
setIsDirty(false);
|
|
68
76
|
setIsCloseConfirmModalOpen(false);
|
|
@@ -75,6 +83,7 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
75
83
|
var handleCreateOrFail = function handleCreateOrFail(addFlagConfig) {
|
|
76
84
|
closeDrawer();
|
|
77
85
|
addFlag && addFlag(addFlagConfig);
|
|
86
|
+
onCreateKudosSuccess && addFlagConfig.type === 'success' && onCreateKudosSuccess(flagEvent);
|
|
78
87
|
};
|
|
79
88
|
switch (flagEvent.eventType) {
|
|
80
89
|
case FlagEventType.KUDOS_CREATED:
|
|
@@ -90,6 +99,20 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
})),
|
|
102
|
+
actions: isActionsEnabled ? [{
|
|
103
|
+
content: /*#__PURE__*/React.createElement(Inline, {
|
|
104
|
+
space: "space.050",
|
|
105
|
+
alignBlock: "center"
|
|
106
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.kudosCreatedActionFlag), /*#__PURE__*/React.createElement(LinkExternalIcon, {
|
|
107
|
+
label: "",
|
|
108
|
+
color: "currentColor"
|
|
109
|
+
})),
|
|
110
|
+
href: "".concat(teamCentralBaseUrl, "/people/kudos/").concat(flagEvent.kudosUuid),
|
|
111
|
+
target: '_blank',
|
|
112
|
+
onClick: function onClick() {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
}] : undefined,
|
|
93
116
|
type: 'success'
|
|
94
117
|
});
|
|
95
118
|
break;
|
|
@@ -150,7 +173,7 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
150
173
|
// Not a known FlagEventType
|
|
151
174
|
return;
|
|
152
175
|
}
|
|
153
|
-
}, [addFlag, closeDrawer, teamCentralBaseUrl]);
|
|
176
|
+
}, [addFlag, closeDrawer, teamCentralBaseUrl, onCreateKudosSuccess, isActionsEnabled]);
|
|
154
177
|
var messageListener = useCallback(function (event) {
|
|
155
178
|
if (!props.isOpen) {
|
|
156
179
|
return;
|
|
@@ -236,7 +259,7 @@ var GiveKudosLauncher = function GiveKudosLauncher(props) {
|
|
|
236
259
|
className: ax([styles.iframe])
|
|
237
260
|
}));
|
|
238
261
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
239
|
-
}, [(_props$
|
|
262
|
+
}, [(_props$recipient4 = props.recipient) === null || _props$recipient4 === void 0 ? void 0 : _props$recipient4.recipientId, props.isOpen]);
|
|
240
263
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
241
264
|
zIndex: layers.modal()
|
|
242
265
|
}, /*#__PURE__*/React.createElement("div", {
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ declare const messages: {
|
|
|
14
14
|
defaultMessage: string;
|
|
15
15
|
description: string;
|
|
16
16
|
};
|
|
17
|
+
kudosCreatedActionFlag: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
17
22
|
kudosCreationFailedFlag: {
|
|
18
23
|
id: string;
|
|
19
24
|
defaultMessage: string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -17,11 +17,12 @@ interface FlagAction {
|
|
|
17
17
|
content: string | JSX.Element;
|
|
18
18
|
href?: string;
|
|
19
19
|
onClick?: () => void;
|
|
20
|
+
target?: string;
|
|
20
21
|
}
|
|
21
22
|
export interface Flag {
|
|
22
23
|
id: string | number;
|
|
23
24
|
title: string | JSX.Element;
|
|
24
|
-
description
|
|
25
|
+
description?: string | JSX.Element;
|
|
25
26
|
icon?: JSX.Element;
|
|
26
27
|
actions?: FlagAction[];
|
|
27
28
|
type?: FlagType;
|
|
@@ -45,5 +46,7 @@ export interface GiveKudosDrawerProps {
|
|
|
45
46
|
teamCentralBaseUrl: string;
|
|
46
47
|
cloudId: string;
|
|
47
48
|
addFlag?: (flag: any) => void;
|
|
49
|
+
onCreateKudosSuccess?: (flagEvent: FlagEvent) => void;
|
|
50
|
+
isActionsEnabled?: boolean;
|
|
48
51
|
}
|
|
49
52
|
export {};
|
|
@@ -14,6 +14,11 @@ declare const messages: {
|
|
|
14
14
|
defaultMessage: string;
|
|
15
15
|
description: string;
|
|
16
16
|
};
|
|
17
|
+
kudosCreatedActionFlag: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
17
22
|
kudosCreationFailedFlag: {
|
|
18
23
|
id: string;
|
|
19
24
|
defaultMessage: string;
|
|
@@ -17,11 +17,12 @@ interface FlagAction {
|
|
|
17
17
|
content: string | JSX.Element;
|
|
18
18
|
href?: string;
|
|
19
19
|
onClick?: () => void;
|
|
20
|
+
target?: string;
|
|
20
21
|
}
|
|
21
22
|
export interface Flag {
|
|
22
23
|
id: string | number;
|
|
23
24
|
title: string | JSX.Element;
|
|
24
|
-
description
|
|
25
|
+
description?: string | JSX.Element;
|
|
25
26
|
icon?: JSX.Element;
|
|
26
27
|
actions?: FlagAction[];
|
|
27
28
|
type?: FlagType;
|
|
@@ -45,5 +46,7 @@ export interface GiveKudosDrawerProps {
|
|
|
45
46
|
teamCentralBaseUrl: string;
|
|
46
47
|
cloudId: string;
|
|
47
48
|
addFlag?: (flag: any) => void;
|
|
49
|
+
onCreateKudosSuccess?: (flagEvent: FlagEvent) => void;
|
|
50
|
+
isActionsEnabled?: boolean;
|
|
48
51
|
}
|
|
49
52
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/give-kudos",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Give Kudos experience ",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,16 +42,17 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
45
|
-
"@atlaskit/button": "^
|
|
45
|
+
"@atlaskit/button": "^23.0.0",
|
|
46
46
|
"@atlaskit/css": "^0.10.0",
|
|
47
|
-
"@atlaskit/drawer": "^10.
|
|
48
|
-
"@atlaskit/icon": "^25.
|
|
47
|
+
"@atlaskit/drawer": "^10.1.0",
|
|
48
|
+
"@atlaskit/icon": "^25.6.0",
|
|
49
49
|
"@atlaskit/intl-messages-provider": "^2.0.0",
|
|
50
|
-
"@atlaskit/link": "^3.
|
|
51
|
-
"@atlaskit/modal-dialog": "^14.
|
|
50
|
+
"@atlaskit/link": "^3.1.0",
|
|
51
|
+
"@atlaskit/modal-dialog": "^14.1.0",
|
|
52
52
|
"@atlaskit/portal": "^5.1.0",
|
|
53
|
+
"@atlaskit/primitives": "^14.4.0",
|
|
53
54
|
"@atlaskit/theme": "^18.0.0",
|
|
54
|
-
"@atlaskit/tokens": "^4.
|
|
55
|
+
"@atlaskit/tokens": "^4.8.0",
|
|
55
56
|
"@babel/runtime": "^7.0.0",
|
|
56
57
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
57
58
|
},
|