@atlaskit/smart-card 43.24.3 → 43.24.5

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,19 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.24.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ed9a3814a96db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ed9a3814a96db) -
8
+ Add RovoChatAction component
9
+ - Updated dependencies
10
+
11
+ ## 43.24.4
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 43.24.3
4
18
 
5
19
  ### Patch Changes
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
11
11
  var context = exports.context = {
12
12
  componentName: 'smart-cards',
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "43.24.2"
14
+ packageVersion: "43.24.4"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.RovoChatPromptKey = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _rovoChat = _interopRequireDefault(require("@atlaskit/icon/core/rovo-chat"));
13
+ var _useRovoChat2 = _interopRequireDefault(require("../../../../../state/hooks/use-rovo-chat"));
14
+ var _action = _interopRequireDefault(require("../action"));
15
+ var _excluded = ["onClick", "prompts", "testId"];
16
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
+ // Replace this with actual message key, e.g. link-relevancy, link-summary, etc.
18
+ var RovoChatPromptKey = exports.RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
19
+ RovoChatPromptKey["MESSAGE_1"] = "message-1";
20
+ RovoChatPromptKey["MESSAGE_2"] = "message-2";
21
+ return RovoChatPromptKey;
22
+ }({});
23
+ var DEFAULT_PROMPTS = [RovoChatPromptKey.MESSAGE_1, RovoChatPromptKey.MESSAGE_2];
24
+ var getPromptAction = function getPromptAction(promptKey) {
25
+ // NAVX-3581: Replace this with real prompt message
26
+ switch (promptKey) {
27
+ case RovoChatPromptKey.MESSAGE_1:
28
+ return {
29
+ icon: /*#__PURE__*/_react.default.createElement(_rovoChat.default, {
30
+ label: "",
31
+ spacing: "spacious"
32
+ }),
33
+ content: 'Action title 1',
34
+ tooltipMessage: 'Action tooltip 1',
35
+ data: {
36
+ name: 'Chat title 1',
37
+ dialogues: [],
38
+ prompt: {
39
+ version: 1,
40
+ type: 'doc',
41
+ content: []
42
+ }
43
+ }
44
+ };
45
+ case RovoChatPromptKey.MESSAGE_2:
46
+ return {
47
+ icon: /*#__PURE__*/_react.default.createElement(_rovoChat.default, {
48
+ label: "",
49
+ spacing: "spacious"
50
+ }),
51
+ content: 'Action title 2',
52
+ tooltipMessage: 'Action tooltip 2',
53
+ data: {
54
+ name: 'Chat title 2',
55
+ dialogues: [],
56
+ prompt: {
57
+ version: 1,
58
+ type: 'doc',
59
+ content: []
60
+ }
61
+ }
62
+ };
63
+ }
64
+ };
65
+ var RovoChatAction = function RovoChatAction(_ref) {
66
+ var onClickCallback = _ref.onClick,
67
+ _ref$prompts = _ref.prompts,
68
+ prompts = _ref$prompts === void 0 ? DEFAULT_PROMPTS : _ref$prompts,
69
+ _ref$testId = _ref.testId,
70
+ testId = _ref$testId === void 0 ? 'smart-action-rovo-chat-action' : _ref$testId,
71
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
72
+ var _useRovoChat = (0, _useRovoChat2.default)(),
73
+ sendPromptMessage = _useRovoChat.sendPromptMessage;
74
+ var _onClick = (0, _react.useCallback)(function (promptData) {
75
+ if (promptData) {
76
+ sendPromptMessage(promptData);
77
+
78
+ // NAVX-3599: Add analytics event, possibly as useInvokeClientAction()
79
+
80
+ onClickCallback === null || onClickCallback === void 0 || onClickCallback();
81
+ }
82
+ }, [onClickCallback, sendPromptMessage]);
83
+ var promptActions = (0, _react.useMemo)(function () {
84
+ return prompts.map(function (promptKey, idx) {
85
+ var _ref2 = getPromptAction(promptKey) || {},
86
+ icon = _ref2.icon,
87
+ content = _ref2.content,
88
+ tooltipMessage = _ref2.tooltipMessage,
89
+ promptData = _ref2.data;
90
+ return promptData ? /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
91
+ content: content,
92
+ icon: icon,
93
+ key: promptKey,
94
+ onClick: function onClick() {
95
+ return _onClick(promptData);
96
+ },
97
+ testId: "".concat(testId, "-").concat(idx + 1),
98
+ tooltipMessage: tooltipMessage
99
+ }, props)) : null;
100
+ });
101
+ }, [_onClick, prompts, props, testId]);
102
+ return (promptActions === null || promptActions === void 0 ? void 0 : promptActions.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, promptActions) : null;
103
+ };
104
+ var _default = exports.default = RovoChatAction;
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
22
22
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
23
23
  var PACKAGE_DATA = {
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "43.24.2",
25
+ packageVersion: "43.24.4",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
2
2
  export const context = {
3
3
  componentName: 'smart-cards',
4
4
  packageName: "@atlaskit/smart-card",
5
- packageVersion: "43.24.2"
5
+ packageVersion: "43.24.4"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,92 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback, useMemo } from 'react';
3
+ import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
4
+ import useRovoChat from '../../../../../state/hooks/use-rovo-chat';
5
+ import Action from '../action';
6
+ // Replace this with actual message key, e.g. link-relevancy, link-summary, etc.
7
+ export let RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
8
+ RovoChatPromptKey["MESSAGE_1"] = "message-1";
9
+ RovoChatPromptKey["MESSAGE_2"] = "message-2";
10
+ return RovoChatPromptKey;
11
+ }({});
12
+ const DEFAULT_PROMPTS = [RovoChatPromptKey.MESSAGE_1, RovoChatPromptKey.MESSAGE_2];
13
+ const getPromptAction = promptKey => {
14
+ // NAVX-3581: Replace this with real prompt message
15
+ switch (promptKey) {
16
+ case RovoChatPromptKey.MESSAGE_1:
17
+ return {
18
+ icon: /*#__PURE__*/React.createElement(RovoChatIcon, {
19
+ label: "",
20
+ spacing: "spacious"
21
+ }),
22
+ content: 'Action title 1',
23
+ tooltipMessage: 'Action tooltip 1',
24
+ data: {
25
+ name: 'Chat title 1',
26
+ dialogues: [],
27
+ prompt: {
28
+ version: 1,
29
+ type: 'doc',
30
+ content: []
31
+ }
32
+ }
33
+ };
34
+ case RovoChatPromptKey.MESSAGE_2:
35
+ return {
36
+ icon: /*#__PURE__*/React.createElement(RovoChatIcon, {
37
+ label: "",
38
+ spacing: "spacious"
39
+ }),
40
+ content: 'Action title 2',
41
+ tooltipMessage: 'Action tooltip 2',
42
+ data: {
43
+ name: 'Chat title 2',
44
+ dialogues: [],
45
+ prompt: {
46
+ version: 1,
47
+ type: 'doc',
48
+ content: []
49
+ }
50
+ }
51
+ };
52
+ }
53
+ };
54
+ const RovoChatAction = ({
55
+ onClick: onClickCallback,
56
+ prompts = DEFAULT_PROMPTS,
57
+ testId = 'smart-action-rovo-chat-action',
58
+ ...props
59
+ }) => {
60
+ const {
61
+ sendPromptMessage
62
+ } = useRovoChat();
63
+ const onClick = useCallback(promptData => {
64
+ if (promptData) {
65
+ sendPromptMessage(promptData);
66
+
67
+ // NAVX-3599: Add analytics event, possibly as useInvokeClientAction()
68
+
69
+ onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
70
+ }
71
+ }, [onClickCallback, sendPromptMessage]);
72
+ const promptActions = useMemo(() => {
73
+ return prompts.map((promptKey, idx) => {
74
+ const {
75
+ icon,
76
+ content,
77
+ tooltipMessage,
78
+ data: promptData
79
+ } = getPromptAction(promptKey) || {};
80
+ return promptData ? /*#__PURE__*/React.createElement(Action, _extends({
81
+ content: content,
82
+ icon: icon,
83
+ key: promptKey,
84
+ onClick: () => onClick(promptData),
85
+ testId: `${testId}-${idx + 1}`,
86
+ tooltipMessage: tooltipMessage
87
+ }, props)) : null;
88
+ });
89
+ }, [onClick, prompts, props, testId]);
90
+ return (promptActions === null || promptActions === void 0 ? void 0 : promptActions.length) > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, promptActions) : null;
91
+ };
92
+ export default RovoChatAction;
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  const PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "43.24.2",
15
+ packageVersion: "43.24.4",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  const Anchor = withLinkClickedEvent('a');
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "43.24.2"
7
+ packageVersion: "43.24.4"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,95 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["onClick", "prompts", "testId"];
4
+ import React, { useCallback, useMemo } from 'react';
5
+ import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
6
+ import useRovoChat from '../../../../../state/hooks/use-rovo-chat';
7
+ import Action from '../action';
8
+ // Replace this with actual message key, e.g. link-relevancy, link-summary, etc.
9
+ export var RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
10
+ RovoChatPromptKey["MESSAGE_1"] = "message-1";
11
+ RovoChatPromptKey["MESSAGE_2"] = "message-2";
12
+ return RovoChatPromptKey;
13
+ }({});
14
+ var DEFAULT_PROMPTS = [RovoChatPromptKey.MESSAGE_1, RovoChatPromptKey.MESSAGE_2];
15
+ var getPromptAction = function getPromptAction(promptKey) {
16
+ // NAVX-3581: Replace this with real prompt message
17
+ switch (promptKey) {
18
+ case RovoChatPromptKey.MESSAGE_1:
19
+ return {
20
+ icon: /*#__PURE__*/React.createElement(RovoChatIcon, {
21
+ label: "",
22
+ spacing: "spacious"
23
+ }),
24
+ content: 'Action title 1',
25
+ tooltipMessage: 'Action tooltip 1',
26
+ data: {
27
+ name: 'Chat title 1',
28
+ dialogues: [],
29
+ prompt: {
30
+ version: 1,
31
+ type: 'doc',
32
+ content: []
33
+ }
34
+ }
35
+ };
36
+ case RovoChatPromptKey.MESSAGE_2:
37
+ return {
38
+ icon: /*#__PURE__*/React.createElement(RovoChatIcon, {
39
+ label: "",
40
+ spacing: "spacious"
41
+ }),
42
+ content: 'Action title 2',
43
+ tooltipMessage: 'Action tooltip 2',
44
+ data: {
45
+ name: 'Chat title 2',
46
+ dialogues: [],
47
+ prompt: {
48
+ version: 1,
49
+ type: 'doc',
50
+ content: []
51
+ }
52
+ }
53
+ };
54
+ }
55
+ };
56
+ var RovoChatAction = function RovoChatAction(_ref) {
57
+ var onClickCallback = _ref.onClick,
58
+ _ref$prompts = _ref.prompts,
59
+ prompts = _ref$prompts === void 0 ? DEFAULT_PROMPTS : _ref$prompts,
60
+ _ref$testId = _ref.testId,
61
+ testId = _ref$testId === void 0 ? 'smart-action-rovo-chat-action' : _ref$testId,
62
+ props = _objectWithoutProperties(_ref, _excluded);
63
+ var _useRovoChat = useRovoChat(),
64
+ sendPromptMessage = _useRovoChat.sendPromptMessage;
65
+ var _onClick = useCallback(function (promptData) {
66
+ if (promptData) {
67
+ sendPromptMessage(promptData);
68
+
69
+ // NAVX-3599: Add analytics event, possibly as useInvokeClientAction()
70
+
71
+ onClickCallback === null || onClickCallback === void 0 || onClickCallback();
72
+ }
73
+ }, [onClickCallback, sendPromptMessage]);
74
+ var promptActions = useMemo(function () {
75
+ return prompts.map(function (promptKey, idx) {
76
+ var _ref2 = getPromptAction(promptKey) || {},
77
+ icon = _ref2.icon,
78
+ content = _ref2.content,
79
+ tooltipMessage = _ref2.tooltipMessage,
80
+ promptData = _ref2.data;
81
+ return promptData ? /*#__PURE__*/React.createElement(Action, _extends({
82
+ content: content,
83
+ icon: icon,
84
+ key: promptKey,
85
+ onClick: function onClick() {
86
+ return _onClick(promptData);
87
+ },
88
+ testId: "".concat(testId, "-").concat(idx + 1),
89
+ tooltipMessage: tooltipMessage
90
+ }, props)) : null;
91
+ });
92
+ }, [_onClick, prompts, props, testId]);
93
+ return (promptActions === null || promptActions === void 0 ? void 0 : promptActions.length) > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, promptActions) : null;
94
+ };
95
+ export default RovoChatAction;
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
15
15
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
16
16
  var PACKAGE_DATA = {
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "43.24.2",
18
+ packageVersion: "43.24.4",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');
@@ -1,5 +1,6 @@
1
1
  import type { ChatNewPayload } from '@atlaskit/rovo-triggers/types';
2
+ export type SendPromptMessageData = Partial<ChatNewPayload['data']>;
2
3
  declare const useRovoChat: () => {
3
- sendPromptMessage: (data: Partial<ChatNewPayload["data"]>) => void;
4
+ sendPromptMessage: (data: SendPromptMessageData) => void;
4
5
  };
5
6
  export default useRovoChat;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type LinkActionProps } from '../types';
3
+ export declare enum RovoChatPromptKey {
4
+ MESSAGE_1 = "message-1",
5
+ MESSAGE_2 = "message-2"
6
+ }
7
+ type RovoChatActionProps = LinkActionProps & {
8
+ prompts?: RovoChatPromptKey[];
9
+ };
10
+ declare const RovoChatAction: ({ onClick: onClickCallback, prompts, testId, ...props }: RovoChatActionProps) => React.JSX.Element | null;
11
+ export default RovoChatAction;
@@ -1,5 +1,6 @@
1
1
  import type { ChatNewPayload } from '@atlaskit/rovo-triggers/types';
2
+ export type SendPromptMessageData = Partial<ChatNewPayload['data']>;
2
3
  declare const useRovoChat: () => {
3
- sendPromptMessage: (data: Partial<ChatNewPayload["data"]>) => void;
4
+ sendPromptMessage: (data: SendPromptMessageData) => void;
4
5
  };
5
6
  export default useRovoChat;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type LinkActionProps } from '../types';
3
+ export declare enum RovoChatPromptKey {
4
+ MESSAGE_1 = "message-1",
5
+ MESSAGE_2 = "message-2"
6
+ }
7
+ type RovoChatActionProps = LinkActionProps & {
8
+ prompts?: RovoChatPromptKey[];
9
+ };
10
+ declare const RovoChatAction: ({ onClick: onClickCallback, prompts, testId, ...props }: RovoChatActionProps) => React.JSX.Element | null;
11
+ export default RovoChatAction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "43.24.3",
3
+ "version": "43.24.5",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -65,7 +65,7 @@
65
65
  "@atlaskit/popup": "^4.13.0",
66
66
  "@atlaskit/primitives": "^18.0.0",
67
67
  "@atlaskit/react-ufo": "^5.2.0",
68
- "@atlaskit/rovo-triggers": "^5.12.0",
68
+ "@atlaskit/rovo-triggers": "^5.13.0",
69
69
  "@atlaskit/section-message": "^8.12.0",
70
70
  "@atlaskit/select": "^21.7.0",
71
71
  "@atlaskit/spinner": "^19.0.0",
@@ -73,7 +73,7 @@
73
73
  "@atlaskit/textfield": "^8.2.0",
74
74
  "@atlaskit/theme": "^21.0.0",
75
75
  "@atlaskit/tile": "^1.0.0",
76
- "@atlaskit/tmp-editor-statsig": "^23.0.0",
76
+ "@atlaskit/tmp-editor-statsig": "^24.1.0",
77
77
  "@atlaskit/tokens": "^11.0.0",
78
78
  "@atlaskit/tooltip": "^20.14.0",
79
79
  "@atlaskit/ufo": "^0.4.0",
@@ -92,7 +92,7 @@
92
92
  "uuid": "^3.1.0"
93
93
  },
94
94
  "peerDependencies": {
95
- "@atlaskit/link-provider": "^4.1.0",
95
+ "@atlaskit/link-provider": "^4.2.0",
96
96
  "react": "^18.2.0",
97
97
  "react-dom": "^18.2.0",
98
98
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -104,7 +104,7 @@
104
104
  "@atlaskit/css-reset": "^7.3.0",
105
105
  "@atlaskit/media-test-helpers": "^39.0.0",
106
106
  "@atlaskit/ssr": "workspace:^",
107
- "@atlassian/a11y-jest-testing": "^0.9.0",
107
+ "@atlassian/a11y-jest-testing": "^0.10.0",
108
108
  "@atlassian/analytics-tooling": "workspace:^",
109
109
  "@atlassian/feature-flags-test-utils": "^1.0.0",
110
110
  "@atlassian/gemini": "^1.33.0",