@atlaskit/profilecard 24.13.7 → 24.14.1

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 (161) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/__tests__/vr-tests/__snapshots__/user-profilecard/error-state--default.png +0 -0
  3. package/__tests__/vr-tests/agent-profilecard.vr.tsx +7 -1
  4. package/__tests__/vr-tests/user-profilecard.vr.tsx +42 -6
  5. package/afm-cc/tsconfig.json +6 -0
  6. package/afm-dev-agents/tsconfig.json +6 -0
  7. package/afm-jira/tsconfig.json +6 -0
  8. package/afm-passionfruit/tsconfig.json +6 -0
  9. package/afm-post-office/tsconfig.json +6 -0
  10. package/afm-rovo-extension/tsconfig.json +6 -0
  11. package/afm-townsquare/tsconfig.json +6 -0
  12. package/dist/cjs/client/ProfileCardClient.js +2 -2
  13. package/dist/cjs/client/UserProfileCardClient.js +45 -11
  14. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  15. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  16. package/dist/cjs/components/Agent/Actions.js +5 -2
  17. package/dist/cjs/components/Agent/ActionsCompiled.compiled.css +19 -0
  18. package/dist/cjs/components/Agent/ActionsCompiled.js +140 -0
  19. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +2 -4
  20. package/dist/cjs/components/Agent/AgentProfileCard.js +8 -1
  21. package/dist/cjs/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  22. package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +242 -0
  23. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +2 -1
  24. package/dist/cjs/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  25. package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +9 -8
  26. package/dist/cjs/components/Agent/ConversationStarters.js +2 -4
  27. package/dist/cjs/components/Error/ErrorMessage.js +20 -9
  28. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +3 -3
  29. package/dist/cjs/components/User/OverflowProfileCardButtons.js +22 -7
  30. package/dist/cjs/components/User/ProfileCard.js +80 -28
  31. package/dist/cjs/components/User/ProfileCardDetails.compiled.css +0 -1
  32. package/dist/cjs/components/User/ProfileCardDetails.js +4 -5
  33. package/dist/cjs/components/User/ProfileCardResourced.js +40 -16
  34. package/dist/cjs/components/User/ProfileCardTrigger.js +52 -12
  35. package/dist/cjs/components/User/ReportingLinesDetails.js +40 -12
  36. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  37. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.js +109 -0
  38. package/dist/cjs/components/User/UserLoadingState.js +15 -3
  39. package/dist/cjs/components/common/LoadingState.js +17 -3
  40. package/dist/cjs/components/common/ProfileCardTrigger.js +29 -7
  41. package/dist/cjs/components/common/ProfileCardWrapper.compiled.css +1 -0
  42. package/dist/cjs/components/common/ProfileCardWrapper.js +12 -9
  43. package/dist/cjs/components/team-profile-card/team-actions/more-actions/index.js +2 -4
  44. package/dist/cjs/styled/CoverImage.compiled.css +2 -0
  45. package/dist/cjs/styled/CoverImage.js +4 -2
  46. package/dist/cjs/styled/Error.compiled.css +0 -2
  47. package/dist/cjs/styled/Error.js +5 -3
  48. package/dist/cjs/util/analytics.js +7 -3
  49. package/dist/es2019/client/ProfileCardClient.js +2 -2
  50. package/dist/es2019/client/UserProfileCardClient.js +50 -13
  51. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  52. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  53. package/dist/es2019/components/Agent/Actions.js +5 -2
  54. package/dist/es2019/components/Agent/ActionsCompiled.compiled.css +19 -0
  55. package/dist/es2019/components/Agent/ActionsCompiled.js +116 -0
  56. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  57. package/dist/es2019/components/Agent/AgentProfileCard.js +8 -1
  58. package/dist/es2019/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  59. package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +186 -0
  60. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +2 -1
  61. package/dist/es2019/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  62. package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +8 -7
  63. package/dist/es2019/components/Agent/ConversationStarters.js +1 -3
  64. package/dist/es2019/components/Error/ErrorMessage.js +18 -8
  65. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +1 -2
  66. package/dist/es2019/components/User/OverflowProfileCardButtons.js +18 -7
  67. package/dist/es2019/components/User/ProfileCard.js +72 -25
  68. package/dist/es2019/components/User/ProfileCardDetails.compiled.css +0 -1
  69. package/dist/es2019/components/User/ProfileCardDetails.js +3 -5
  70. package/dist/es2019/components/User/ProfileCardResourced.js +25 -4
  71. package/dist/es2019/components/User/ProfileCardTrigger.js +54 -13
  72. package/dist/es2019/components/User/ReportingLinesDetails.js +34 -10
  73. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  74. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.js +96 -0
  75. package/dist/es2019/components/User/UserLoadingState.js +14 -4
  76. package/dist/es2019/components/common/LoadingState.js +16 -4
  77. package/dist/es2019/components/common/ProfileCardTrigger.js +26 -7
  78. package/dist/es2019/components/common/ProfileCardWrapper.compiled.css +1 -0
  79. package/dist/es2019/components/common/ProfileCardWrapper.js +11 -8
  80. package/dist/es2019/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  81. package/dist/es2019/styled/CoverImage.compiled.css +2 -0
  82. package/dist/es2019/styled/CoverImage.js +4 -2
  83. package/dist/es2019/styled/Error.compiled.css +0 -2
  84. package/dist/es2019/styled/Error.js +6 -4
  85. package/dist/es2019/util/analytics.js +6 -2
  86. package/dist/esm/client/ProfileCardClient.js +2 -2
  87. package/dist/esm/client/UserProfileCardClient.js +46 -12
  88. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  89. package/dist/esm/client/getTeamFromAGG.js +1 -1
  90. package/dist/esm/components/Agent/Actions.js +5 -2
  91. package/dist/esm/components/Agent/ActionsCompiled.compiled.css +19 -0
  92. package/dist/esm/components/Agent/ActionsCompiled.js +131 -0
  93. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  94. package/dist/esm/components/Agent/AgentProfileCard.js +8 -1
  95. package/dist/esm/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  96. package/dist/esm/components/Agent/AgentProfileCardCompiled.js +233 -0
  97. package/dist/esm/components/Agent/AgentProfileCardResourced.js +2 -1
  98. package/dist/esm/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  99. package/dist/esm/components/Agent/AgentProfileCardWrapper.js +8 -7
  100. package/dist/esm/components/Agent/ConversationStarters.js +1 -3
  101. package/dist/esm/components/Error/ErrorMessage.js +20 -8
  102. package/dist/esm/components/Team/TeamProfileCardTrigger.js +1 -2
  103. package/dist/esm/components/User/OverflowProfileCardButtons.js +23 -8
  104. package/dist/esm/components/User/ProfileCard.js +80 -28
  105. package/dist/esm/components/User/ProfileCardDetails.compiled.css +0 -1
  106. package/dist/esm/components/User/ProfileCardDetails.js +3 -5
  107. package/dist/esm/components/User/ProfileCardResourced.js +40 -16
  108. package/dist/esm/components/User/ProfileCardTrigger.js +53 -13
  109. package/dist/esm/components/User/ReportingLinesDetails.js +41 -12
  110. package/dist/esm/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  111. package/dist/esm/components/User/ReportingLinesDetailsCompiled.js +102 -0
  112. package/dist/esm/components/User/UserLoadingState.js +16 -4
  113. package/dist/esm/components/common/LoadingState.js +18 -4
  114. package/dist/esm/components/common/ProfileCardTrigger.js +30 -8
  115. package/dist/esm/components/common/ProfileCardWrapper.compiled.css +1 -0
  116. package/dist/esm/components/common/ProfileCardWrapper.js +11 -8
  117. package/dist/esm/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  118. package/dist/esm/styled/CoverImage.compiled.css +2 -0
  119. package/dist/esm/styled/CoverImage.js +4 -2
  120. package/dist/esm/styled/Error.compiled.css +0 -2
  121. package/dist/esm/styled/Error.js +6 -4
  122. package/dist/esm/util/analytics.js +6 -2
  123. package/dist/types/client/ProfileCardClient.d.ts +2 -1
  124. package/dist/types/client/UserProfileCardClient.d.ts +2 -1
  125. package/dist/types/components/Agent/Actions.d.ts +10 -1
  126. package/dist/types/components/Agent/ActionsCompiled.d.ts +14 -0
  127. package/dist/types/components/Agent/AgentProfileCard.d.ts +13 -3
  128. package/dist/types/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  129. package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  130. package/dist/types/components/Error/ErrorMessage.d.ts +2 -0
  131. package/dist/types/components/User/ProfileCard.d.ts +3 -2
  132. package/dist/types/components/User/ProfileCardResourced.d.ts +4 -2
  133. package/dist/types/components/User/ReportingLinesDetails.d.ts +2 -2
  134. package/dist/types/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  135. package/dist/types/components/User/UserLoadingState.d.ts +3 -1
  136. package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
  137. package/dist/types/components/common/LoadingState.d.ts +3 -1
  138. package/dist/types/components/common/ProfileCardWrapper.d.ts +2 -1
  139. package/dist/types/components/common/types.d.ts +3 -0
  140. package/dist/types/types.d.ts +13 -6
  141. package/dist/types/util/analytics.d.ts +5 -0
  142. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +2 -1
  143. package/dist/types-ts4.5/client/UserProfileCardClient.d.ts +2 -1
  144. package/dist/types-ts4.5/components/Agent/Actions.d.ts +10 -1
  145. package/dist/types-ts4.5/components/Agent/ActionsCompiled.d.ts +14 -0
  146. package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +13 -3
  147. package/dist/types-ts4.5/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  148. package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  149. package/dist/types-ts4.5/components/Error/ErrorMessage.d.ts +2 -0
  150. package/dist/types-ts4.5/components/User/ProfileCard.d.ts +3 -2
  151. package/dist/types-ts4.5/components/User/ProfileCardResourced.d.ts +4 -2
  152. package/dist/types-ts4.5/components/User/ReportingLinesDetails.d.ts +2 -2
  153. package/dist/types-ts4.5/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  154. package/dist/types-ts4.5/components/User/UserLoadingState.d.ts +3 -1
  155. package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
  156. package/dist/types-ts4.5/components/common/LoadingState.d.ts +3 -1
  157. package/dist/types-ts4.5/components/common/ProfileCardWrapper.d.ts +2 -1
  158. package/dist/types-ts4.5/components/common/types.d.ts +3 -0
  159. package/dist/types-ts4.5/types.d.ts +13 -6
  160. package/dist/types-ts4.5/util/analytics.d.ts +5 -0
  161. package/package.json +20 -9
@@ -1,15 +1,27 @@
1
1
  import React, { useEffect } from 'react';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import AkSpinner from '@atlaskit/spinner';
3
4
  import { SpinnerContainer } from '../../styled/UserTrigger';
4
- import { profileCardRendered } from '../../util/analytics';
5
+ import { getActionSubject, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
6
+ import { getPageTime } from '../../util/performance';
5
7
  export const LoadingState = ({
6
8
  fireAnalytics,
9
+ fireAnalyticsNext,
7
10
  profileType
8
11
  }) => {
9
12
  useEffect(() => {
10
- if (fireAnalytics) {
11
- fireAnalytics(profileCardRendered(profileType, 'spinner'));
13
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
14
+ if (fireAnalyticsNext) {
15
+ fireAnalyticsNext(`ui.${getActionSubject(profileType)}.rendered.spinner`, {
16
+ firedAt: Math.round(getPageTime()),
17
+ ...PACKAGE_META_DATA
18
+ });
19
+ }
20
+ } else {
21
+ if (fireAnalytics) {
22
+ fireAnalytics(profileCardRendered(profileType, 'spinner'));
23
+ }
12
24
  }
13
- }, [fireAnalytics, profileType]);
25
+ }, [fireAnalytics, fireAnalyticsNext, profileType]);
14
26
  return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
15
27
  };
@@ -1,8 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import Popup from '@atlaskit/popup';
4
5
  import { layers } from '@atlaskit/theme/constants';
5
- import { cardTriggered } from '../../util/analytics';
6
+ import { cardTriggered, getActionSubject, PACKAGE_META_DATA } from '../../util/analytics';
7
+ import { getPageTime } from '../../util/performance';
6
8
  import { useProfileInfo } from '../../util/useProfileInfo';
7
9
  import { LoadingState } from './LoadingState';
8
10
  import { PopupTrigger } from './PopupTrigger';
@@ -17,7 +19,9 @@ function ProfileCardTriggerInner({
17
19
  fetchProfile,
18
20
  disabledAriaAttributes,
19
21
  profileCardType,
22
+ testId,
20
23
  fireAnalytics,
24
+ fireAnalyticsNext,
21
25
  ...popupProps
22
26
  }, ref) {
23
27
  var _popupProps$autoFocus;
@@ -57,12 +61,22 @@ function ProfileCardTriggerInner({
57
61
  if (!visible) {
58
62
  getProfileData === null || getProfileData === void 0 ? void 0 : getProfileData();
59
63
  setVisible(true);
60
- if (fireAnalytics) {
61
- fireAnalytics(cardTriggered(profileCardType, trigger));
64
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
65
+ if (fireAnalyticsNext) {
66
+ fireAnalyticsNext(`ui.${getActionSubject(profileCardType)}.triggered`, {
67
+ method: trigger,
68
+ ...PACKAGE_META_DATA,
69
+ firedAt: Math.round(getPageTime())
70
+ });
71
+ }
72
+ } else {
73
+ if (fireAnalytics) {
74
+ fireAnalytics(cardTriggered(profileCardType, trigger));
75
+ }
62
76
  }
63
77
  }
64
78
  }, showDelay);
65
- }, [showDelay, visible, getProfileData, fireAnalytics, profileCardType, trigger]);
79
+ }, [showDelay, visible, getProfileData, fireAnalytics, profileCardType, trigger, fireAnalyticsNext]);
66
80
  const onMouseEnter = useCallback(() => {
67
81
  showProfilecard();
68
82
  }, [showProfilecard]);
@@ -85,7 +99,8 @@ function ProfileCardTriggerInner({
85
99
  showProfilecard: showProfilecard,
86
100
  children: children,
87
101
  ariaLabelledBy: ariaLabelledBy,
88
- trigger: trigger
102
+ trigger: trigger,
103
+ "data-testid": testId
89
104
  }));
90
105
  },
91
106
  content: () =>
@@ -94,9 +109,13 @@ function ProfileCardTriggerInner({
94
109
  React.createElement("div", {
95
110
  onMouseEnter: onMouseEnter,
96
111
  onMouseLeave: hideProfilecard,
97
- onFocus: showProfilecard
98
- }, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
112
+ onFocus: showProfilecard,
113
+ "data-testid": "profile-card--trigger-content"
114
+ }, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, {
115
+ testId: "profilecard.profilecardtrigger.loading"
116
+ }, /*#__PURE__*/React.createElement(LoadingState, {
99
117
  fireAnalytics: fireAnalytics,
118
+ fireAnalyticsNext: fireAnalyticsNext,
100
119
  profileType: profileCardType
101
120
  })) : renderProfileCard({
102
121
  profileData,
@@ -0,0 +1 @@
1
+ ._1bsb1gwv{width:360px}
@@ -1,14 +1,17 @@
1
+ /* ProfileCardWrapper.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import "./ProfileCardWrapper.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
1
4
  import React from 'react';
2
-
3
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
4
- import { Box, xcss } from '@atlaskit/primitives';
5
- const styles = xcss({
6
- width: '360px'
7
- });
5
+ import { Box } from '@atlaskit/primitives/compiled';
6
+ const styles = {
7
+ wrapper: "_1bsb1gwv"
8
+ };
8
9
  export const ProfileCardWrapper = ({
9
- children
10
+ children,
11
+ testId
10
12
  }) => {
11
13
  return /*#__PURE__*/React.createElement(Box, {
12
- xcss: styles
14
+ xcss: styles.wrapper,
15
+ testId: testId
13
16
  }, children);
14
17
  };
@@ -5,8 +5,7 @@ import { IconButton } from '@atlaskit/button/new';
5
5
  import MoreIcon from '@atlaskit/icon/core/migration/show-more-horizontal--more';
6
6
  import { MenuGroup, Section } from '@atlaskit/menu';
7
7
  import Popup from '@atlaskit/popup';
8
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
9
- import { Box } from '@atlaskit/primitives';
8
+ import { Box } from '@atlaskit/primitives/compiled';
10
9
  import { messages } from './messages';
11
10
  export const MoreActions = ({
12
11
  actions,
@@ -6,7 +6,9 @@
6
6
  ._1e0c1txw{display:flex}
7
7
  ._1reo15vq{overflow-x:hidden}
8
8
  ._4cvr1h6o{align-items:center}
9
+ ._4t3i1osq{height:100%}
9
10
  ._4t3i1qr7{height:8pc}
10
11
  ._4t3i1wug{height:auto}
12
+ ._5ral1dfr{object-fit:cover}
11
13
  ._kqswh2mm{position:relative}
12
14
  ._qrwq12b0{border-top-right-radius:var(--ds-radius-small,4px)}
@@ -2,10 +2,12 @@
2
2
  import "./CoverImage.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useRef } from 'react';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { Box } from '@atlaskit/primitives/compiled';
6
7
  const styles = {
7
8
  container: "_1reo15vq _18m915vq _1bsb1osq _4t3i1qr7 _kqswh2mm _13li12b0 _qrwq12b0 _1e0c1txw _1bah1h6o _4cvr1h6o",
8
- image: "_1bsbnklw _4t3i1wug"
9
+ image: "_1bsbnklw _4t3i1wug",
10
+ imageNext: "_4t3i1osq _5ral1dfr"
9
11
  };
10
12
 
11
13
  /**
@@ -26,6 +28,6 @@ export const CoverImage = ({
26
28
  ref: imgRef,
27
29
  src: src,
28
30
  alt: alt,
29
- xcss: styles.image
31
+ xcss: fg('cover-header-image-team-profilecard') ? styles.imageNext : styles.image
30
32
  }));
31
33
  };
@@ -1,9 +1,7 @@
1
- ._11c82smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
1
  ._19bv1ejb{padding-left:var(--ds-space-300,24px)}
3
2
  ._19pku2gc{margin-top:var(--ds-space-100,8px)}
4
3
  ._ca0q1ejb{padding-top:var(--ds-space-300,24px)}
5
4
  ._n3td1ejb{padding-bottom:var(--ds-space-300,24px)}
6
- ._syaz1fxt{color:var(--ds-text,#172b4d)}
7
5
  ._syaz1wmz{color:var(--ds-text-subtlest,#6b778c)}
8
6
  ._u5f31ejb{padding-right:var(--ds-space-300,24px)}
9
7
  ._y3gn1h6o{text-align:center}
@@ -4,19 +4,21 @@ import "./Error.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import React from 'react';
6
6
  import { cx } from '@atlaskit/css';
7
- import { Box } from '@atlaskit/primitives/compiled';
7
+ import { Box, Text } from '@atlaskit/primitives/compiled';
8
8
  import { N200 } from '@atlaskit/theme/colors';
9
9
  const styles = {
10
10
  errorWrapper: "_y3gn1h6o _ca0q1ejb _u5f31ejb _n3td1ejb _19bv1ejb",
11
- errorTitle: "_11c82smr _syaz1fxt _19pku2gc",
11
+ errorTitle: "_19pku2gc",
12
12
  teamErrorText: "_syaz1wmz _19pku2gc"
13
13
  };
14
14
  export const ErrorWrapper = props => /*#__PURE__*/React.createElement(Box, _extends({
15
15
  xcss: cx(styles.errorWrapper)
16
16
  }, props));
17
17
  export const ErrorTitle = props => /*#__PURE__*/React.createElement(Box, {
18
- xcss: cx(styles.errorTitle)
19
- }, props.children);
18
+ xcss: styles.errorTitle
19
+ }, /*#__PURE__*/React.createElement(Text, {
20
+ color: "color.text"
21
+ }, props.children));
20
22
  export const TeamErrorText = props => /*#__PURE__*/React.createElement(Box, {
21
23
  xcss: cx(styles.teamErrorText)
22
24
  }, props.children);
@@ -2,6 +2,10 @@ import { getPageTime } from './performance';
2
2
 
3
3
  /** Below lines are copied from teams common analytics */
4
4
  const ANALYTICS_CHANNEL = 'peopleTeams';
5
+ export const PACKAGE_META_DATA = {
6
+ packageName: "@atlaskit/profilecard",
7
+ packageVersion: "0.0.0-development"
8
+ };
5
9
  const runItLater = cb => {
6
10
  const requestIdleCallback = window.requestIdleCallback;
7
11
  if (typeof requestIdleCallback === 'function') {
@@ -41,12 +45,12 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
41
45
  actionSubjectId,
42
46
  attributes: {
43
47
  packageName: "@atlaskit/profilecard",
44
- packageVersion: "24.13.6",
48
+ packageVersion: "0.0.0-development",
45
49
  ...attributes,
46
50
  firedAt: Math.round(getPageTime())
47
51
  }
48
52
  });
49
- const getActionSubject = type => {
53
+ export const getActionSubject = type => {
50
54
  switch (type) {
51
55
  case 'user':
52
56
  return USER_SUBJECT;
@@ -37,8 +37,8 @@ var ProfileCardClient = /*#__PURE__*/function () {
37
37
  }
38
38
  }, {
39
39
  key: "getProfile",
40
- value: function getProfile(cloudId, userId, analytics) {
41
- return this.userClient.getProfile(cloudId, userId, analytics);
40
+ value: function getProfile(cloudId, userId, analytics, analyticsNext) {
41
+ return this.userClient.getProfile(cloudId, userId, analytics, analyticsNext);
42
42
  }
43
43
  }, {
44
44
  key: "getTeamProfile",
@@ -15,7 +15,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
15
15
  import { print } from 'graphql';
16
16
  import gql from 'graphql-tag';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
- import { userRequestAnalytics } from '../util/analytics';
18
+ import { PACKAGE_META_DATA, userRequestAnalytics } from '../util/analytics';
19
19
  import { localTime } from '../util/date';
20
20
  import { getPageTime } from '../util/performance';
21
21
  import CachingClient from './CachingClient';
@@ -147,7 +147,7 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
147
147
  }()
148
148
  }, {
149
149
  key: "getProfile",
150
- value: function getProfile(cloudId, userId, analytics) {
150
+ value: function getProfile(cloudId, userId, analytics, analyticsNext) {
151
151
  var _this2 = this;
152
152
  if (!userId) {
153
153
  return Promise.reject(new Error('userId missing'));
@@ -159,24 +159,58 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
159
159
  }
160
160
  return new Promise(function (resolve, reject) {
161
161
  var startTime = getPageTime();
162
- if (analytics) {
163
- analytics(userRequestAnalytics('triggered'));
162
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
163
+ if (analyticsNext) {
164
+ analyticsNext('operational.profilecard.triggered.request', _objectSpread({
165
+ firedAt: Math.round(getPageTime())
166
+ }, PACKAGE_META_DATA));
167
+ }
168
+ } else {
169
+ if (analytics) {
170
+ analytics(userRequestAnalytics('triggered'));
171
+ }
164
172
  }
165
173
  _this2.makeRequest(cloudId, userId).then(function (data) {
166
174
  if (_this2.cache) {
167
175
  _this2.setCachedProfile(cacheIdentifier, data);
168
176
  }
169
- if (analytics) {
170
- analytics(userRequestAnalytics('succeeded', {
171
- duration: getPageTime() - startTime
172
- }));
177
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
178
+ if (analyticsNext) {
179
+ analyticsNext('operational.profilecard.succeeded.request', _objectSpread({
180
+ duration: getPageTime() - startTime,
181
+ firedAt: Math.round(getPageTime())
182
+ }, PACKAGE_META_DATA));
183
+ }
184
+ } else {
185
+ if (analytics) {
186
+ analytics(userRequestAnalytics('succeeded', {
187
+ duration: getPageTime() - startTime
188
+ }));
189
+ }
173
190
  }
174
191
  resolve(data);
175
192
  }).catch(function (error) {
176
- if (analytics) {
177
- analytics(userRequestAnalytics('failed', _objectSpread({
178
- duration: getPageTime() - startTime
179
- }, getErrorAttributes(error))));
193
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
194
+ if (analyticsNext) {
195
+ var errorAttributes = getErrorAttributes(error);
196
+ analyticsNext('operational.profilecard.failed.request', _objectSpread(_objectSpread({
197
+ duration: getPageTime() - startTime
198
+ }, errorAttributes), {}, {
199
+ traceId: errorAttributes.traceId || null,
200
+ errorCategory: errorAttributes.errorCategory || null,
201
+ errorType: errorAttributes.errorType || null,
202
+ errorPath: errorAttributes.errorPath || null,
203
+ errorNumber: errorAttributes.errorNumber || null,
204
+ errorStatusCode: errorAttributes.errorStatusCode || null,
205
+ firedAt: Math.round(getPageTime())
206
+ }, PACKAGE_META_DATA));
207
+ }
208
+ } else {
209
+ if (analytics) {
210
+ analytics(userRequestAnalytics('failed', _objectSpread({
211
+ duration: getPageTime() - startTime
212
+ }, getErrorAttributes(error))));
213
+ }
180
214
  }
181
215
  reject(error);
182
216
  });
@@ -4,7 +4,7 @@ import { AGGQuery } from './graphqlUtils';
4
4
  var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
5
5
  var addHeaders = function addHeaders(headers) {
6
6
  headers.append('atl-client-name', "@atlaskit/profilecard");
7
- headers.append('atl-client-version', "24.13.6");
7
+ headers.append('atl-client-version', "0.0.0-development");
8
8
  return headers;
9
9
  };
10
10
  export function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -59,7 +59,7 @@ export var addHeaders = function addHeaders(headers) {
59
59
  headers.append('X-ExperimentalApi', 'teams-beta');
60
60
  headers.append('X-ExperimentalApi', 'team-members-beta');
61
61
  headers.append('atl-client-name', "@atlaskit/profilecard");
62
- headers.append('atl-client-version', "24.13.6");
62
+ headers.append('atl-client-version', "0.0.0-development");
63
63
  return headers;
64
64
  };
65
65
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -9,10 +9,12 @@ import { defineMessages, useIntl } from 'react-intl-next';
9
9
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
10
  import Button from '@atlaskit/button/new';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
12
13
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
13
14
  import { Box, Inline, xcss } from '@atlaskit/primitives';
14
15
  import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
15
16
  import { fireEvent } from '../../util/analytics';
17
+ import { AgentActions as AgentActionsCompiled } from './ActionsCompiled';
16
18
  import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
17
19
  var chatToAgentButtonContainer = xcss({
18
20
  width: '100%'
@@ -43,7 +45,7 @@ var actionsWrapperStyles = xcss({
43
45
  marginBlockStart: 'space.200',
44
46
  color: 'color.text'
45
47
  });
46
- export var AgentActions = function AgentActions(_ref) {
48
+ var _AgentActions = function _AgentActions(_ref) {
47
49
  var onEditAgent = _ref.onEditAgent,
48
50
  onDeleteAgent = _ref.onDeleteAgent,
49
51
  onDuplicateAgent = _ref.onDuplicateAgent,
@@ -146,4 +148,5 @@ var messages = defineMessages({
146
148
  defaultMessage: 'Chat to Agent',
147
149
  description: 'Text for the "chat to agent" action to chat to the agent'
148
150
  }
149
- });
151
+ });
152
+ export var AgentActions = componentWithFG('profilecard_primitives_compiled', AgentActionsCompiled, _AgentActions);
@@ -0,0 +1,19 @@
1
+
2
+ ._189ee4h9{border-width:var(--ds-border-width,1px)}
3
+ ._18zrv77o{padding-inline:var(--ds-space-025,2px)}
4
+ ._1h6dmuej{border-color:var(--ds-border,#091e4224)}._15a5nqa1{border-top-style:solid}
5
+ ._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
6
+ ._1bah1h6o{justify-content:center}
7
+ ._1bsb1osq{width:100%}
8
+ ._1e0c1txw{display:flex}
9
+ ._1nmz1hna{word-break:break-word}
10
+ ._1pfhpxbi{margin-block-start:var(--ds-space-200,1pc)}
11
+ ._1ul9gktf{min-width:20px}
12
+ ._4t3igktf{height:20px}
13
+ ._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
14
+ ._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
15
+ ._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
16
+ ._o5721jtm{white-space:pre-wrap}
17
+ ._syaz1fxt{color:var(--ds-text,#172b4d)}
18
+ ._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
19
+ ._y3gn1e5h{text-align:left}
@@ -0,0 +1,131 @@
1
+ /* ActionsCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
+ import "./ActionsCompiled.compiled.css";
6
+ import { ax, ix } from "@compiled/react/runtime";
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
+ 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; }
9
+ 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; }
10
+ import React, { useCallback, useState } from 'react';
11
+ import { defineMessages, useIntl } from 'react-intl-next';
12
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
13
+ import Button from '@atlaskit/button/new';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
15
+ import { Box, Inline } from '@atlaskit/primitives/compiled';
16
+ import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
17
+ import { fireEvent } from '../../util/analytics';
18
+ import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
19
+ var styles = {
20
+ chatToAgentButtonContainer: "_1bsb1osq",
21
+ chatToAgentButtonWrapper: "_1e0c1txw _1bah1h6o _k48p1wq8 _4t3igktf",
22
+ chatPillButtonInlineStyles: "_18zrv77o",
23
+ chatPillTextStyles: "_1nmz1hna _y3gn1e5h _o5721jtm",
24
+ chatPillIconWrapper: "_1ul9gktf _4t3igktf",
25
+ actionsWrapperStyles: "_189ee4h9 _1h6dmuej _15a5nqa1 _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi _1pfhpxbi _syaz1fxt"
26
+ };
27
+ export var AgentActions = function AgentActions(_ref) {
28
+ var onEditAgent = _ref.onEditAgent,
29
+ onDeleteAgent = _ref.onDeleteAgent,
30
+ onDuplicateAgent = _ref.onDuplicateAgent,
31
+ onCopyAgent = _ref.onCopyAgent,
32
+ onChatClick = _ref.onChatClick,
33
+ onViewFullProfileClick = _ref.onViewFullProfileClick,
34
+ agent = _ref.agent,
35
+ resourceClient = _ref.resourceClient;
36
+ var _useIntl = useIntl(),
37
+ formatMessage = _useIntl.formatMessage;
38
+ var _useAnalyticsEvents = useAnalyticsEvents(),
39
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
40
+ var _useState = useState(false),
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ isDeleteModalOpen = _useState2[0],
43
+ setIsDeleteModalOpen = _useState2[1];
44
+ var isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
45
+ var loadAgentPermissions = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
46
+ var _yield$resourceClient, _yield$resourceClient2, AGENT_CREATE, AGENT_UPDATE, AGENT_DEACTIVATE;
47
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
48
+ while (1) switch (_context.prev = _context.next) {
49
+ case 0:
50
+ _context.next = 2;
51
+ return resourceClient.getRovoAgentPermissions(agent.id);
52
+ case 2:
53
+ _yield$resourceClient = _context.sent;
54
+ _yield$resourceClient2 = _yield$resourceClient.permissions;
55
+ AGENT_CREATE = _yield$resourceClient2.AGENT_CREATE;
56
+ AGENT_UPDATE = _yield$resourceClient2.AGENT_UPDATE;
57
+ AGENT_DEACTIVATE = _yield$resourceClient2.AGENT_DEACTIVATE;
58
+ return _context.abrupt("return", _objectSpread(_objectSpread({}, fg('agent_studio_fe_permissions_settings_m1') && {
59
+ isCreateEnabled: AGENT_CREATE.permitted
60
+ }), {}, {
61
+ isEditEnabled: AGENT_UPDATE.permitted,
62
+ isDeleteEnabled: AGENT_DEACTIVATE.permitted
63
+ }));
64
+ case 8:
65
+ case "end":
66
+ return _context.stop();
67
+ }
68
+ }, _callee);
69
+ })), [agent.id, resourceClient]);
70
+ var handleDeleteAgent = useCallback(function () {
71
+ fireEvent(createAnalyticsEvent, {
72
+ action: 'clicked',
73
+ actionSubject: 'button',
74
+ actionSubjectId: 'deleteAgentButton',
75
+ attributes: {
76
+ agentId: agent.id,
77
+ source: 'agentProfileCard'
78
+ }
79
+ });
80
+ setIsDeleteModalOpen(true);
81
+ }, [agent.id, createAnalyticsEvent]);
82
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
83
+ space: "space.100",
84
+ xcss: styles.actionsWrapperStyles
85
+ }, /*#__PURE__*/React.createElement(Box, {
86
+ xcss: styles.chatToAgentButtonContainer
87
+ }, /*#__PURE__*/React.createElement(Button, {
88
+ shouldFitContainer: true,
89
+ onClick: function onClick(e) {
90
+ e.stopPropagation();
91
+ onChatClick(e);
92
+ }
93
+ }, /*#__PURE__*/React.createElement(Box, {
94
+ xcss: styles.chatToAgentButtonWrapper
95
+ }, /*#__PURE__*/React.createElement(Inline, {
96
+ space: "space.050",
97
+ xcss: styles.chatPillButtonInlineStyles,
98
+ alignBlock: "center"
99
+ }, /*#__PURE__*/React.createElement(Box, {
100
+ xcss: styles.chatPillIconWrapper
101
+ }, /*#__PURE__*/React.createElement(ChatPillIcon, null)), /*#__PURE__*/React.createElement(Box, {
102
+ xcss: styles.chatPillTextStyles
103
+ }, formatMessage(messages.actionChatToAgent)))))), /*#__PURE__*/React.createElement(AgentDropdownMenu, {
104
+ agentId: agent.id,
105
+ onDeleteAgent: handleDeleteAgent,
106
+ onEditAgent: onEditAgent,
107
+ onDuplicateAgent: onDuplicateAgent,
108
+ onCopyAgent: onCopyAgent,
109
+ isForgeAgent: isForgeAgent,
110
+ loadAgentPermissions: loadAgentPermissions,
111
+ loadPermissionsOnMount: true,
112
+ onViewAgentFullProfileClick: onViewFullProfileClick,
113
+ doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
114
+ shouldTriggerStopPropagation: true
115
+ })), /*#__PURE__*/React.createElement(AgentDeleteConfirmationModal, {
116
+ isOpen: isDeleteModalOpen,
117
+ onClose: function onClose() {
118
+ setIsDeleteModalOpen(false);
119
+ },
120
+ onSubmit: onDeleteAgent,
121
+ agentId: agent.id,
122
+ agentName: agent.name
123
+ }));
124
+ };
125
+ var messages = defineMessages({
126
+ actionChatToAgent: {
127
+ id: 'ptc-directory.agent-profile.action.dropdown.chat-to-agent.nonfinal',
128
+ defaultMessage: 'Chat to Agent',
129
+ description: 'Text for the "chat to agent" action to chat to the agent'
130
+ }
131
+ });
@@ -4,8 +4,7 @@ import React, { useCallback } from 'react';
4
4
  import { defineMessages, useIntl } from 'react-intl-next';
5
5
  import Button from '@atlaskit/button/new';
6
6
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
7
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
8
- import { Text } from '@atlaskit/primitives';
7
+ import { Text } from '@atlaskit/primitives/compiled';
9
8
  export var AgentDeleteConfirmationModal = function AgentDeleteConfirmationModal(_ref) {
10
9
  var onClose = _ref.onClose,
11
10
  agentName = _ref.agentName,
@@ -4,6 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import React, { useCallback, useEffect, useState } from 'react';
5
5
  import { useIntl } from 'react-intl-next';
6
6
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
7
8
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
8
9
  import { Box, Stack, xcss } from '@atlaskit/primitives';
9
10
  import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
@@ -11,6 +12,7 @@ import { fireEvent, profileCardRendered } from '../../util/analytics';
11
12
  import { LoadingState } from '../common/LoadingState';
12
13
  import { ErrorMessage } from '../Error';
13
14
  import { AgentActions } from './Actions';
15
+ import { default as AgentProfileCardCompiled } from './AgentProfileCardCompiled';
14
16
  import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
15
17
  import { ConversationStarters } from './ConversationStarters';
16
18
  import { useAgentUrlActions } from './hooks/useAgentActions';
@@ -164,6 +166,10 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
164
166
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
165
167
  errorType: errorType,
166
168
  fireAnalytics: fireAnalytics
169
+ // TODO: Add fireAnalyticsNext
170
+ // NOTE: Add it to AgentProfileCardCompiled
171
+ ,
172
+ fireAnalyticsNext: function fireAnalyticsNext() {}
167
173
  }));
168
174
  }
169
175
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
@@ -236,4 +242,5 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
236
242
  }
237
243
  })));
238
244
  };
239
- export default AgentProfileCard;
245
+ var AgentProfileCardExport = componentWithFG('profilecard_primitives_compiled', AgentProfileCardCompiled, AgentProfileCard);
246
+ export default AgentProfileCardExport;
@@ -0,0 +1,8 @@
1
+
2
+ ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
3
+ ._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}._154i1ejb{top:var(--ds-space-300,24px)}
4
+ ._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
5
+ ._1ltvpxbi{left:var(--ds-space-200,1pc)}
6
+ ._1q51xy5q{padding-block-start:var(--ds-space-400,2pc)}
7
+ ._kqswh2mm{position:relative}
8
+ ._kqswstnw{position:absolute}