@atlaskit/profilecard 19.19.0 → 19.21.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/afm-jira/tsconfig.json +6 -0
  4. package/afm-post-office/tsconfig.json +3 -0
  5. package/dist/cjs/client/ProfileCardClient.js +11 -3
  6. package/dist/cjs/client/RovoAgentCardClient.js +2 -5
  7. package/dist/cjs/client/UserProfileCardClient.js +107 -16
  8. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  9. package/dist/cjs/components/Agent/Actions.js +44 -27
  10. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +104 -0
  11. package/dist/cjs/components/Agent/AgentProfileCard.js +42 -10
  12. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +3 -4
  13. package/dist/cjs/components/Agent/hooks/useAgentActions.js +84 -0
  14. package/dist/cjs/components/Agent/hooks/useDeleteAgent.js +70 -0
  15. package/dist/cjs/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
  16. package/dist/cjs/components/User/ProfileCardTrigger.js +70 -29
  17. package/dist/cjs/components/common/LoadingState.js +3 -4
  18. package/dist/cjs/components/common/ProfileCardTrigger.js +5 -2
  19. package/dist/cjs/util/analytics.js +16 -16
  20. package/dist/es2019/client/ProfileCardClient.js +15 -3
  21. package/dist/es2019/client/RovoAgentCardClient.js +2 -5
  22. package/dist/es2019/client/UserProfileCardClient.js +97 -6
  23. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  24. package/dist/es2019/components/Agent/Actions.js +38 -25
  25. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +82 -0
  26. package/dist/es2019/components/Agent/AgentProfileCard.js +25 -10
  27. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +3 -4
  28. package/dist/es2019/components/Agent/hooks/useAgentActions.js +74 -0
  29. package/dist/es2019/components/Agent/hooks/useDeleteAgent.js +33 -0
  30. package/dist/es2019/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
  31. package/dist/es2019/components/User/ProfileCardTrigger.js +51 -9
  32. package/dist/es2019/components/common/LoadingState.js +2 -3
  33. package/dist/es2019/components/common/ProfileCardTrigger.js +5 -2
  34. package/dist/es2019/util/analytics.js +16 -16
  35. package/dist/esm/client/ProfileCardClient.js +11 -3
  36. package/dist/esm/client/RovoAgentCardClient.js +2 -5
  37. package/dist/esm/client/UserProfileCardClient.js +108 -17
  38. package/dist/esm/client/getTeamFromAGG.js +1 -1
  39. package/dist/esm/components/Agent/Actions.js +44 -27
  40. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +94 -0
  41. package/dist/esm/components/Agent/AgentProfileCard.js +41 -9
  42. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +3 -4
  43. package/dist/esm/components/Agent/hooks/useAgentActions.js +77 -0
  44. package/dist/esm/components/Agent/hooks/useDeleteAgent.js +63 -0
  45. package/dist/esm/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
  46. package/dist/esm/components/User/ProfileCardTrigger.js +70 -29
  47. package/dist/esm/components/common/LoadingState.js +2 -3
  48. package/dist/esm/components/common/ProfileCardTrigger.js +5 -2
  49. package/dist/esm/util/analytics.js +16 -16
  50. package/dist/types/client/UserProfileCardClient.d.ts +7 -1
  51. package/dist/types/components/Agent/AgentDeleteConfirmationModal.d.ts +10 -0
  52. package/dist/types/components/Agent/{useAgentActions.d.ts → hooks/useAgentActions.d.ts} +6 -0
  53. package/dist/types/components/Agent/hooks/useDeleteAgent.d.ts +8 -0
  54. package/dist/types/components/User/ProfileCardTrigger.d.ts +1 -1
  55. package/dist/types/components/common/LoadingState.d.ts +2 -2
  56. package/dist/types/components/common/types.d.ts +1 -2
  57. package/dist/types/types.d.ts +38 -3
  58. package/dist/types-ts4.5/client/UserProfileCardClient.d.ts +7 -1
  59. package/dist/types-ts4.5/components/Agent/AgentDeleteConfirmationModal.d.ts +10 -0
  60. package/dist/types-ts4.5/components/Agent/{useAgentActions.d.ts → hooks/useAgentActions.d.ts} +6 -0
  61. package/dist/types-ts4.5/components/Agent/hooks/useDeleteAgent.d.ts +8 -0
  62. package/dist/types-ts4.5/components/User/ProfileCardTrigger.d.ts +1 -1
  63. package/dist/types-ts4.5/components/common/LoadingState.d.ts +2 -2
  64. package/dist/types-ts4.5/components/common/types.d.ts +1 -2
  65. package/dist/types-ts4.5/types.d.ts +38 -3
  66. package/package.json +11 -3
  67. package/dist/cjs/components/Agent/useAgentActions.js +0 -39
  68. package/dist/es2019/components/Agent/useAgentActions.js +0 -34
  69. package/dist/esm/components/Agent/useAgentActions.js +0 -33
  70. /package/dist/types/components/Agent/{useSetFavouriteAgent.d.ts → hooks/useSetFavouriteAgent.d.ts} +0 -0
  71. /package/dist/types-ts4.5/components/Agent/{useSetFavouriteAgent.d.ts → hooks/useSetFavouriteAgent.d.ts} +0 -0
@@ -0,0 +1,63 @@
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 useDeleteAgent = function useDeleteAgent(_ref) {
7
+ var cloudId = _ref.cloudId,
8
+ product = _ref.product;
9
+ var _useState = useState(false),
10
+ _useState2 = _slicedToArray(_useState, 2),
11
+ isLoading = _useState2[0],
12
+ setIsLoading = _useState2[1];
13
+ var _useState3 = useState(),
14
+ _useState4 = _slicedToArray(_useState3, 2),
15
+ error = _useState4[0],
16
+ setError = _useState4[1];
17
+ var deleteAgent = /*#__PURE__*/function () {
18
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(agentId) {
19
+ var headers;
20
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ if (!(!agentId || !cloudId)) {
24
+ _context.next = 2;
25
+ break;
26
+ }
27
+ return _context.abrupt("return");
28
+ case 2:
29
+ setIsLoading(true);
30
+ _context.prev = 3;
31
+ headers = createHeaders(product, cloudId);
32
+ _context.next = 7;
33
+ return fetch(new Request("/gateway/api/assist/agents/v1/".concat(agentId), {
34
+ method: 'DELETE',
35
+ credentials: 'include',
36
+ mode: 'cors',
37
+ headers: headers
38
+ }));
39
+ case 7:
40
+ setIsLoading(false);
41
+ _context.next = 14;
42
+ break;
43
+ case 10:
44
+ _context.prev = 10;
45
+ _context.t0 = _context["catch"](3);
46
+ setIsLoading(false);
47
+ setError(_context.t0);
48
+ case 14:
49
+ case "end":
50
+ return _context.stop();
51
+ }
52
+ }, _callee, null, [[3, 10]]);
53
+ }));
54
+ return function deleteAgent(_x) {
55
+ return _ref2.apply(this, arguments);
56
+ };
57
+ }();
58
+ return {
59
+ isLoading: isLoading,
60
+ error: error,
61
+ deleteAgent: deleteAgent
62
+ };
63
+ };
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { useState } from 'react';
5
- import { createHeaders } from '../../util/rovoAgentUtils';
5
+ import { createHeaders } from '../../../util/rovoAgentUtils';
6
6
  export var useSetFavouriteAgent = function useSetFavouriteAgent(_ref) {
7
7
  var agentId = _ref.agentId,
8
8
  cloudId = _ref.cloudId,
@@ -1,9 +1,9 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _extends from "@babel/runtime/helpers/extends";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
+ import _extends from "@babel/runtime/helpers/extends";
7
7
  var _excluded = ["ref"],
8
8
  _excluded2 = ["aria-expanded", "aria-haspopup"];
9
9
  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; }
@@ -13,6 +13,7 @@ import React, { Suspense, useCallback, useEffect, useMemo, useRef, useState } fr
13
13
  import { useIntl } from 'react-intl-next';
14
14
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
15
15
  import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
  import Popup from '@atlaskit/popup';
17
18
  import { layers } from '@atlaskit/theme/constants';
18
19
  import filterActionsInner from '../../internal/filterActions';
@@ -20,29 +21,64 @@ import getLabelMessage from '../../internal/getLabelMessage';
20
21
  import { CardWrapper } from '../../styled/Card';
21
22
  import { cardTriggered, fireEvent } from '../../util/analytics';
22
23
  import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
24
+ import { AgentProfileCardResourced } from '../Agent/AgentProfileCardResourced';
23
25
  import { ProfileCardLazy } from './lazyProfileCard';
24
26
  import UserLoadingState from './UserLoadingState';
25
- export default function ProfilecardTriggerNext(_ref) {
26
- var autoFocus = _ref.autoFocus,
27
- _ref$trigger = _ref.trigger,
28
- trigger = _ref$trigger === void 0 ? 'hover' : _ref$trigger,
27
+ function ProfileCardContent(_ref) {
28
+ var profilecardProps = _ref.profilecardProps,
29
29
  userId = _ref.userId,
30
30
  cloudId = _ref.cloudId,
31
31
  resourceClient = _ref.resourceClient,
32
- _ref$actions = _ref.actions,
33
- actions = _ref$actions === void 0 ? [] : _ref$actions,
34
- _ref$position = _ref.position,
35
- position = _ref$position === void 0 ? 'bottom-start' : _ref$position,
36
- children = _ref.children,
37
- testId = _ref.testId,
38
- addFlag = _ref.addFlag,
39
- onReportingLinesClick = _ref.onReportingLinesClick,
40
- ariaLabel = _ref.ariaLabel,
41
- ariaLabelledBy = _ref.ariaLabelledBy,
42
- prepopulatedData = _ref.prepopulatedData,
43
- disabledAriaAttributes = _ref.disabledAriaAttributes,
44
- onVisibilityChange = _ref.onVisibilityChange,
45
- offset = _ref.offset;
32
+ viewingUserId = _ref.viewingUserId,
33
+ trigger = _ref.trigger,
34
+ product = _ref.product,
35
+ isAgent = _ref.isAgent,
36
+ profileCardAction = _ref.profileCardAction,
37
+ hasError = _ref.hasError,
38
+ errorType = _ref.errorType;
39
+ if (isAgent && fg('enable_agent_profile_card')) {
40
+ return /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
41
+ accountId: userId,
42
+ cloudId: cloudId,
43
+ resourceClient: resourceClient,
44
+ viewingUserId: viewingUserId,
45
+ trigger: trigger,
46
+ product: product
47
+ });
48
+ } else {
49
+ return /*#__PURE__*/React.createElement(Suspense, {
50
+ fallback: null
51
+ }, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({}, profilecardProps, {
52
+ actions: profileCardAction,
53
+ hasError: hasError,
54
+ errorType: errorType,
55
+ withoutElevation: true
56
+ })));
57
+ }
58
+ }
59
+ export default function ProfilecardTriggerNext(_ref2) {
60
+ var autoFocus = _ref2.autoFocus,
61
+ _ref2$trigger = _ref2.trigger,
62
+ trigger = _ref2$trigger === void 0 ? 'hover' : _ref2$trigger,
63
+ userId = _ref2.userId,
64
+ cloudId = _ref2.cloudId,
65
+ resourceClient = _ref2.resourceClient,
66
+ _ref2$actions = _ref2.actions,
67
+ actions = _ref2$actions === void 0 ? [] : _ref2$actions,
68
+ _ref2$position = _ref2.position,
69
+ position = _ref2$position === void 0 ? 'bottom-start' : _ref2$position,
70
+ children = _ref2.children,
71
+ testId = _ref2.testId,
72
+ addFlag = _ref2.addFlag,
73
+ onReportingLinesClick = _ref2.onReportingLinesClick,
74
+ ariaLabel = _ref2.ariaLabel,
75
+ ariaLabelledBy = _ref2.ariaLabelledBy,
76
+ prepopulatedData = _ref2.prepopulatedData,
77
+ disabledAriaAttributes = _ref2.disabledAriaAttributes,
78
+ onVisibilityChange = _ref2.onVisibilityChange,
79
+ offset = _ref2.offset,
80
+ viewingUserId = _ref2.viewingUserId,
81
+ product = _ref2.product;
46
82
  var _useAnalyticsEvents = useAnalyticsEvents(),
47
83
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
48
84
  var _useIntl = useIntl(),
@@ -264,7 +300,7 @@ export default function ProfilecardTriggerNext(_ref) {
264
300
  var profilecardProps = _objectSpread(_objectSpread({
265
301
  userId: userId,
266
302
  fullName: prepopulatedData === null || prepopulatedData === void 0 ? void 0 : prepopulatedData.fullName,
267
- isCurrentUser: data === null || data === void 0 ? void 0 : data.isCurrentUser,
303
+ isCurrentUser: fg('migrate_cloud_user_to_agg_user_query_profile_card') ? userId === viewingUserId : data === null || data === void 0 ? void 0 : data.isCurrentUser,
268
304
  clientFetchProfile: clientFetchProfile
269
305
  }, data), {}, {
270
306
  reportingLines: reportingLinesData,
@@ -287,14 +323,19 @@ export default function ProfilecardTriggerNext(_ref) {
287
323
  content: function content() {
288
324
  return /*#__PURE__*/React.createElement("div", wrapperProps, showLoading ? /*#__PURE__*/React.createElement(LoadingView, {
289
325
  fireAnalytics: fireAnalytics
290
- }) : visible && /*#__PURE__*/React.createElement(Suspense, {
291
- fallback: null
292
- }, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({}, profilecardProps, {
293
- actions: filterActions(),
294
- hasError: hasError,
326
+ }) : visible && /*#__PURE__*/React.createElement(ProfileCardContent, {
327
+ profilecardProps: profilecardProps,
328
+ isAgent: !!(data !== null && data !== void 0 && data.isAgent),
329
+ userId: userId,
330
+ cloudId: cloudId,
331
+ resourceClient: resourceClient,
332
+ viewingUserId: viewingUserId,
333
+ trigger: trigger,
334
+ product: product,
335
+ profileCardAction: filterActions(),
295
336
  errorType: error,
296
- withoutElevation: true
297
- }))));
337
+ hasError: hasError
338
+ }));
298
339
  },
299
340
  trigger: function trigger(triggerProps) {
300
341
  var callbackRef = triggerProps.ref,
@@ -336,8 +377,8 @@ export default function ProfilecardTriggerNext(_ref) {
336
377
  onClose: closeKudosDrawer
337
378
  })));
338
379
  }
339
- var LoadingView = function LoadingView(_ref3) {
340
- var fireAnalytics = _ref3.fireAnalytics;
380
+ var LoadingView = function LoadingView(_ref4) {
381
+ var fireAnalytics = _ref4.fireAnalytics;
341
382
  return /*#__PURE__*/React.createElement(CardWrapper, {
342
383
  "data-testId": "profilecard.profilecardtrigger.loading"
343
384
  }, /*#__PURE__*/React.createElement(UserLoadingState, {
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
2
2
  import AkSpinner from '@atlaskit/spinner';
3
3
  import { SpinnerContainer } from '../../styled/Card';
4
4
  import { profileCardRendered } from '../../util/analytics';
5
- var LoadingState = function LoadingState(_ref) {
5
+ export var LoadingState = function LoadingState(_ref) {
6
6
  var fireAnalytics = _ref.fireAnalytics,
7
7
  profileType = _ref.profileType;
8
8
  useEffect(function () {
@@ -11,5 +11,4 @@ var LoadingState = function LoadingState(_ref) {
11
11
  }
12
12
  }, [fireAnalytics, profileType]);
13
13
  return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
14
- };
15
- export default LoadingState;
14
+ };
@@ -10,6 +10,7 @@ import Popup from '@atlaskit/popup';
10
10
  import { layers } from '@atlaskit/theme/constants';
11
11
  import { cardTriggered } from '../../util/analytics';
12
12
  import { useProfileInfo } from '../../util/useProfileInfo';
13
+ import { LoadingState } from './LoadingState';
13
14
  import { PopupTrigger } from './PopupTrigger';
14
15
  var DELAY_MS_SHOW = 800;
15
16
  var DELAY_MS_HIDE = 200;
@@ -113,9 +114,11 @@ function ProfileCardTrigger(_ref) {
113
114
  onMouseEnter: onMouseEnter,
114
115
  onMouseLeave: hideProfilecard,
115
116
  onFocus: showProfilecard
116
- }, renderProfileCard({
117
+ }, isLoading ? /*#__PURE__*/React.createElement(LoadingState, {
118
+ fireAnalytics: fireAnalytics,
119
+ profileType: profileCardType
120
+ }) : renderProfileCard({
117
121
  profileData: profileData,
118
- isLoading: isLoading,
119
122
  error: error
120
123
  }));
121
124
  }
@@ -39,25 +39,25 @@ 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.19.0"
42
+ packageVersion: "19.21.0"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
46
46
  };
47
47
  };
48
+ var getActionSubject = function getActionSubject(type) {
49
+ switch (type) {
50
+ case 'user':
51
+ return USER_SUBJECT;
52
+ case 'team':
53
+ return TEAM_SUBJECT;
54
+ case 'agent':
55
+ return AGENT_SUBJECT;
56
+ default:
57
+ return 'user';
58
+ }
59
+ };
48
60
  export var cardTriggered = function cardTriggered(type, method) {
49
- var getActionSubject = function getActionSubject(type) {
50
- switch (type) {
51
- case 'user':
52
- return USER_SUBJECT;
53
- case 'team':
54
- return TEAM_SUBJECT;
55
- case 'agent':
56
- return AGENT_SUBJECT;
57
- default:
58
- return 'user';
59
- }
60
- };
61
61
  return createEvent('ui', 'triggered', getActionSubject(type), undefined, {
62
62
  method: method
63
63
  });
@@ -69,16 +69,16 @@ export var userRequestAnalytics = function userRequestAnalytics(action, attribut
69
69
  return createEvent('operational', action, USER_SUBJECT, 'request', attributes);
70
70
  };
71
71
  export var profileCardRendered = function profileCardRendered(type, actionSubjectId, attributes) {
72
- return createEvent('ui', 'rendered', type === 'user' ? USER_SUBJECT : TEAM_SUBJECT, actionSubjectId, attributes);
72
+ return createEvent('ui', 'rendered', getActionSubject(type), actionSubjectId, attributes);
73
73
  };
74
74
  export var actionClicked = function actionClicked(type, attributes) {
75
- return createEvent('ui', 'clicked', type === 'user' ? USER_SUBJECT : TEAM_SUBJECT, 'action', attributes);
75
+ return createEvent('ui', 'clicked', getActionSubject(type), 'action', attributes);
76
76
  };
77
77
  export var reportingLinesClicked = function reportingLinesClicked(attributes) {
78
78
  return createEvent('ui', 'clicked', USER_SUBJECT, 'reportingLines', attributes);
79
79
  };
80
80
  export var moreActionsClicked = function moreActionsClicked(type, attributes) {
81
- return createEvent('ui', 'clicked', type === 'user' ? USER_SUBJECT : TEAM_SUBJECT, 'moreActions', attributes);
81
+ return createEvent('ui', 'clicked', getActionSubject(type), 'moreActions', attributes);
82
82
  };
83
83
  export var teamAvatarClicked = function teamAvatarClicked(attributes) {
84
84
  return createEvent('ui', 'clicked', TEAM_SUBJECT, 'avatar', attributes);
@@ -1,5 +1,5 @@
1
1
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
- import { type ApiClientResponse, type ProfileCardClientData, type ProfileClientOptions } from '../types';
2
+ import type { ApiClientResponse, ProfileCardClientData, ProfileClientOptions } from '../types';
3
3
  import CachingClient from './CachingClient';
4
4
  /**
5
5
  * Transform response from GraphQL
@@ -22,6 +22,12 @@ export declare const buildUserQuery: (cloudId: string, userId: string) => {
22
22
  userId: string;
23
23
  };
24
24
  };
25
+ export declare const buildAggUserQuery: (userId: string) => {
26
+ query: string;
27
+ variables: {
28
+ userId: string;
29
+ };
30
+ };
25
31
  export default class UserProfileCardClient extends CachingClient<any> {
26
32
  options: ProfileClientOptions;
27
33
  constructor(options: ProfileClientOptions);
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onSubmit: () => void;
6
+ agentId: string;
7
+ agentName: string;
8
+ };
9
+ export declare const AgentDeleteConfirmationModal: ({ onClose, agentName, isOpen, onSubmit, agentId, }: Props) => JSX.Element;
10
+ export {};
@@ -1,7 +1,13 @@
1
+ export declare const firstCharUpper: (str: string) => string;
1
2
  export declare const useAgentUrlActions: ({ cloudId }: {
2
3
  cloudId: string;
3
4
  }) => {
4
5
  onEditAgent: (agentId: string) => void;
5
6
  onCopyAgent: (agentId: string) => void;
6
7
  onDuplicateAgent: (agentId: string) => void;
8
+ onOpenChat: () => void;
9
+ onConversationStarter: ({ agentId, prompt }: {
10
+ agentId: string;
11
+ prompt: string;
12
+ }) => void;
7
13
  };
@@ -0,0 +1,8 @@
1
+ export declare const useDeleteAgent: ({ cloudId, product }: {
2
+ cloudId?: string | undefined;
3
+ product: string;
4
+ }) => {
5
+ isLoading: boolean;
6
+ error: undefined;
7
+ deleteAgent: (agentId?: string) => Promise<void>;
8
+ };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { type ProfileCardTriggerProps } from '../../types';
3
- export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, }: ProfileCardTriggerProps): JSX.Element;
3
+ export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, viewingUserId, product, }: ProfileCardTriggerProps): JSX.Element;
@@ -4,5 +4,5 @@ interface AnalyticsProps {
4
4
  fireAnalytics?: (payload: AnalyticsEventPayload) => void;
5
5
  profileType: 'user' | 'team' | 'agent';
6
6
  }
7
- declare const LoadingState: ({ fireAnalytics, profileType }: AnalyticsProps) => JSX.Element;
8
- export default LoadingState;
7
+ export declare const LoadingState: ({ fireAnalytics, profileType }: AnalyticsProps) => JSX.Element;
8
+ export {};
@@ -7,9 +7,8 @@ export type ProfileCardTriggerProps<T> = {
7
7
  ariaLabelledBy?: string;
8
8
  disabledAriaAttributes?: boolean;
9
9
  children: React.ReactNode;
10
- renderProfileCard: ({ profileData, isLoading, error, }: {
10
+ renderProfileCard: ({ profileData, error, }: {
11
11
  profileData?: T;
12
- isLoading: boolean;
13
12
  error: ProfileCardErrorType | undefined | null;
14
13
  }) => React.ReactNode;
15
14
  fetchProfile?: () => Promise<T>;
@@ -70,7 +70,12 @@ export interface RovoAgentProfileCardInfo extends RovoAgent {
70
70
  }
71
71
  export interface ProfileCardClientData {
72
72
  isBot: boolean;
73
- isCurrentUser: boolean;
73
+ /**
74
+ * Mark it as optional as part of the migration from cloud user to AGG user
75
+ * This field will be calculated based on the user id and the principal user id props
76
+ * This will be removed once the migration is complete
77
+ */
78
+ isCurrentUser?: boolean;
74
79
  avatarUrl?: string;
75
80
  email?: string;
76
81
  fullName?: string;
@@ -83,6 +88,7 @@ export interface ProfileCardClientData {
83
88
  statusModifiedDate?: number | null;
84
89
  customLozenges?: LozengeProps[];
85
90
  accountType?: string;
91
+ isAgent?: boolean;
86
92
  }
87
93
  export interface ReportingLinesUserPII {
88
94
  name: string;
@@ -287,7 +293,7 @@ export interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps {
287
293
  cloudId?: string;
288
294
  }
289
295
  export interface AgentProfileCardTriggerProps {
290
- userId: string;
296
+ agentId: string;
291
297
  cloudId?: string;
292
298
  autoFocus?: boolean;
293
299
  resourceClient: ProfileClient;
@@ -409,7 +415,15 @@ export type TeamProfileCardErrorType = {
409
415
  reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
410
416
  } | null;
411
417
  export interface ProfileClientOptions {
412
- url: string;
418
+ /**
419
+ * pf-directory url
420
+ * When we clean up CloudUser migration FF, we should remove this prop
421
+ */
422
+ url?: string;
423
+ /**
424
+ * AGG url
425
+ * When we clean up CloudUser migration FF, we should mark this prop as required
426
+ */
413
427
  gatewayGraphqlUrl?: string;
414
428
  cacheSize?: number;
415
429
  cacheMaxAge?: number;
@@ -431,3 +445,24 @@ export interface ClientOverrides {
431
445
  export interface PrepopulatedData {
432
446
  fullName?: string;
433
447
  }
448
+ export type TeamsUserQueryResponse = {
449
+ id: string;
450
+ name: string;
451
+ picture: string;
452
+ accountStatus: StatusType;
453
+ __typename: 'AppUser' | string;
454
+ email?: string;
455
+ nickname?: string;
456
+ zoneinfo?: string;
457
+ extendedProfile?: {
458
+ jobTitle?: string;
459
+ organization?: string;
460
+ location?: string;
461
+ closedDate?: number;
462
+ inactiveDate?: number;
463
+ };
464
+ appType?: string;
465
+ };
466
+ export interface UserInSiteUserbase {
467
+ isPresent: boolean;
468
+ }
@@ -1,5 +1,5 @@
1
1
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
- import { type ApiClientResponse, type ProfileCardClientData, type ProfileClientOptions } from '../types';
2
+ import type { ApiClientResponse, ProfileCardClientData, ProfileClientOptions } from '../types';
3
3
  import CachingClient from './CachingClient';
4
4
  /**
5
5
  * Transform response from GraphQL
@@ -22,6 +22,12 @@ export declare const buildUserQuery: (cloudId: string, userId: string) => {
22
22
  userId: string;
23
23
  };
24
24
  };
25
+ export declare const buildAggUserQuery: (userId: string) => {
26
+ query: string;
27
+ variables: {
28
+ userId: string;
29
+ };
30
+ };
25
31
  export default class UserProfileCardClient extends CachingClient<any> {
26
32
  options: ProfileClientOptions;
27
33
  constructor(options: ProfileClientOptions);
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onSubmit: () => void;
6
+ agentId: string;
7
+ agentName: string;
8
+ };
9
+ export declare const AgentDeleteConfirmationModal: ({ onClose, agentName, isOpen, onSubmit, agentId, }: Props) => JSX.Element;
10
+ export {};
@@ -1,7 +1,13 @@
1
+ export declare const firstCharUpper: (str: string) => string;
1
2
  export declare const useAgentUrlActions: ({ cloudId }: {
2
3
  cloudId: string;
3
4
  }) => {
4
5
  onEditAgent: (agentId: string) => void;
5
6
  onCopyAgent: (agentId: string) => void;
6
7
  onDuplicateAgent: (agentId: string) => void;
8
+ onOpenChat: () => void;
9
+ onConversationStarter: ({ agentId, prompt }: {
10
+ agentId: string;
11
+ prompt: string;
12
+ }) => void;
7
13
  };
@@ -0,0 +1,8 @@
1
+ export declare const useDeleteAgent: ({ cloudId, product }: {
2
+ cloudId?: string | undefined;
3
+ product: string;
4
+ }) => {
5
+ isLoading: boolean;
6
+ error: undefined;
7
+ deleteAgent: (agentId?: string) => Promise<void>;
8
+ };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { type ProfileCardTriggerProps } from '../../types';
3
- export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, }: ProfileCardTriggerProps): JSX.Element;
3
+ export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, viewingUserId, product, }: ProfileCardTriggerProps): JSX.Element;
@@ -4,5 +4,5 @@ interface AnalyticsProps {
4
4
  fireAnalytics?: (payload: AnalyticsEventPayload) => void;
5
5
  profileType: 'user' | 'team' | 'agent';
6
6
  }
7
- declare const LoadingState: ({ fireAnalytics, profileType }: AnalyticsProps) => JSX.Element;
8
- export default LoadingState;
7
+ export declare const LoadingState: ({ fireAnalytics, profileType }: AnalyticsProps) => JSX.Element;
8
+ export {};
@@ -7,9 +7,8 @@ export type ProfileCardTriggerProps<T> = {
7
7
  ariaLabelledBy?: string;
8
8
  disabledAriaAttributes?: boolean;
9
9
  children: React.ReactNode;
10
- renderProfileCard: ({ profileData, isLoading, error, }: {
10
+ renderProfileCard: ({ profileData, error, }: {
11
11
  profileData?: T;
12
- isLoading: boolean;
13
12
  error: ProfileCardErrorType | undefined | null;
14
13
  }) => React.ReactNode;
15
14
  fetchProfile?: () => Promise<T>;
@@ -70,7 +70,12 @@ export interface RovoAgentProfileCardInfo extends RovoAgent {
70
70
  }
71
71
  export interface ProfileCardClientData {
72
72
  isBot: boolean;
73
- isCurrentUser: boolean;
73
+ /**
74
+ * Mark it as optional as part of the migration from cloud user to AGG user
75
+ * This field will be calculated based on the user id and the principal user id props
76
+ * This will be removed once the migration is complete
77
+ */
78
+ isCurrentUser?: boolean;
74
79
  avatarUrl?: string;
75
80
  email?: string;
76
81
  fullName?: string;
@@ -83,6 +88,7 @@ export interface ProfileCardClientData {
83
88
  statusModifiedDate?: number | null;
84
89
  customLozenges?: LozengeProps[];
85
90
  accountType?: string;
91
+ isAgent?: boolean;
86
92
  }
87
93
  export interface ReportingLinesUserPII {
88
94
  name: string;
@@ -290,7 +296,7 @@ export interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps {
290
296
  cloudId?: string;
291
297
  }
292
298
  export interface AgentProfileCardTriggerProps {
293
- userId: string;
299
+ agentId: string;
294
300
  cloudId?: string;
295
301
  autoFocus?: boolean;
296
302
  resourceClient: ProfileClient;
@@ -415,7 +421,15 @@ export type TeamProfileCardErrorType = {
415
421
  reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
416
422
  } | null;
417
423
  export interface ProfileClientOptions {
418
- url: string;
424
+ /**
425
+ * pf-directory url
426
+ * When we clean up CloudUser migration FF, we should remove this prop
427
+ */
428
+ url?: string;
429
+ /**
430
+ * AGG url
431
+ * When we clean up CloudUser migration FF, we should mark this prop as required
432
+ */
419
433
  gatewayGraphqlUrl?: string;
420
434
  cacheSize?: number;
421
435
  cacheMaxAge?: number;
@@ -437,3 +451,24 @@ export interface ClientOverrides {
437
451
  export interface PrepopulatedData {
438
452
  fullName?: string;
439
453
  }
454
+ export type TeamsUserQueryResponse = {
455
+ id: string;
456
+ name: string;
457
+ picture: string;
458
+ accountStatus: StatusType;
459
+ __typename: 'AppUser' | string;
460
+ email?: string;
461
+ nickname?: string;
462
+ zoneinfo?: string;
463
+ extendedProfile?: {
464
+ jobTitle?: string;
465
+ organization?: string;
466
+ location?: string;
467
+ closedDate?: number;
468
+ inactiveDate?: number;
469
+ };
470
+ appType?: string;
471
+ };
472
+ export interface UserInSiteUserbase {
473
+ isPresent: boolean;
474
+ }