@atlaskit/profilecard 19.19.0 → 19.20.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 (58) hide show
  1. package/CHANGELOG.md +10 -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/RovoAgentCardClient.js +2 -5
  6. package/dist/cjs/client/UserProfileCardClient.js +110 -16
  7. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  8. package/dist/cjs/components/Agent/Actions.js +20 -4
  9. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +104 -0
  10. package/dist/cjs/components/Agent/AgentProfileCard.js +40 -8
  11. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +2 -1
  12. package/dist/cjs/components/Agent/hooks/useAgentActions.js +92 -0
  13. package/dist/cjs/components/Agent/hooks/useDeleteAgent.js +70 -0
  14. package/dist/cjs/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
  15. package/dist/cjs/components/User/ProfileCardTrigger.js +4 -2
  16. package/dist/cjs/util/analytics.js +16 -16
  17. package/dist/es2019/client/RovoAgentCardClient.js +2 -5
  18. package/dist/es2019/client/UserProfileCardClient.js +94 -6
  19. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  20. package/dist/es2019/components/Agent/Actions.js +16 -4
  21. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +82 -0
  22. package/dist/es2019/components/Agent/AgentProfileCard.js +24 -9
  23. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +2 -1
  24. package/dist/es2019/components/Agent/hooks/useAgentActions.js +83 -0
  25. package/dist/es2019/components/Agent/hooks/useDeleteAgent.js +33 -0
  26. package/dist/es2019/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
  27. package/dist/es2019/components/User/ProfileCardTrigger.js +4 -2
  28. package/dist/es2019/util/analytics.js +16 -16
  29. package/dist/esm/client/RovoAgentCardClient.js +2 -5
  30. package/dist/esm/client/UserProfileCardClient.js +111 -17
  31. package/dist/esm/client/getTeamFromAGG.js +1 -1
  32. package/dist/esm/components/Agent/Actions.js +20 -4
  33. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +94 -0
  34. package/dist/esm/components/Agent/AgentProfileCard.js +40 -8
  35. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +2 -1
  36. package/dist/esm/components/Agent/hooks/useAgentActions.js +85 -0
  37. package/dist/esm/components/Agent/hooks/useDeleteAgent.js +63 -0
  38. package/dist/esm/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
  39. package/dist/esm/components/User/ProfileCardTrigger.js +4 -2
  40. package/dist/esm/util/analytics.js +16 -16
  41. package/dist/types/client/UserProfileCardClient.d.ts +7 -1
  42. package/dist/types/components/Agent/AgentDeleteConfirmationModal.d.ts +10 -0
  43. package/dist/types/components/Agent/{useAgentActions.d.ts → hooks/useAgentActions.d.ts} +6 -0
  44. package/dist/types/components/Agent/hooks/useDeleteAgent.d.ts +8 -0
  45. package/dist/types/components/User/ProfileCardTrigger.d.ts +1 -1
  46. package/dist/types/types.d.ts +35 -2
  47. package/dist/types-ts4.5/client/UserProfileCardClient.d.ts +7 -1
  48. package/dist/types-ts4.5/components/Agent/AgentDeleteConfirmationModal.d.ts +10 -0
  49. package/dist/types-ts4.5/components/Agent/{useAgentActions.d.ts → hooks/useAgentActions.d.ts} +6 -0
  50. package/dist/types-ts4.5/components/Agent/hooks/useDeleteAgent.d.ts +8 -0
  51. package/dist/types-ts4.5/components/User/ProfileCardTrigger.d.ts +1 -1
  52. package/dist/types-ts4.5/types.d.ts +35 -2
  53. package/package.json +6 -1
  54. package/dist/cjs/components/Agent/useAgentActions.js +0 -39
  55. package/dist/es2019/components/Agent/useAgentActions.js +0 -34
  56. package/dist/esm/components/Agent/useAgentActions.js +0 -33
  57. /package/dist/types/components/Agent/{useSetFavouriteAgent.d.ts → hooks/useSetFavouriteAgent.d.ts} +0 -0
  58. /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,
@@ -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';
@@ -42,7 +43,8 @@ export default function ProfilecardTriggerNext(_ref) {
42
43
  prepopulatedData = _ref.prepopulatedData,
43
44
  disabledAriaAttributes = _ref.disabledAriaAttributes,
44
45
  onVisibilityChange = _ref.onVisibilityChange,
45
- offset = _ref.offset;
46
+ offset = _ref.offset,
47
+ viewingUserId = _ref.viewingUserId;
46
48
  var _useAnalyticsEvents = useAnalyticsEvents(),
47
49
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
48
50
  var _useIntl = useIntl(),
@@ -264,7 +266,7 @@ export default function ProfilecardTriggerNext(_ref) {
264
266
  var profilecardProps = _objectSpread(_objectSpread({
265
267
  userId: userId,
266
268
  fullName: prepopulatedData === null || prepopulatedData === void 0 ? void 0 : prepopulatedData.fullName,
267
- isCurrentUser: data === null || data === void 0 ? void 0 : data.isCurrentUser,
269
+ isCurrentUser: fg('migrate_cloud_user_to_agg_user_query') ? userId === viewingUserId : data === null || data === void 0 ? void 0 : data.isCurrentUser,
268
270
  clientFetchProfile: clientFetchProfile
269
271
  }, data), {}, {
270
272
  reportingLines: reportingLinesData,
@@ -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.20.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 }: ProfileCardTriggerProps): JSX.Element;
@@ -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;
@@ -409,7 +414,15 @@ export type TeamProfileCardErrorType = {
409
414
  reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
410
415
  } | null;
411
416
  export interface ProfileClientOptions {
412
- url: string;
417
+ /**
418
+ * pf-directory url
419
+ * When we clean up CloudUser migration FF, we should remove this prop
420
+ */
421
+ url?: string;
422
+ /**
423
+ * AGG url
424
+ * When we clean up CloudUser migration FF, we should mark this prop as required
425
+ */
413
426
  gatewayGraphqlUrl?: string;
414
427
  cacheSize?: number;
415
428
  cacheMaxAge?: number;
@@ -431,3 +444,23 @@ export interface ClientOverrides {
431
444
  export interface PrepopulatedData {
432
445
  fullName?: string;
433
446
  }
447
+ export type TeamsUserQueryResponse = {
448
+ id: string;
449
+ name: string;
450
+ picture: string;
451
+ accountStatus: StatusType;
452
+ __typename: 'AppUser' | string;
453
+ email?: string;
454
+ nickname?: string;
455
+ zoneinfo?: string;
456
+ extendedProfile?: {
457
+ jobTitle?: string;
458
+ organization?: string;
459
+ location?: string;
460
+ closedDate?: number;
461
+ inactiveDate?: number;
462
+ };
463
+ };
464
+ export interface UserInSiteUserbase {
465
+ isPresent: boolean;
466
+ }
@@ -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 }: ProfileCardTriggerProps): JSX.Element;
@@ -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;
@@ -415,7 +420,15 @@ export type TeamProfileCardErrorType = {
415
420
  reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
416
421
  } | null;
417
422
  export interface ProfileClientOptions {
418
- url: string;
423
+ /**
424
+ * pf-directory url
425
+ * When we clean up CloudUser migration FF, we should remove this prop
426
+ */
427
+ url?: string;
428
+ /**
429
+ * AGG url
430
+ * When we clean up CloudUser migration FF, we should mark this prop as required
431
+ */
419
432
  gatewayGraphqlUrl?: string;
420
433
  cacheSize?: number;
421
434
  cacheMaxAge?: number;
@@ -437,3 +450,23 @@ export interface ClientOverrides {
437
450
  export interface PrepopulatedData {
438
451
  fullName?: string;
439
452
  }
453
+ export type TeamsUserQueryResponse = {
454
+ id: string;
455
+ name: string;
456
+ picture: string;
457
+ accountStatus: StatusType;
458
+ __typename: 'AppUser' | string;
459
+ email?: string;
460
+ nickname?: string;
461
+ zoneinfo?: string;
462
+ extendedProfile?: {
463
+ jobTitle?: string;
464
+ organization?: string;
465
+ location?: string;
466
+ closedDate?: number;
467
+ inactiveDate?: number;
468
+ };
469
+ };
470
+ export interface UserInSiteUserbase {
471
+ isPresent: boolean;
472
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.19.0",
3
+ "version": "19.20.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -65,6 +65,7 @@
65
65
  "@atlaskit/icon": "^22.14.0",
66
66
  "@atlaskit/lozenge": "^11.10.0",
67
67
  "@atlaskit/menu": "^2.12.0",
68
+ "@atlaskit/modal-dialog": "^12.15.2",
68
69
  "@atlaskit/platform-feature-flags": "^0.3.0",
69
70
  "@atlaskit/popup": "^1.23.0",
70
71
  "@atlaskit/primitives": "^12.0.0",
@@ -88,6 +89,7 @@
88
89
  },
89
90
  "devDependencies": {
90
91
  "@af/visual-regression": "*",
92
+ "@atlassian/feature-flags-test-utils": "*",
91
93
  "@atlassian/ptc-test-utils": "^0.8.0",
92
94
  "@testing-library/react": "^12.1.5",
93
95
  "enzyme": "^3.10.0",
@@ -117,6 +119,9 @@
117
119
  "platform-feature-flags": {
118
120
  "enable_appropriate_reading_order_in_profile_card": {
119
121
  "type": "boolean"
122
+ },
123
+ "migrate_cloud_user_to_agg_user_query": {
124
+ "type": "boolean"
120
125
  }
121
126
  }
122
127
  }
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAgentUrlActions = void 0;
7
- var _react = require("react");
8
- var _atlassianContext = require("@atlaskit/atlassian-context");
9
- var _url = require("../../util/url");
10
- var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlActions(_ref) {
11
- var cloudId = _ref.cloudId;
12
- var onEditAgent = (0, _react.useCallback)(function (agentId) {
13
- var url = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat/agents/").concat(agentId, "/edit?cloudId=").concat(cloudId);
14
- window.open(url, '_blank', 'noopener, noreferrer');
15
- }, [cloudId]);
16
- var onCopyAgent = (0, _react.useCallback)(function (agentId) {
17
- var baseUrl = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat");
18
- var urlWithParams = (0, _url.encodeParamsToUrl)(baseUrl, {
19
- cloudId: cloudId,
20
- pathway: 'chat',
21
- agentId: agentId
22
- });
23
- navigator.clipboard.writeText(urlWithParams);
24
- }, [cloudId]);
25
- var onDuplicateAgent = (0, _react.useCallback)(function (agentId) {
26
- var baseUrl = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat/agents/new");
27
- var urlWithParams = (0, _url.encodeParamsToUrl)(baseUrl, {
28
- cloudId: cloudId,
29
- pathway: 'agents-create',
30
- agentId: agentId
31
- });
32
- window.open(urlWithParams, '_blank', 'noopener, noreferrer');
33
- }, [cloudId]);
34
- return {
35
- onEditAgent: onEditAgent,
36
- onCopyAgent: onCopyAgent,
37
- onDuplicateAgent: onDuplicateAgent
38
- };
39
- };
@@ -1,34 +0,0 @@
1
- import { useCallback } from 'react';
2
- import { getATLContextUrl } from '@atlaskit/atlassian-context';
3
- import { encodeParamsToUrl } from '../../util/url';
4
- export const useAgentUrlActions = ({
5
- cloudId
6
- }) => {
7
- const onEditAgent = useCallback(agentId => {
8
- const url = `${getATLContextUrl('home')}/chat/agents/${agentId}/edit?cloudId=${cloudId}`;
9
- window.open(url, '_blank', 'noopener, noreferrer');
10
- }, [cloudId]);
11
- const onCopyAgent = useCallback(agentId => {
12
- const baseUrl = `${getATLContextUrl('home')}/chat`;
13
- const urlWithParams = encodeParamsToUrl(baseUrl, {
14
- cloudId,
15
- pathway: 'chat',
16
- agentId
17
- });
18
- navigator.clipboard.writeText(urlWithParams);
19
- }, [cloudId]);
20
- const onDuplicateAgent = useCallback(agentId => {
21
- const baseUrl = `${getATLContextUrl('home')}/chat/agents/new`;
22
- const urlWithParams = encodeParamsToUrl(baseUrl, {
23
- cloudId,
24
- pathway: 'agents-create',
25
- agentId
26
- });
27
- window.open(urlWithParams, '_blank', 'noopener, noreferrer');
28
- }, [cloudId]);
29
- return {
30
- onEditAgent,
31
- onCopyAgent,
32
- onDuplicateAgent
33
- };
34
- };
@@ -1,33 +0,0 @@
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
- };