@atlaskit/profilecard 19.22.1 → 19.24.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 (80) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/client/ProfileCardClient.js +12 -0
  3. package/dist/cjs/client/RovoAgentCardClient.js +131 -9
  4. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  5. package/dist/cjs/components/Agent/Actions.js +4 -3
  6. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +9 -9
  7. package/dist/cjs/components/Agent/AgentProfileCard.js +78 -38
  8. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +3 -1
  9. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +4 -2
  10. package/dist/cjs/components/Agent/messages.js +29 -0
  11. package/dist/cjs/components/User/ProfileCardTrigger.js +6 -3
  12. package/dist/cjs/components/common/ProfileCardTrigger.js +13 -25
  13. package/dist/cjs/util/analytics.js +3 -3
  14. package/dist/cjs/util/rovoAgentUtils.js +1 -15
  15. package/dist/es2019/client/ProfileCardClient.js +8 -0
  16. package/dist/es2019/client/RovoAgentCardClient.js +103 -6
  17. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  18. package/dist/es2019/components/Agent/Actions.js +4 -3
  19. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +9 -9
  20. package/dist/es2019/components/Agent/AgentProfileCard.js +42 -22
  21. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +3 -1
  22. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +4 -2
  23. package/dist/es2019/components/Agent/messages.js +23 -0
  24. package/dist/es2019/components/User/ProfileCardTrigger.js +6 -3
  25. package/dist/es2019/components/common/ProfileCardTrigger.js +2 -2
  26. package/dist/es2019/util/analytics.js +2 -2
  27. package/dist/es2019/util/rovoAgentUtils.js +0 -12
  28. package/dist/esm/client/ProfileCardClient.js +12 -0
  29. package/dist/esm/client/RovoAgentCardClient.js +131 -9
  30. package/dist/esm/client/getTeamFromAGG.js +1 -1
  31. package/dist/esm/components/Agent/Actions.js +4 -3
  32. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +9 -9
  33. package/dist/esm/components/Agent/AgentProfileCard.js +79 -39
  34. package/dist/esm/components/Agent/AgentProfileCardResourced.js +3 -1
  35. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +4 -2
  36. package/dist/esm/components/Agent/messages.js +23 -0
  37. package/dist/esm/components/User/ProfileCardTrigger.js +6 -3
  38. package/dist/esm/components/common/ProfileCardTrigger.js +13 -25
  39. package/dist/esm/util/analytics.js +3 -3
  40. package/dist/esm/util/rovoAgentUtils.js +0 -13
  41. package/dist/types/client/ProfileCardClient.d.ts +2 -0
  42. package/dist/types/client/RovoAgentCardClient.d.ts +2 -0
  43. package/dist/types/components/Agent/Actions.d.ts +3 -1
  44. package/dist/types/components/Agent/AgentProfileCard.d.ts +2 -11
  45. package/dist/types/components/Agent/AgentProfileCardResourced.d.ts +2 -1
  46. package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +1 -9
  47. package/dist/types/components/Agent/messages.d.ts +22 -0
  48. package/dist/types/components/common/LoadingState.d.ts +2 -1
  49. package/dist/types/components/common/types.d.ts +2 -2
  50. package/dist/types/types.d.ts +33 -3
  51. package/dist/types/util/analytics.d.ts +6 -5
  52. package/dist/types/util/rovoAgentUtils.d.ts +0 -1
  53. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +2 -0
  54. package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +2 -0
  55. package/dist/types-ts4.5/components/Agent/Actions.d.ts +3 -1
  56. package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +2 -11
  57. package/dist/types-ts4.5/components/Agent/AgentProfileCardResourced.d.ts +2 -1
  58. package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +1 -9
  59. package/dist/types-ts4.5/components/Agent/messages.d.ts +22 -0
  60. package/dist/types-ts4.5/components/common/LoadingState.d.ts +2 -1
  61. package/dist/types-ts4.5/components/common/types.d.ts +2 -2
  62. package/dist/types-ts4.5/types.d.ts +33 -3
  63. package/dist/types-ts4.5/util/analytics.d.ts +6 -5
  64. package/dist/types-ts4.5/util/rovoAgentUtils.d.ts +0 -1
  65. package/package.json +2 -2
  66. package/dist/cjs/client/getAgentInfo.js +0 -66
  67. package/dist/cjs/components/Agent/hooks/useDeleteAgent.js +0 -70
  68. package/dist/cjs/components/Agent/hooks/useSetFavouriteAgent.js +0 -91
  69. package/dist/es2019/client/getAgentInfo.js +0 -21
  70. package/dist/es2019/components/Agent/hooks/useDeleteAgent.js +0 -33
  71. package/dist/es2019/components/Agent/hooks/useSetFavouriteAgent.js +0 -48
  72. package/dist/esm/client/getAgentInfo.js +0 -58
  73. package/dist/esm/components/Agent/hooks/useDeleteAgent.js +0 -63
  74. package/dist/esm/components/Agent/hooks/useSetFavouriteAgent.js +0 -84
  75. package/dist/types/client/getAgentInfo.d.ts +0 -3
  76. package/dist/types/components/Agent/hooks/useDeleteAgent.d.ts +0 -8
  77. package/dist/types/components/Agent/hooks/useSetFavouriteAgent.d.ts +0 -10
  78. package/dist/types-ts4.5/client/getAgentInfo.d.ts +0 -3
  79. package/dist/types-ts4.5/components/Agent/hooks/useDeleteAgent.d.ts +0 -8
  80. package/dist/types-ts4.5/components/Agent/hooks/useSetFavouriteAgent.d.ts +0 -10
@@ -1,13 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { type AgentActionsType, type ProfileCardErrorType, type RovoAgentProfileCardInfo } from '../../types';
3
- type AgentProfileCardProps = {
4
- agent?: RovoAgentProfileCardInfo;
5
- isLoading?: boolean;
6
- hasError?: boolean;
7
- isCreatedByViewingUser?: boolean;
8
- cloudId?: string;
9
- product?: string;
10
- errorType?: ProfileCardErrorType;
11
- } & AgentActionsType;
12
- declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: AgentProfileCardProps) => JSX.Element;
2
+ import { type AgentProfileCardProps } from '../../types';
3
+ declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, }: AgentProfileCardProps) => JSX.Element;
13
4
  export default AgentProfileCard;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type AgentActionsType, type ProfileClient, type TriggerType } from '../../types';
2
+ import { type AgentActionsType, type Flag, type ProfileClient, type TriggerType } from '../../types';
3
3
  export type AgentProfileCardResourcedProps = {
4
4
  accountId: string;
5
5
  cloudId: string;
@@ -8,5 +8,6 @@ export type AgentProfileCardResourcedProps = {
8
8
  children?: React.ReactNode;
9
9
  viewingUserId?: string;
10
10
  product?: string;
11
+ addFlag?: (flag: Flag) => void;
11
12
  } & AgentActionsType;
12
13
  export declare const AgentProfileCardResourced: (props: AgentProfileCardResourcedProps) => JSX.Element | null;
@@ -1,10 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: {
3
- agent?: import("../../types").RovoAgentProfileCardInfo | undefined;
4
- isLoading?: boolean | undefined;
5
- hasError?: boolean | undefined;
6
- isCreatedByViewingUser?: boolean | undefined;
7
- cloudId?: string | undefined;
8
- product?: string | undefined;
9
- errorType?: import("../..").ProfileCardErrorType | undefined;
10
- } & import("../../types").AgentActionsType) => JSX.Element>;
2
+ export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, }: import("../../types").AgentProfileCardProps) => JSX.Element>;
@@ -0,0 +1,22 @@
1
+ export declare const messages: {
2
+ agentDeletedSuccessFlagTitle: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ agentDeletedSuccessFlagDescription: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ agentDeletedErrorFlagTitle: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ agentDeletedErrorFlagDescription: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
22
+ };
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
3
+ import { type ProfileType } from '../../types';
3
4
  interface AnalyticsProps {
4
5
  fireAnalytics?: (payload: AnalyticsEventPayload) => void;
5
- profileType: 'user' | 'team' | 'agent';
6
+ profileType: ProfileType;
6
7
  }
7
8
  export declare const LoadingState: ({ fireAnalytics, profileType }: AnalyticsProps) => JSX.Element;
8
9
  export {};
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
3
3
  import { type PopupProps } from '@atlaskit/popup';
4
- import { type ProfileCardErrorType } from '../../types';
4
+ import { type ProfileCardErrorType, type ProfileType } from '../../types';
5
5
  export type ProfileCardTriggerProps<T> = {
6
6
  trigger: 'hover' | 'click';
7
7
  ariaLabelledBy?: string;
@@ -12,6 +12,6 @@ export type ProfileCardTriggerProps<T> = {
12
12
  error: ProfileCardErrorType | undefined | null;
13
13
  }) => React.ReactNode;
14
14
  fetchProfile?: () => Promise<T>;
15
- profileCardType: 'agent' | 'user' | 'team';
15
+ profileCardType: ProfileType;
16
16
  fireAnalytics?: (payload: AnalyticsEventPayload) => void;
17
17
  } & Omit<PopupProps, 'trigger' | 'isOpen' | 'content'>;
@@ -25,6 +25,21 @@ export interface ApiClientResponse {
25
25
  statusModifiedDate: number | null;
26
26
  };
27
27
  }
28
+ type FlagAppearance = 'error' | 'info' | 'normal' | 'success' | 'warning';
29
+ export interface Flag {
30
+ id: number | string;
31
+ title?: string | React.ReactNode;
32
+ description?: string | React.ReactNode;
33
+ type?: FlagAppearance;
34
+ appearance?: FlagAppearance;
35
+ actions?: {
36
+ content: React.ReactNode;
37
+ onClick?: () => void;
38
+ href?: string;
39
+ target?: string;
40
+ }[];
41
+ icon?: JSX.Element;
42
+ }
28
43
  export interface Team {
29
44
  largeAvatarImageUrl?: string;
30
45
  smallAvatarImageUrl?: string;
@@ -47,7 +62,7 @@ export interface RovoAgent {
47
62
  name: string;
48
63
  description: string | null;
49
64
  system_prompt_template?: string | null;
50
- creator_type: 'SYSTEM' | 'CUSTOMER' | 'THIRD_PARTY';
65
+ creator_type: 'SYSTEM' | 'CUSTOMER' | 'THIRD_PARTY' | 'FORGE';
51
66
  creator?: string | null;
52
67
  visibility?: 'PUBLIC' | 'PRIVATE' | null;
53
68
  is_default: boolean;
@@ -60,7 +75,7 @@ export interface RovoAgent {
60
75
  deactivated?: boolean;
61
76
  }
62
77
  export interface RovoAgentCreatorInfo {
63
- type: 'CUSTOMER' | 'SYSTEM' | 'THIRD_PARTY';
78
+ type: 'CUSTOMER' | 'SYSTEM' | 'THIRD_PARTY' | 'FORGE';
64
79
  name?: string;
65
80
  profileLink?: string;
66
81
  id?: string;
@@ -307,7 +322,7 @@ export interface AgentProfileCardTriggerProps extends AgentActionsType {
307
322
  trigger?: TriggerType;
308
323
  children: React.ReactNode;
309
324
  testId?: string;
310
- addFlag?: (flag: any) => void;
325
+ addFlag?: (flag: Flag) => void;
311
326
  ariaLabel?: string;
312
327
  ariaLabelledBy?: string;
313
328
  prepopulatedData?: PrepopulatedData;
@@ -317,8 +332,20 @@ export interface AgentProfileCardTriggerProps extends AgentActionsType {
317
332
  product?: string;
318
333
  viewingUserId?: string;
319
334
  }
335
+ export type AgentProfileCardProps = {
336
+ resourceClient: ProfileClient;
337
+ agent?: RovoAgentProfileCardInfo;
338
+ isLoading?: boolean;
339
+ hasError?: boolean;
340
+ isCreatedByViewingUser?: boolean;
341
+ cloudId?: string;
342
+ product?: string;
343
+ errorType?: ProfileCardErrorType;
344
+ addFlag?: (flag: Flag) => void;
345
+ } & AgentActionsType;
320
346
  export type StatusType = 'active' | 'inactive' | 'closed';
321
347
  export type TriggerType = 'hover' | 'click';
348
+ export type ProfileType = 'user' | 'team' | 'agent';
322
349
  export type StatusModifiedDateType = 'noDate' | 'thisWeek' | 'thisMonth' | 'lastMonth' | 'aFewMonths' | 'severalMonths' | 'moreThanAYear';
323
350
  export interface ProfileCardAction {
324
351
  callback?: (...args: any[]) => any;
@@ -411,6 +438,8 @@ export interface ProfileClient {
411
438
  shouldShowGiveKudos: () => Promise<boolean>;
412
439
  getTeamCentralBaseUrl: () => string | undefined;
413
440
  getRovoAgentProfile: (id: AgentIdType, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<RovoAgent>;
441
+ deleteAgent: (id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
442
+ setFavouriteAgent: (id: string, isFavourite: boolean, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
414
443
  }
415
444
  export type ProfilecardTriggerPosition = 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end' | 'top-end' | 'top' | 'top-start' | 'right-end' | 'right' | 'right-start';
416
445
  export type ProfileCardErrorType = {
@@ -471,3 +500,4 @@ export type TeamsUserQueryResponse = {
471
500
  export interface UserInSiteUserbase {
472
501
  isPresent: boolean;
473
502
  }
503
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
3
  import { type ErrorAttributes } from '../client/types';
4
+ import { type ProfileType } from '../types';
4
5
  type GenericAttributes = Record<string, string | number | boolean | undefined | string[]> | ErrorAttributes;
5
6
  interface AnalyticsEvent {
6
7
  action?: string;
@@ -11,14 +12,14 @@ interface AnalyticsEvent {
11
12
  source?: string;
12
13
  }
13
14
  export declare const fireEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent | undefined, body: AnalyticsEvent) => void;
14
- export declare const cardTriggered: (type: 'user' | 'team' | 'agent', method: 'hover' | 'click') => AnalyticsEventPayload;
15
+ export declare const cardTriggered: (type: ProfileType, method: 'hover' | 'click') => AnalyticsEventPayload;
15
16
  export declare const teamRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', attributes?: {
16
17
  duration: number;
17
18
  } & GenericAttributes) => AnalyticsEventPayload;
18
19
  export declare const userRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', attributes?: {
19
20
  duration: number;
20
21
  } & GenericAttributes) => AnalyticsEventPayload;
21
- export declare const profileCardRendered: (type: 'user' | 'team' | 'agent', actionSubjectId: 'spinner' | 'content' | 'error' | 'errorBoundary', attributes?: {
22
+ export declare const profileCardRendered: (type: ProfileType, actionSubjectId: 'spinner' | 'content' | 'error' | 'errorBoundary', attributes?: {
22
23
  duration?: number;
23
24
  errorType?: 'default' | 'NotFound';
24
25
  hasRetry?: boolean;
@@ -28,7 +29,7 @@ export declare const profileCardRendered: (type: 'user' | 'team' | 'agent', acti
28
29
  descriptionLength?: number;
29
30
  titleLength?: number;
30
31
  }) => AnalyticsEventPayload;
31
- export declare const actionClicked: (type: 'user' | 'team', attributes: {
32
+ export declare const actionClicked: (type: ProfileType, attributes: {
32
33
  duration: number;
33
34
  hasHref: boolean;
34
35
  hasOnClick: boolean;
@@ -39,7 +40,7 @@ export declare const reportingLinesClicked: (attributes: {
39
40
  userType: 'manager' | 'direct-report';
40
41
  duration: number;
41
42
  }) => AnalyticsEventPayload;
42
- export declare const moreActionsClicked: (type: 'user' | 'team', attributes: {
43
+ export declare const moreActionsClicked: (type: ProfileType, attributes: {
43
44
  duration: number;
44
45
  numActions: number;
45
46
  }) => AnalyticsEventPayload;
@@ -56,7 +57,7 @@ export declare const moreMembersClicked: (attributes: {
56
57
  export declare const errorRetryClicked: (attributes: {
57
58
  duration: number;
58
59
  }) => AnalyticsEventPayload;
59
- export declare const agentRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', attributes?: {
60
+ export declare const agentRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', actionSubjectId?: string, attributes?: {
60
61
  duration: number;
61
62
  } & GenericAttributes) => AnalyticsEventPayload;
62
63
  export {};
@@ -1,3 +1,2 @@
1
1
  export declare const USER_ARI_PREFIX = "ari:cloud:identity::user/";
2
- export declare const createHeaders: (product: string, cloudId: string) => Headers;
3
2
  export declare const getAAIDFromARI: (ari: string) => string | undefined;
@@ -17,5 +17,7 @@ declare class ProfileCardClient {
17
17
  getTeamCentralBaseUrl(): string | undefined;
18
18
  shouldShowGiveKudos(): Promise<boolean>;
19
19
  getRovoAgentProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").RovoAgent>;
20
+ deleteAgent(id: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
21
+ setFavouriteAgent(id: string, isFavourite: boolean, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
20
22
  }
21
23
  export default ProfileCardClient;
@@ -6,4 +6,6 @@ export default class RovoAgentCardClient extends CachingClient<RovoAgent> {
6
6
  constructor(options: ProfileClientOptions);
7
7
  makeRequest(id: AgentIdType, cloudId: string): Promise<RovoAgent>;
8
8
  getProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<RovoAgent>;
9
+ deleteAgent(agentId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
10
+ setFavouriteAgent(agentId: string, isFavourite: boolean, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
9
11
  }
@@ -1,5 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { type RovoAgentProfileCardInfo } from '../../types';
2
3
  type AgentActionsProps = {
4
+ agent: RovoAgentProfileCardInfo;
3
5
  isAgentCreatedByCurrentUser?: boolean;
4
6
  onEditAgent: () => void;
5
7
  onCopyAgent: () => void;
@@ -7,5 +9,5 @@ type AgentActionsProps = {
7
9
  onDeleteAgent: () => void;
8
10
  onChatClick: () => void;
9
11
  };
10
- export declare const AgentActions: ({ isAgentCreatedByCurrentUser, onEditAgent, onDeleteAgent, onDuplicateAgent, onCopyAgent, onChatClick, }: AgentActionsProps) => JSX.Element;
12
+ export declare const AgentActions: ({ isAgentCreatedByCurrentUser, onEditAgent, onDeleteAgent, onDuplicateAgent, onCopyAgent, onChatClick, agent, }: AgentActionsProps) => JSX.Element;
11
13
  export {};
@@ -1,13 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { type AgentActionsType, type ProfileCardErrorType, type RovoAgentProfileCardInfo } from '../../types';
3
- type AgentProfileCardProps = {
4
- agent?: RovoAgentProfileCardInfo;
5
- isLoading?: boolean;
6
- hasError?: boolean;
7
- isCreatedByViewingUser?: boolean;
8
- cloudId?: string;
9
- product?: string;
10
- errorType?: ProfileCardErrorType;
11
- } & AgentActionsType;
12
- declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: AgentProfileCardProps) => JSX.Element;
2
+ import { type AgentProfileCardProps } from '../../types';
3
+ declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, }: AgentProfileCardProps) => JSX.Element;
13
4
  export default AgentProfileCard;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type AgentActionsType, type ProfileClient, type TriggerType } from '../../types';
2
+ import { type AgentActionsType, type Flag, type ProfileClient, type TriggerType } from '../../types';
3
3
  export type AgentProfileCardResourcedProps = {
4
4
  accountId: string;
5
5
  cloudId: string;
@@ -8,5 +8,6 @@ export type AgentProfileCardResourcedProps = {
8
8
  children?: React.ReactNode;
9
9
  viewingUserId?: string;
10
10
  product?: string;
11
+ addFlag?: (flag: Flag) => void;
11
12
  } & AgentActionsType;
12
13
  export declare const AgentProfileCardResourced: (props: AgentProfileCardResourcedProps) => JSX.Element | null;
@@ -1,10 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: {
3
- agent?: import("../../types").RovoAgentProfileCardInfo | undefined;
4
- isLoading?: boolean | undefined;
5
- hasError?: boolean | undefined;
6
- isCreatedByViewingUser?: boolean | undefined;
7
- cloudId?: string | undefined;
8
- product?: string | undefined;
9
- errorType?: import("../..").ProfileCardErrorType | undefined;
10
- } & import("../../types").AgentActionsType) => JSX.Element>;
2
+ export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, }: import("../../types").AgentProfileCardProps) => JSX.Element>;
@@ -0,0 +1,22 @@
1
+ export declare const messages: {
2
+ agentDeletedSuccessFlagTitle: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ agentDeletedSuccessFlagDescription: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ agentDeletedErrorFlagTitle: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ agentDeletedErrorFlagDescription: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
22
+ };
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
3
+ import { type ProfileType } from '../../types';
3
4
  interface AnalyticsProps {
4
5
  fireAnalytics?: (payload: AnalyticsEventPayload) => void;
5
- profileType: 'user' | 'team' | 'agent';
6
+ profileType: ProfileType;
6
7
  }
7
8
  export declare const LoadingState: ({ fireAnalytics, profileType }: AnalyticsProps) => JSX.Element;
8
9
  export {};
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
3
3
  import { type PopupProps } from '@atlaskit/popup';
4
- import { type ProfileCardErrorType } from '../../types';
4
+ import { type ProfileCardErrorType, type ProfileType } from '../../types';
5
5
  export type ProfileCardTriggerProps<T> = {
6
6
  trigger: 'hover' | 'click';
7
7
  ariaLabelledBy?: string;
@@ -12,6 +12,6 @@ export type ProfileCardTriggerProps<T> = {
12
12
  error: ProfileCardErrorType | undefined | null;
13
13
  }) => React.ReactNode;
14
14
  fetchProfile?: () => Promise<T>;
15
- profileCardType: 'agent' | 'user' | 'team';
15
+ profileCardType: ProfileType;
16
16
  fireAnalytics?: (payload: AnalyticsEventPayload) => void;
17
17
  } & Omit<PopupProps, 'trigger' | 'isOpen' | 'content'>;
@@ -25,6 +25,21 @@ export interface ApiClientResponse {
25
25
  statusModifiedDate: number | null;
26
26
  };
27
27
  }
28
+ type FlagAppearance = 'error' | 'info' | 'normal' | 'success' | 'warning';
29
+ export interface Flag {
30
+ id: number | string;
31
+ title?: string | React.ReactNode;
32
+ description?: string | React.ReactNode;
33
+ type?: FlagAppearance;
34
+ appearance?: FlagAppearance;
35
+ actions?: {
36
+ content: React.ReactNode;
37
+ onClick?: () => void;
38
+ href?: string;
39
+ target?: string;
40
+ }[];
41
+ icon?: JSX.Element;
42
+ }
28
43
  export interface Team {
29
44
  largeAvatarImageUrl?: string;
30
45
  smallAvatarImageUrl?: string;
@@ -47,7 +62,7 @@ export interface RovoAgent {
47
62
  name: string;
48
63
  description: string | null;
49
64
  system_prompt_template?: string | null;
50
- creator_type: 'SYSTEM' | 'CUSTOMER' | 'THIRD_PARTY';
65
+ creator_type: 'SYSTEM' | 'CUSTOMER' | 'THIRD_PARTY' | 'FORGE';
51
66
  creator?: string | null;
52
67
  visibility?: 'PUBLIC' | 'PRIVATE' | null;
53
68
  is_default: boolean;
@@ -60,7 +75,7 @@ export interface RovoAgent {
60
75
  deactivated?: boolean;
61
76
  }
62
77
  export interface RovoAgentCreatorInfo {
63
- type: 'CUSTOMER' | 'SYSTEM' | 'THIRD_PARTY';
78
+ type: 'CUSTOMER' | 'SYSTEM' | 'THIRD_PARTY' | 'FORGE';
64
79
  name?: string;
65
80
  profileLink?: string;
66
81
  id?: string;
@@ -310,7 +325,7 @@ export interface AgentProfileCardTriggerProps extends AgentActionsType {
310
325
  trigger?: TriggerType;
311
326
  children: React.ReactNode;
312
327
  testId?: string;
313
- addFlag?: (flag: any) => void;
328
+ addFlag?: (flag: Flag) => void;
314
329
  ariaLabel?: string;
315
330
  ariaLabelledBy?: string;
316
331
  prepopulatedData?: PrepopulatedData;
@@ -323,8 +338,20 @@ export interface AgentProfileCardTriggerProps extends AgentActionsType {
323
338
  product?: string;
324
339
  viewingUserId?: string;
325
340
  }
341
+ export type AgentProfileCardProps = {
342
+ resourceClient: ProfileClient;
343
+ agent?: RovoAgentProfileCardInfo;
344
+ isLoading?: boolean;
345
+ hasError?: boolean;
346
+ isCreatedByViewingUser?: boolean;
347
+ cloudId?: string;
348
+ product?: string;
349
+ errorType?: ProfileCardErrorType;
350
+ addFlag?: (flag: Flag) => void;
351
+ } & AgentActionsType;
326
352
  export type StatusType = 'active' | 'inactive' | 'closed';
327
353
  export type TriggerType = 'hover' | 'click';
354
+ export type ProfileType = 'user' | 'team' | 'agent';
328
355
  export type StatusModifiedDateType = 'noDate' | 'thisWeek' | 'thisMonth' | 'lastMonth' | 'aFewMonths' | 'severalMonths' | 'moreThanAYear';
329
356
  export interface ProfileCardAction {
330
357
  callback?: (...args: any[]) => any;
@@ -417,6 +444,8 @@ export interface ProfileClient {
417
444
  shouldShowGiveKudos: () => Promise<boolean>;
418
445
  getTeamCentralBaseUrl: () => string | undefined;
419
446
  getRovoAgentProfile: (id: AgentIdType, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<RovoAgent>;
447
+ deleteAgent: (id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
448
+ setFavouriteAgent: (id: string, isFavourite: boolean, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
420
449
  }
421
450
  export type ProfilecardTriggerPosition = 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end' | 'top-end' | 'top' | 'top-start' | 'right-end' | 'right' | 'right-start';
422
451
  export type ProfileCardErrorType = {
@@ -477,3 +506,4 @@ export type TeamsUserQueryResponse = {
477
506
  export interface UserInSiteUserbase {
478
507
  isPresent: boolean;
479
508
  }
509
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
2
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
3
  import { type ErrorAttributes } from '../client/types';
4
+ import { type ProfileType } from '../types';
4
5
  type GenericAttributes = Record<string, string | number | boolean | undefined | string[]> | ErrorAttributes;
5
6
  interface AnalyticsEvent {
6
7
  action?: string;
@@ -11,14 +12,14 @@ interface AnalyticsEvent {
11
12
  source?: string;
12
13
  }
13
14
  export declare const fireEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent | undefined, body: AnalyticsEvent) => void;
14
- export declare const cardTriggered: (type: 'user' | 'team' | 'agent', method: 'hover' | 'click') => AnalyticsEventPayload;
15
+ export declare const cardTriggered: (type: ProfileType, method: 'hover' | 'click') => AnalyticsEventPayload;
15
16
  export declare const teamRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', attributes?: {
16
17
  duration: number;
17
18
  } & GenericAttributes) => AnalyticsEventPayload;
18
19
  export declare const userRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', attributes?: {
19
20
  duration: number;
20
21
  } & GenericAttributes) => AnalyticsEventPayload;
21
- export declare const profileCardRendered: (type: 'user' | 'team' | 'agent', actionSubjectId: 'spinner' | 'content' | 'error' | 'errorBoundary', attributes?: {
22
+ export declare const profileCardRendered: (type: ProfileType, actionSubjectId: 'spinner' | 'content' | 'error' | 'errorBoundary', attributes?: {
22
23
  duration?: number;
23
24
  errorType?: 'default' | 'NotFound';
24
25
  hasRetry?: boolean;
@@ -28,7 +29,7 @@ export declare const profileCardRendered: (type: 'user' | 'team' | 'agent', acti
28
29
  descriptionLength?: number;
29
30
  titleLength?: number;
30
31
  }) => AnalyticsEventPayload;
31
- export declare const actionClicked: (type: 'user' | 'team', attributes: {
32
+ export declare const actionClicked: (type: ProfileType, attributes: {
32
33
  duration: number;
33
34
  hasHref: boolean;
34
35
  hasOnClick: boolean;
@@ -39,7 +40,7 @@ export declare const reportingLinesClicked: (attributes: {
39
40
  userType: 'manager' | 'direct-report';
40
41
  duration: number;
41
42
  }) => AnalyticsEventPayload;
42
- export declare const moreActionsClicked: (type: 'user' | 'team', attributes: {
43
+ export declare const moreActionsClicked: (type: ProfileType, attributes: {
43
44
  duration: number;
44
45
  numActions: number;
45
46
  }) => AnalyticsEventPayload;
@@ -56,7 +57,7 @@ export declare const moreMembersClicked: (attributes: {
56
57
  export declare const errorRetryClicked: (attributes: {
57
58
  duration: number;
58
59
  }) => AnalyticsEventPayload;
59
- export declare const agentRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', attributes?: {
60
+ export declare const agentRequestAnalytics: (action: 'triggered' | 'succeeded' | 'failed', actionSubjectId?: string, attributes?: {
60
61
  duration: number;
61
62
  } & GenericAttributes) => AnalyticsEventPayload;
62
63
  export {};
@@ -1,3 +1,2 @@
1
1
  export declare const USER_ARI_PREFIX = "ari:cloud:identity::user/";
2
- export declare const createHeaders: (product: string, cloudId: string) => Headers;
3
2
  export declare const getAAIDFromARI: (ari: string) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.22.1",
3
+ "version": "19.24.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -69,7 +69,7 @@
69
69
  "@atlaskit/platform-feature-flags": "^0.3.0",
70
70
  "@atlaskit/popup": "^1.23.0",
71
71
  "@atlaskit/primitives": "^12.0.0",
72
- "@atlaskit/rovo-agent-components": "1.0.0",
72
+ "@atlaskit/rovo-agent-components": "1.1.0",
73
73
  "@atlaskit/spinner": "^16.3.0",
74
74
  "@atlaskit/theme": "^13.0.0",
75
75
  "@atlaskit/tokens": "^1.59.0",
@@ -1,66 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.getAgentDetailsByAgentId = getAgentDetailsByAgentId;
8
- exports.getAgentDetailsByUserId = getAgentDetailsByUserId;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _rovoAgentUtils = require("../util/rovoAgentUtils");
12
- function getAgentDetailsByAgentId(_x, _x2, _x3) {
13
- return _getAgentDetailsByAgentId.apply(this, arguments);
14
- }
15
- function _getAgentDetailsByAgentId() {
16
- _getAgentDetailsByAgentId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(agentId, product, cloudId) {
17
- var headers;
18
- return _regenerator.default.wrap(function _callee$(_context) {
19
- while (1) switch (_context.prev = _context.next) {
20
- case 0:
21
- headers = (0, _rovoAgentUtils.createHeaders)(product, cloudId);
22
- _context.next = 3;
23
- return fetch(new Request("/gateway/api/assist/agents/v1/".concat(agentId), {
24
- method: 'GET',
25
- credentials: 'include',
26
- mode: 'cors',
27
- headers: headers
28
- })).then(function (response) {
29
- return response.json();
30
- });
31
- case 3:
32
- return _context.abrupt("return", _context.sent);
33
- case 4:
34
- case "end":
35
- return _context.stop();
36
- }
37
- }, _callee);
38
- }));
39
- return _getAgentDetailsByAgentId.apply(this, arguments);
40
- }
41
- function getAgentDetailsByUserId(_x4, _x5, _x6) {
42
- return _getAgentDetailsByUserId.apply(this, arguments);
43
- }
44
- function _getAgentDetailsByUserId() {
45
- _getAgentDetailsByUserId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(userId, product, cloudId) {
46
- var headers;
47
- return _regenerator.default.wrap(function _callee2$(_context2) {
48
- while (1) switch (_context2.prev = _context2.next) {
49
- case 0:
50
- headers = (0, _rovoAgentUtils.createHeaders)(product, cloudId);
51
- return _context2.abrupt("return", fetch(new Request("/gateway/api/assist/agents/v1/accountid/".concat(userId), {
52
- method: 'GET',
53
- credentials: 'include',
54
- mode: 'cors',
55
- headers: headers
56
- })).then(function (response) {
57
- return response.json();
58
- }));
59
- case 2:
60
- case "end":
61
- return _context2.stop();
62
- }
63
- }, _callee2);
64
- }));
65
- return _getAgentDetailsByUserId.apply(this, arguments);
66
- }