@atlaskit/profilecard 19.17.7 → 19.18.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 +12 -0
- package/dist/cjs/client/RovoAgentCardClient.js +6 -3
- package/dist/cjs/client/getAgentInfo.js +7 -18
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/Actions.js +175 -0
- package/dist/cjs/components/Agent/AgentProfileCard.js +65 -7
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +10 -4
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +27 -13
- package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +1 -2
- package/dist/cjs/components/Agent/ConversationStarters.js +26 -0
- package/dist/cjs/components/Agent/useAgentActions.js +39 -0
- package/dist/cjs/components/Agent/useSetFavouriteAgent.js +85 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/cjs/util/rovoAgentUtils.js +24 -0
- package/dist/cjs/util/url.js +20 -0
- package/dist/es2019/client/RovoAgentCardClient.js +6 -3
- package/dist/es2019/client/getAgentInfo.js +5 -15
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/Actions.js +168 -0
- package/dist/es2019/components/Agent/AgentProfileCard.js +59 -8
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +17 -6
- package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +1 -2
- package/dist/es2019/components/Agent/ConversationStarters.js +20 -0
- package/dist/es2019/components/Agent/useAgentActions.js +34 -0
- package/dist/es2019/components/Agent/useSetFavouriteAgent.js +45 -0
- package/dist/es2019/index.js +4 -0
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/es2019/util/rovoAgentUtils.js +16 -0
- package/dist/es2019/util/url.js +9 -0
- package/dist/esm/client/RovoAgentCardClient.js +6 -3
- package/dist/esm/client/getAgentInfo.js +7 -18
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/Actions.js +165 -0
- package/dist/esm/components/Agent/AgentProfileCard.js +66 -8
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +11 -5
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +24 -13
- package/dist/esm/components/Agent/AgentProfileCardWrapper.js +1 -2
- package/dist/esm/components/Agent/ConversationStarters.js +19 -0
- package/dist/esm/components/Agent/useAgentActions.js +33 -0
- package/dist/esm/components/Agent/useSetFavouriteAgent.js +78 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/util/analytics.js +1 -1
- package/dist/esm/util/rovoAgentUtils.js +17 -0
- package/dist/esm/util/url.js +13 -0
- package/dist/types/client/RovoAgentCardClient.d.ts +1 -1
- package/dist/types/client/getAgentInfo.d.ts +2 -2
- package/dist/types/components/Agent/Actions.d.ts +11 -0
- package/dist/types/components/Agent/AgentProfileCard.d.ts +5 -1
- package/dist/types/components/Agent/AgentProfileCardResourced.d.ts +2 -0
- package/dist/types/components/Agent/AgentProfileCardTrigger.d.ts +2 -2
- package/dist/types/components/Agent/ConversationStarters.d.ts +3 -0
- package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +5 -1
- package/dist/types/components/Agent/useAgentActions.d.ts +7 -0
- package/dist/types/components/Agent/useSetFavouriteAgent.d.ts +10 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/types.d.ts +24 -3
- package/dist/types/util/rovoAgentUtils.d.ts +2 -0
- package/dist/types/util/url.d.ts +1 -0
- package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +1 -1
- package/dist/types-ts4.5/client/getAgentInfo.d.ts +2 -2
- package/dist/types-ts4.5/components/Agent/Actions.d.ts +11 -0
- package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +5 -1
- package/dist/types-ts4.5/components/Agent/AgentProfileCardResourced.d.ts +2 -0
- package/dist/types-ts4.5/components/Agent/AgentProfileCardTrigger.d.ts +2 -2
- package/dist/types-ts4.5/components/Agent/ConversationStarters.d.ts +3 -0
- package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +5 -1
- package/dist/types-ts4.5/components/Agent/useAgentActions.d.ts +7 -0
- package/dist/types-ts4.5/components/Agent/useSetFavouriteAgent.d.ts +10 -0
- package/dist/types-ts4.5/index.d.ts +5 -1
- package/dist/types-ts4.5/types.d.ts +27 -3
- package/dist/types-ts4.5/util/rovoAgentUtils.d.ts +2 -0
- package/dist/types-ts4.5/util/url.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Stack } from '@atlaskit/primitives';
|
|
3
|
+
import { AgentConversationStarters } from '@atlaskit/rovo-agent-components';
|
|
4
|
+
export var ConversationStarters = function ConversationStarters(_ref) {
|
|
5
|
+
var isAgentDefault = _ref.isAgentDefault,
|
|
6
|
+
onConversationStarterClick = _ref.onConversationStarterClick,
|
|
7
|
+
userDefinedConversationStarters = _ref.userDefinedConversationStarters;
|
|
8
|
+
var handleConversationStarterClick = function handleConversationStarterClick(conversationStarter) {
|
|
9
|
+
onConversationStarterClick(conversationStarter);
|
|
10
|
+
};
|
|
11
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
12
|
+
space: "space.050",
|
|
13
|
+
alignInline: "start"
|
|
14
|
+
}, /*#__PURE__*/React.createElement(AgentConversationStarters, {
|
|
15
|
+
isAgentDefault: isAgentDefault,
|
|
16
|
+
onConversationStarterClick: handleConversationStarterClick,
|
|
17
|
+
userDefinedConversationStarters: userDefinedConversationStarters
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { getATLContextUrl } from '@atlaskit/atlassian-context';
|
|
3
|
+
import { encodeParamsToUrl } from '../../util/url';
|
|
4
|
+
export var useAgentUrlActions = function useAgentUrlActions(_ref) {
|
|
5
|
+
var cloudId = _ref.cloudId;
|
|
6
|
+
var onEditAgent = useCallback(function (agentId) {
|
|
7
|
+
var url = "".concat(getATLContextUrl('home'), "/chat/agents/").concat(agentId, "/edit?cloudId=").concat(cloudId);
|
|
8
|
+
window.open(url, '_blank', 'noopener, noreferrer');
|
|
9
|
+
}, [cloudId]);
|
|
10
|
+
var onCopyAgent = useCallback(function (agentId) {
|
|
11
|
+
var baseUrl = "".concat(getATLContextUrl('home'), "/chat");
|
|
12
|
+
var urlWithParams = encodeParamsToUrl(baseUrl, {
|
|
13
|
+
cloudId: cloudId,
|
|
14
|
+
pathway: 'chat',
|
|
15
|
+
agentId: agentId
|
|
16
|
+
});
|
|
17
|
+
navigator.clipboard.writeText(urlWithParams);
|
|
18
|
+
}, [cloudId]);
|
|
19
|
+
var onDuplicateAgent = useCallback(function (agentId) {
|
|
20
|
+
var baseUrl = "".concat(getATLContextUrl('home'), "/chat/agents/new");
|
|
21
|
+
var urlWithParams = encodeParamsToUrl(baseUrl, {
|
|
22
|
+
cloudId: cloudId,
|
|
23
|
+
pathway: 'agents-create',
|
|
24
|
+
agentId: agentId
|
|
25
|
+
});
|
|
26
|
+
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
27
|
+
}, [cloudId]);
|
|
28
|
+
return {
|
|
29
|
+
onEditAgent: onEditAgent,
|
|
30
|
+
onCopyAgent: onCopyAgent,
|
|
31
|
+
onDuplicateAgent: onDuplicateAgent
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { createHeaders } from '../../util/rovoAgentUtils';
|
|
6
|
+
export var useSetFavouriteAgent = function useSetFavouriteAgent(_ref) {
|
|
7
|
+
var agentId = _ref.agentId,
|
|
8
|
+
cloudId = _ref.cloudId,
|
|
9
|
+
isStarred = _ref.isStarred,
|
|
10
|
+
product = _ref.product;
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
isLoading = _useState2[0],
|
|
14
|
+
setIsLoading = _useState2[1];
|
|
15
|
+
var _useState3 = useState(isStarred),
|
|
16
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
17
|
+
isFavourite = _useState4[0],
|
|
18
|
+
setIsFavourite = _useState4[1];
|
|
19
|
+
var setFavourite = /*#__PURE__*/function () {
|
|
20
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
var headers;
|
|
22
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
setIsLoading(true);
|
|
26
|
+
_context.prev = 1;
|
|
27
|
+
headers = createHeaders(product, cloudId);
|
|
28
|
+
if (!isFavourite) {
|
|
29
|
+
_context.next = 8;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
_context.next = 6;
|
|
33
|
+
return fetch(new Request("/agents/v1/".concat(agentId, "/favourite"), {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
credentials: 'include',
|
|
36
|
+
mode: 'cors',
|
|
37
|
+
headers: headers
|
|
38
|
+
})).then(function () {
|
|
39
|
+
setIsFavourite(true);
|
|
40
|
+
});
|
|
41
|
+
case 6:
|
|
42
|
+
_context.next = 10;
|
|
43
|
+
break;
|
|
44
|
+
case 8:
|
|
45
|
+
_context.next = 10;
|
|
46
|
+
return fetch(new Request("/agents/v1/".concat(agentId, "/favourite"), {
|
|
47
|
+
method: 'DELETE',
|
|
48
|
+
credentials: 'include',
|
|
49
|
+
mode: 'cors',
|
|
50
|
+
headers: headers
|
|
51
|
+
})).then(function () {
|
|
52
|
+
setIsFavourite(false);
|
|
53
|
+
});
|
|
54
|
+
case 10:
|
|
55
|
+
setIsLoading(false);
|
|
56
|
+
_context.next = 16;
|
|
57
|
+
break;
|
|
58
|
+
case 13:
|
|
59
|
+
_context.prev = 13;
|
|
60
|
+
_context.t0 = _context["catch"](1);
|
|
61
|
+
setIsLoading(false);
|
|
62
|
+
case 16:
|
|
63
|
+
case "end":
|
|
64
|
+
return _context.stop();
|
|
65
|
+
}
|
|
66
|
+
}, _callee, null, [[1, 13]]);
|
|
67
|
+
}));
|
|
68
|
+
return function setFavourite() {
|
|
69
|
+
return _ref2.apply(this, arguments);
|
|
70
|
+
};
|
|
71
|
+
}();
|
|
72
|
+
return {
|
|
73
|
+
isLoading: isLoading,
|
|
74
|
+
isStarred: isFavourite,
|
|
75
|
+
// hasError: Boolean(error) || cannotLoadUser,
|
|
76
|
+
setFavourite: setFavourite
|
|
77
|
+
};
|
|
78
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import ProfileCardClient from './client/ProfileCardClient';
|
|
|
5
5
|
import TeamProfileClient from './client/TeamProfileCardClient';
|
|
6
6
|
// Note: when generating and updating Flow types in Jira, `UserProfileClient` and `UserProfileCardClient` are the same type
|
|
7
7
|
import UserProfileClient, { modifyResponse } from './client/UserProfileCardClient';
|
|
8
|
+
import AgentProfileCard from './components/Agent/AgentProfileCard';
|
|
8
9
|
import TeamProfileCardTrigger from './components/Team/TeamProfileCardTrigger';
|
|
9
10
|
import ProfileCard from './components/User/ProfileCard';
|
|
10
11
|
import ProfileCardResourced from './components/User/ProfileCardResourced';
|
|
@@ -19,6 +20,9 @@ export { default as TeamProfileCard } from './components/Team/TeamProfileCard';
|
|
|
19
20
|
export { ProfileCard };
|
|
20
21
|
export { ProfileCardTrigger };
|
|
21
22
|
export { TeamProfileCardTrigger };
|
|
23
|
+
export { AgentProfileCard };
|
|
22
24
|
export { ProfileCardClient as ProfileClient, TeamProfileClient, UserProfileClient, modifyResponse };
|
|
23
25
|
export { DELAY_MS_SHOW, DELAY_MS_HIDE };
|
|
26
|
+
export { AgentProfileCardTrigger } from './components/Agent/AgentProfileCardTrigger';
|
|
27
|
+
export { AgentProfileCardResourced } from './components/Agent/AgentProfileCardResourced';
|
|
24
28
|
export default ProfileCardResourced;
|
|
@@ -39,7 +39,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
39
39
|
actionSubjectId: actionSubjectId,
|
|
40
40
|
attributes: _objectSpread(_objectSpread({
|
|
41
41
|
packageName: "@atlaskit/profilecard",
|
|
42
|
-
packageVersion: "19.
|
|
42
|
+
packageVersion: "19.18.0"
|
|
43
43
|
}, attributes), {}, {
|
|
44
44
|
firedAt: Math.round(getPageTime())
|
|
45
45
|
})
|
|
@@ -0,0 +1,17 @@
|
|
|
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; }
|
|
4
|
+
export var createHeaders = function createHeaders(product, cloudId) {
|
|
5
|
+
var config = {
|
|
6
|
+
headers: {
|
|
7
|
+
'X-Product': product,
|
|
8
|
+
'X-Experience-Id': 'profile-card',
|
|
9
|
+
'X-Cloudid': cloudId
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return new Headers(_objectSpread({}, config.headers || {}));
|
|
13
|
+
};
|
|
14
|
+
export var getAAIDFromARI = function getAAIDFromARI(ari) {
|
|
15
|
+
var matched = ari.match(/\/([a-zA-Z0-9_\|\-\:]{1,128})$/);
|
|
16
|
+
return matched ? matched[1] : undefined;
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
export var encodeParamsToUrl = function encodeParamsToUrl(baseUrl, params) {
|
|
3
|
+
var url = new URL(baseUrl);
|
|
4
|
+
var searchParams = new URLSearchParams();
|
|
5
|
+
for (var _i = 0, _Object$entries = Object.entries(params); _i < _Object$entries.length; _i++) {
|
|
6
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
7
|
+
key = _Object$entries$_i[0],
|
|
8
|
+
value = _Object$entries$_i[1];
|
|
9
|
+
searchParams.append(key, String(value));
|
|
10
|
+
}
|
|
11
|
+
url.search = searchParams.toString();
|
|
12
|
+
return url.toString();
|
|
13
|
+
};
|
|
@@ -4,6 +4,6 @@ import CachingClient from './CachingClient';
|
|
|
4
4
|
export default class RovoAgentCardClient extends CachingClient<RovoAgent> {
|
|
5
5
|
options: ProfileClientOptions;
|
|
6
6
|
constructor(options: ProfileClientOptions);
|
|
7
|
-
makeRequest(agentId: string): Promise<RovoAgent>;
|
|
7
|
+
makeRequest(agentId: string, cloudId: string): Promise<RovoAgent>;
|
|
8
8
|
getProfile(agentId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<RovoAgent>;
|
|
9
9
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type RovoAgent } from '../types';
|
|
2
|
-
export declare function getAgentDetailsByAgentId(agentId: string, product: string): Promise<RovoAgent>;
|
|
3
|
-
export declare function getAgentDetailsByUserId(userId: string, product: string): Promise<RovoAgent>;
|
|
2
|
+
export declare function getAgentDetailsByAgentId(agentId: string, product: string, cloudId: string): Promise<RovoAgent>;
|
|
3
|
+
export declare function getAgentDetailsByUserId(userId: string, product: string, cloudId: string): Promise<RovoAgent>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type AgentActionsProps = {
|
|
3
|
+
isAgentCreatedByCurrentUser?: boolean;
|
|
4
|
+
onEditAgent: () => void;
|
|
5
|
+
onCopyAgent: () => void;
|
|
6
|
+
onDuplicateAgent: () => void;
|
|
7
|
+
onDeleteAgent: () => void;
|
|
8
|
+
onChatClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const AgentActions: ({ isAgentCreatedByCurrentUser, onEditAgent, onDeleteAgent, onDuplicateAgent, onCopyAgent, onChatClick, }: AgentActionsProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -4,6 +4,10 @@ type AgentProfileCardProps = {
|
|
|
4
4
|
agent: RovoAgentProfileCardInfo;
|
|
5
5
|
isLoading?: boolean;
|
|
6
6
|
hasError?: boolean;
|
|
7
|
+
isCreatedByViewingUser?: boolean;
|
|
8
|
+
cloudId?: string;
|
|
9
|
+
onOpenChat?: (agentId: string) => void;
|
|
10
|
+
product?: string;
|
|
7
11
|
};
|
|
8
|
-
declare const AgentProfileCard: ({ agent, isLoading }: AgentProfileCardProps) => JSX.Element;
|
|
12
|
+
declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, }: AgentProfileCardProps) => JSX.Element;
|
|
9
13
|
export default AgentProfileCard;
|
|
@@ -6,5 +6,7 @@ export interface AgentProfileCardResourcedProps {
|
|
|
6
6
|
resourceClient: ProfileClient;
|
|
7
7
|
trigger?: TriggerType;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
|
+
viewingUserId?: string;
|
|
10
|
+
product?: string;
|
|
9
11
|
}
|
|
10
12
|
export declare const AgentProfileCardResourced: (props: AgentProfileCardResourcedProps) => JSX.Element | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type
|
|
3
|
-
export declare const AgentProfileCardTrigger: ({ trigger, ...props }:
|
|
2
|
+
import { type AgentProfileCardTriggerProps } from '../../types';
|
|
3
|
+
export declare const AgentProfileCardTrigger: ({ trigger, viewingUserId, product, ...props }: AgentProfileCardTriggerProps) => JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type AgentConversationStartersProps } from '@atlaskit/rovo-agent-components';
|
|
3
|
+
export declare const ConversationStarters: ({ isAgentDefault, onConversationStarterClick, userDefinedConversationStarters, }: AgentConversationStartersProps) => JSX.Element;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading }: {
|
|
2
|
+
export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, }: {
|
|
3
3
|
agent: import("../../types").RovoAgentProfileCardInfo;
|
|
4
4
|
isLoading?: boolean | undefined;
|
|
5
5
|
hasError?: boolean | undefined;
|
|
6
|
+
isCreatedByViewingUser?: boolean | undefined;
|
|
7
|
+
cloudId?: string | undefined;
|
|
8
|
+
onOpenChat?: ((agentId: string) => void) | undefined;
|
|
9
|
+
product?: string | undefined;
|
|
6
10
|
}) => JSX.Element>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const useSetFavouriteAgent: ({ agentId, cloudId, isStarred, product, }: {
|
|
2
|
+
agentId: string;
|
|
3
|
+
cloudId: string;
|
|
4
|
+
isStarred: boolean;
|
|
5
|
+
product: string;
|
|
6
|
+
}) => {
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
isStarred: boolean;
|
|
9
|
+
setFavourite: () => Promise<void>;
|
|
10
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ProfileCardClient from './client/ProfileCardClient';
|
|
2
2
|
import TeamProfileClient from './client/TeamProfileCardClient';
|
|
3
3
|
import UserProfileClient, { modifyResponse } from './client/UserProfileCardClient';
|
|
4
|
+
import AgentProfileCard from './components/Agent/AgentProfileCard';
|
|
4
5
|
import TeamProfileCardTrigger from './components/Team/TeamProfileCardTrigger';
|
|
5
6
|
import ProfileCard from './components/User/ProfileCard';
|
|
6
7
|
import ProfileCardResourced from './components/User/ProfileCardResourced';
|
|
@@ -8,11 +9,14 @@ import ProfileCardTrigger from './components/User/ProfileCardTrigger';
|
|
|
8
9
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from './util/config';
|
|
9
10
|
export { default as withOuterListeners } from './util/withOuterListeners';
|
|
10
11
|
export type { WithOuterListenersProps } from './util/withOuterListeners';
|
|
11
|
-
export type { ProfileCardErrorType, ProfilecardTriggerPosition, RelativeDateKeyType, StatusModifiedDateType, StatusType, TriggerType, ApiClientResponse, MessageIntlProviderProps, ProfileCardAction, ProfileCardClientData, ProfileCardResourcedProps, ProfileCardResourcedState, ProfileCardTriggerProps, ProfileCardTriggerState, ProfileClientOptions, ProfilecardProps, PrepopulatedData, Team, } from './types';
|
|
12
|
+
export type { ProfileCardErrorType, ProfilecardTriggerPosition, RelativeDateKeyType, StatusModifiedDateType, StatusType, TriggerType, ApiClientResponse, MessageIntlProviderProps, ProfileCardAction, ProfileCardClientData, ProfileCardResourcedProps, ProfileCardResourcedState, ProfileCardTriggerProps, ProfileCardTriggerState, ProfileClientOptions, ProfilecardProps, PrepopulatedData, Team, AgentProfileCardTriggerProps, } from './types';
|
|
12
13
|
export { default as TeamProfileCard } from './components/Team/TeamProfileCard';
|
|
13
14
|
export { ProfileCard };
|
|
14
15
|
export { ProfileCardTrigger };
|
|
15
16
|
export { TeamProfileCardTrigger };
|
|
17
|
+
export { AgentProfileCard };
|
|
16
18
|
export { ProfileCardClient as ProfileClient, TeamProfileClient, UserProfileClient, modifyResponse };
|
|
17
19
|
export { DELAY_MS_SHOW, DELAY_MS_HIDE };
|
|
20
|
+
export { AgentProfileCardTrigger } from './components/Agent/AgentProfileCardTrigger';
|
|
21
|
+
export { AgentProfileCardResourced } from './components/Agent/AgentProfileCardResourced';
|
|
18
22
|
export default ProfileCardResourced;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -52,19 +52,18 @@ export interface RovoAgent {
|
|
|
52
52
|
visibility?: 'PUBLIC' | 'PRIVATE' | null;
|
|
53
53
|
is_default: boolean;
|
|
54
54
|
actor_type: 'AGENT';
|
|
55
|
-
creator_cloud_id?: string | null;
|
|
56
55
|
follow_up_prompt_template?: string | null;
|
|
57
56
|
plugin_routing_type?: 'DEFAULT' | 'SKIP' | null;
|
|
58
57
|
user_defined_conversation_starters: string[] | null;
|
|
59
58
|
favourite: boolean;
|
|
60
|
-
deactivated: boolean;
|
|
61
|
-
deactivatedAt?: string;
|
|
62
59
|
favourite_count: number;
|
|
60
|
+
deactivated?: boolean;
|
|
63
61
|
}
|
|
64
62
|
export interface RovoAgentCreatorInfo {
|
|
65
63
|
type: 'CUSTOMER' | 'SYSTEM' | 'THIRD_PARTY';
|
|
66
64
|
name?: string;
|
|
67
65
|
profileLink?: string;
|
|
66
|
+
id?: string;
|
|
68
67
|
}
|
|
69
68
|
export interface RovoAgentProfileCardInfo extends RovoAgent {
|
|
70
69
|
creatorInfo: RovoAgentCreatorInfo | undefined;
|
|
@@ -151,6 +150,7 @@ export interface ProfileCardTriggerProps {
|
|
|
151
150
|
onVisibilityChange?: (isVisible: boolean) => void;
|
|
152
151
|
isVisible?: boolean;
|
|
153
152
|
offset?: [number, number];
|
|
153
|
+
product?: string;
|
|
154
154
|
}
|
|
155
155
|
export interface ProfileCardTriggerState {
|
|
156
156
|
visible?: boolean;
|
|
@@ -285,6 +285,27 @@ export interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps {
|
|
|
285
285
|
*/
|
|
286
286
|
cloudId?: string;
|
|
287
287
|
}
|
|
288
|
+
export interface AgentProfileCardTriggerProps {
|
|
289
|
+
userId: string;
|
|
290
|
+
cloudId?: string;
|
|
291
|
+
autoFocus?: boolean;
|
|
292
|
+
resourceClient: ProfileClient;
|
|
293
|
+
actions?: ProfileCardAction[];
|
|
294
|
+
onOpenChat?: (agentId: string) => void;
|
|
295
|
+
position?: ProfilecardTriggerPosition;
|
|
296
|
+
trigger?: TriggerType;
|
|
297
|
+
children: React.ReactNode;
|
|
298
|
+
testId?: string;
|
|
299
|
+
addFlag?: (flag: any) => void;
|
|
300
|
+
ariaLabel?: string;
|
|
301
|
+
ariaLabelledBy?: string;
|
|
302
|
+
prepopulatedData?: PrepopulatedData;
|
|
303
|
+
disabledAriaAttributes?: boolean;
|
|
304
|
+
isVisible?: boolean;
|
|
305
|
+
offset?: [number, number];
|
|
306
|
+
product?: string;
|
|
307
|
+
viewingUserId?: string;
|
|
308
|
+
}
|
|
288
309
|
export type StatusType = 'active' | 'inactive' | 'closed';
|
|
289
310
|
export type TriggerType = 'hover' | 'click';
|
|
290
311
|
export type StatusModifiedDateType = 'noDate' | 'thisWeek' | 'thisMonth' | 'lastMonth' | 'aFewMonths' | 'severalMonths' | 'moreThanAYear';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const encodeParamsToUrl: (baseUrl: string, params: Record<string, string | number | boolean>) => string;
|
|
@@ -4,6 +4,6 @@ import CachingClient from './CachingClient';
|
|
|
4
4
|
export default class RovoAgentCardClient extends CachingClient<RovoAgent> {
|
|
5
5
|
options: ProfileClientOptions;
|
|
6
6
|
constructor(options: ProfileClientOptions);
|
|
7
|
-
makeRequest(agentId: string): Promise<RovoAgent>;
|
|
7
|
+
makeRequest(agentId: string, cloudId: string): Promise<RovoAgent>;
|
|
8
8
|
getProfile(agentId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<RovoAgent>;
|
|
9
9
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type RovoAgent } from '../types';
|
|
2
|
-
export declare function getAgentDetailsByAgentId(agentId: string, product: string): Promise<RovoAgent>;
|
|
3
|
-
export declare function getAgentDetailsByUserId(userId: string, product: string): Promise<RovoAgent>;
|
|
2
|
+
export declare function getAgentDetailsByAgentId(agentId: string, product: string, cloudId: string): Promise<RovoAgent>;
|
|
3
|
+
export declare function getAgentDetailsByUserId(userId: string, product: string, cloudId: string): Promise<RovoAgent>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type AgentActionsProps = {
|
|
3
|
+
isAgentCreatedByCurrentUser?: boolean;
|
|
4
|
+
onEditAgent: () => void;
|
|
5
|
+
onCopyAgent: () => void;
|
|
6
|
+
onDuplicateAgent: () => void;
|
|
7
|
+
onDeleteAgent: () => void;
|
|
8
|
+
onChatClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const AgentActions: ({ isAgentCreatedByCurrentUser, onEditAgent, onDeleteAgent, onDuplicateAgent, onCopyAgent, onChatClick, }: AgentActionsProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -4,6 +4,10 @@ type AgentProfileCardProps = {
|
|
|
4
4
|
agent: RovoAgentProfileCardInfo;
|
|
5
5
|
isLoading?: boolean;
|
|
6
6
|
hasError?: boolean;
|
|
7
|
+
isCreatedByViewingUser?: boolean;
|
|
8
|
+
cloudId?: string;
|
|
9
|
+
onOpenChat?: (agentId: string) => void;
|
|
10
|
+
product?: string;
|
|
7
11
|
};
|
|
8
|
-
declare const AgentProfileCard: ({ agent, isLoading }: AgentProfileCardProps) => JSX.Element;
|
|
12
|
+
declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, }: AgentProfileCardProps) => JSX.Element;
|
|
9
13
|
export default AgentProfileCard;
|
|
@@ -6,5 +6,7 @@ export interface AgentProfileCardResourcedProps {
|
|
|
6
6
|
resourceClient: ProfileClient;
|
|
7
7
|
trigger?: TriggerType;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
|
+
viewingUserId?: string;
|
|
10
|
+
product?: string;
|
|
9
11
|
}
|
|
10
12
|
export declare const AgentProfileCardResourced: (props: AgentProfileCardResourcedProps) => JSX.Element | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type
|
|
3
|
-
export declare const AgentProfileCardTrigger: ({ trigger, ...props }:
|
|
2
|
+
import { type AgentProfileCardTriggerProps } from '../../types';
|
|
3
|
+
export declare const AgentProfileCardTrigger: ({ trigger, viewingUserId, product, ...props }: AgentProfileCardTriggerProps) => JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type AgentConversationStartersProps } from '@atlaskit/rovo-agent-components';
|
|
3
|
+
export declare const ConversationStarters: ({ isAgentDefault, onConversationStarterClick, userDefinedConversationStarters, }: AgentConversationStartersProps) => JSX.Element;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading }: {
|
|
2
|
+
export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, }: {
|
|
3
3
|
agent: import("../../types").RovoAgentProfileCardInfo;
|
|
4
4
|
isLoading?: boolean | undefined;
|
|
5
5
|
hasError?: boolean | undefined;
|
|
6
|
+
isCreatedByViewingUser?: boolean | undefined;
|
|
7
|
+
cloudId?: string | undefined;
|
|
8
|
+
onOpenChat?: ((agentId: string) => void) | undefined;
|
|
9
|
+
product?: string | undefined;
|
|
6
10
|
}) => JSX.Element>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const useSetFavouriteAgent: ({ agentId, cloudId, isStarred, product, }: {
|
|
2
|
+
agentId: string;
|
|
3
|
+
cloudId: string;
|
|
4
|
+
isStarred: boolean;
|
|
5
|
+
product: string;
|
|
6
|
+
}) => {
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
isStarred: boolean;
|
|
9
|
+
setFavourite: () => Promise<void>;
|
|
10
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ProfileCardClient from './client/ProfileCardClient';
|
|
2
2
|
import TeamProfileClient from './client/TeamProfileCardClient';
|
|
3
3
|
import UserProfileClient, { modifyResponse } from './client/UserProfileCardClient';
|
|
4
|
+
import AgentProfileCard from './components/Agent/AgentProfileCard';
|
|
4
5
|
import TeamProfileCardTrigger from './components/Team/TeamProfileCardTrigger';
|
|
5
6
|
import ProfileCard from './components/User/ProfileCard';
|
|
6
7
|
import ProfileCardResourced from './components/User/ProfileCardResourced';
|
|
@@ -8,11 +9,14 @@ import ProfileCardTrigger from './components/User/ProfileCardTrigger';
|
|
|
8
9
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from './util/config';
|
|
9
10
|
export { default as withOuterListeners } from './util/withOuterListeners';
|
|
10
11
|
export type { WithOuterListenersProps } from './util/withOuterListeners';
|
|
11
|
-
export type { ProfileCardErrorType, ProfilecardTriggerPosition, RelativeDateKeyType, StatusModifiedDateType, StatusType, TriggerType, ApiClientResponse, MessageIntlProviderProps, ProfileCardAction, ProfileCardClientData, ProfileCardResourcedProps, ProfileCardResourcedState, ProfileCardTriggerProps, ProfileCardTriggerState, ProfileClientOptions, ProfilecardProps, PrepopulatedData, Team, } from './types';
|
|
12
|
+
export type { ProfileCardErrorType, ProfilecardTriggerPosition, RelativeDateKeyType, StatusModifiedDateType, StatusType, TriggerType, ApiClientResponse, MessageIntlProviderProps, ProfileCardAction, ProfileCardClientData, ProfileCardResourcedProps, ProfileCardResourcedState, ProfileCardTriggerProps, ProfileCardTriggerState, ProfileClientOptions, ProfilecardProps, PrepopulatedData, Team, AgentProfileCardTriggerProps, } from './types';
|
|
12
13
|
export { default as TeamProfileCard } from './components/Team/TeamProfileCard';
|
|
13
14
|
export { ProfileCard };
|
|
14
15
|
export { ProfileCardTrigger };
|
|
15
16
|
export { TeamProfileCardTrigger };
|
|
17
|
+
export { AgentProfileCard };
|
|
16
18
|
export { ProfileCardClient as ProfileClient, TeamProfileClient, UserProfileClient, modifyResponse };
|
|
17
19
|
export { DELAY_MS_SHOW, DELAY_MS_HIDE };
|
|
20
|
+
export { AgentProfileCardTrigger } from './components/Agent/AgentProfileCardTrigger';
|
|
21
|
+
export { AgentProfileCardResourced } from './components/Agent/AgentProfileCardResourced';
|
|
18
22
|
export default ProfileCardResourced;
|
|
@@ -52,19 +52,18 @@ export interface RovoAgent {
|
|
|
52
52
|
visibility?: 'PUBLIC' | 'PRIVATE' | null;
|
|
53
53
|
is_default: boolean;
|
|
54
54
|
actor_type: 'AGENT';
|
|
55
|
-
creator_cloud_id?: string | null;
|
|
56
55
|
follow_up_prompt_template?: string | null;
|
|
57
56
|
plugin_routing_type?: 'DEFAULT' | 'SKIP' | null;
|
|
58
57
|
user_defined_conversation_starters: string[] | null;
|
|
59
58
|
favourite: boolean;
|
|
60
|
-
deactivated: boolean;
|
|
61
|
-
deactivatedAt?: string;
|
|
62
59
|
favourite_count: number;
|
|
60
|
+
deactivated?: boolean;
|
|
63
61
|
}
|
|
64
62
|
export interface RovoAgentCreatorInfo {
|
|
65
63
|
type: 'CUSTOMER' | 'SYSTEM' | 'THIRD_PARTY';
|
|
66
64
|
name?: string;
|
|
67
65
|
profileLink?: string;
|
|
66
|
+
id?: string;
|
|
68
67
|
}
|
|
69
68
|
export interface RovoAgentProfileCardInfo extends RovoAgent {
|
|
70
69
|
creatorInfo: RovoAgentCreatorInfo | undefined;
|
|
@@ -154,6 +153,7 @@ export interface ProfileCardTriggerProps {
|
|
|
154
153
|
number,
|
|
155
154
|
number
|
|
156
155
|
];
|
|
156
|
+
product?: string;
|
|
157
157
|
}
|
|
158
158
|
export interface ProfileCardTriggerState {
|
|
159
159
|
visible?: boolean;
|
|
@@ -288,6 +288,30 @@ export interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps {
|
|
|
288
288
|
*/
|
|
289
289
|
cloudId?: string;
|
|
290
290
|
}
|
|
291
|
+
export interface AgentProfileCardTriggerProps {
|
|
292
|
+
userId: string;
|
|
293
|
+
cloudId?: string;
|
|
294
|
+
autoFocus?: boolean;
|
|
295
|
+
resourceClient: ProfileClient;
|
|
296
|
+
actions?: ProfileCardAction[];
|
|
297
|
+
onOpenChat?: (agentId: string) => void;
|
|
298
|
+
position?: ProfilecardTriggerPosition;
|
|
299
|
+
trigger?: TriggerType;
|
|
300
|
+
children: React.ReactNode;
|
|
301
|
+
testId?: string;
|
|
302
|
+
addFlag?: (flag: any) => void;
|
|
303
|
+
ariaLabel?: string;
|
|
304
|
+
ariaLabelledBy?: string;
|
|
305
|
+
prepopulatedData?: PrepopulatedData;
|
|
306
|
+
disabledAriaAttributes?: boolean;
|
|
307
|
+
isVisible?: boolean;
|
|
308
|
+
offset?: [
|
|
309
|
+
number,
|
|
310
|
+
number
|
|
311
|
+
];
|
|
312
|
+
product?: string;
|
|
313
|
+
viewingUserId?: string;
|
|
314
|
+
}
|
|
291
315
|
export type StatusType = 'active' | 'inactive' | 'closed';
|
|
292
316
|
export type TriggerType = 'hover' | 'click';
|
|
293
317
|
export type StatusModifiedDateType = 'noDate' | 'thisWeek' | 'thisMonth' | 'lastMonth' | 'aFewMonths' | 'severalMonths' | 'moreThanAYear';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const encodeParamsToUrl: (baseUrl: string, params: Record<string, string | number | boolean>) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.18.0",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
56
|
-
"@atlaskit/atlassian-context": "^0.0.
|
|
56
|
+
"@atlaskit/atlassian-context": "^0.0.1",
|
|
57
57
|
"@atlaskit/avatar": "^21.15.0",
|
|
58
58
|
"@atlaskit/avatar-group": "^9.11.0",
|
|
59
59
|
"@atlaskit/button": "^20.1.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@atlaskit/empty-state": "^7.11.0",
|
|
62
62
|
"@atlaskit/focus-ring": "^1.6.0",
|
|
63
63
|
"@atlaskit/give-kudos": "^2.1.1",
|
|
64
|
-
"@atlaskit/icon": "^22.
|
|
64
|
+
"@atlaskit/icon": "^22.14.0",
|
|
65
65
|
"@atlaskit/lozenge": "^11.10.0",
|
|
66
66
|
"@atlaskit/menu": "^2.12.0",
|
|
67
67
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|