@atlaskit/profilecard 16.9.1 → 16.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 16.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`01d80d395bc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/01d80d395bc) - pass event to onOpenChange consistently
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 16.10.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
19
+ ## 16.10.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [`e5fbc101e73`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e5fbc101e73) - Remove analytics prop from give kudos component
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 16.9.1
4
30
 
5
31
  ### Patch Changes
@@ -173,6 +173,9 @@ var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureComponent
173
173
  _this.hideProfilecard(_config.DELAY_MS_HIDE);
174
174
  }
175
175
  });
176
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClose", function () {
177
+ _this.hideProfilecard();
178
+ });
176
179
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openKudosDrawer", function () {
177
180
  _this.hideProfilecard(_config.DELAY_MS_HIDE);
178
181
 
@@ -297,7 +300,6 @@ var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureComponent
297
300
  type: _giveKudos.KudosType.TEAM,
298
301
  recipientId: _this.props.teamId
299
302
  },
300
- analytics: _this.fireAnalytics,
301
303
  analyticsSource: "team-profile-card",
302
304
  teamCentralBaseUrl: _this.state.teamCentralBaseUrl,
303
305
  cloudId: _this.props.cloudId || '',
@@ -420,7 +422,7 @@ var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureComponent
420
422
  onError: this.onErrorBoundary
421
423
  }, /*#__PURE__*/_react.default.createElement(_popup.default, {
422
424
  isOpen: !!this.state.visible,
423
- onClose: this.hideProfilecard,
425
+ onClose: this.onClose,
424
426
  placement: this.props.position,
425
427
  content: this.renderProfileCard,
426
428
  trigger: function trigger(triggerProps) {
@@ -242,7 +242,6 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
242
242
  type: _giveKudos.KudosType.INDIVIDUAL,
243
243
  recipientId: this.props.userId
244
244
  },
245
- analytics: this.props.analytics,
246
245
  analyticsSource: "profile-card",
247
246
  teamCentralBaseUrl: newProps.teamCentralBaseUrl,
248
247
  cloudId: this.props.cloudId,
@@ -308,7 +308,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
308
308
  type: _giveKudos.KudosType.INDIVIDUAL,
309
309
  recipientId: this.props.userId
310
310
  },
311
- analytics: this.props.analytics,
312
311
  analyticsSource: "profile-card",
313
312
  teamCentralBaseUrl: this.state.teamCentralBaseUrl,
314
313
  cloudId: this.props.cloudId,
@@ -56,7 +56,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
56
56
  actionSubjectId: actionSubjectId,
57
57
  attributes: _objectSpread(_objectSpread({
58
58
  packageName: "@atlaskit/profilecard",
59
- packageVersion: "16.9.1"
59
+ packageVersion: "16.11.0"
60
60
  }, attributes), {}, {
61
61
  firedAt: (0, _performance.getPageTime)()
62
62
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.9.1"
3
+ "version": "16.11.0"
4
4
  }
@@ -117,6 +117,10 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
117
117
  }
118
118
  });
119
119
 
120
+ _defineProperty(this, "onClose", () => {
121
+ this.hideProfilecard();
122
+ });
123
+
120
124
  _defineProperty(this, "openKudosDrawer", () => {
121
125
  this.hideProfilecard(DELAY_MS_HIDE);
122
126
  this.setState({
@@ -246,7 +250,6 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
246
250
  type: KudosType.TEAM,
247
251
  recipientId: this.props.teamId
248
252
  },
249
- analytics: this.fireAnalytics,
250
253
  analyticsSource: "team-profile-card",
251
254
  teamCentralBaseUrl: this.state.teamCentralBaseUrl,
252
255
  cloudId: this.props.cloudId || '',
@@ -361,7 +364,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
361
364
  onError: this.onErrorBoundary
362
365
  }, /*#__PURE__*/React.createElement(Popup, {
363
366
  isOpen: !!this.state.visible,
364
- onClose: this.hideProfilecard,
367
+ onClose: this.onClose,
365
368
  placement: this.props.position,
366
369
  content: this.renderProfileCard,
367
370
  trigger: triggerProps => this.renderTrigger(triggerProps),
@@ -180,7 +180,6 @@ export default class ProfileCardResourced extends React.PureComponent {
180
180
  type: KudosType.INDIVIDUAL,
181
181
  recipientId: this.props.userId
182
182
  },
183
- analytics: this.props.analytics,
184
183
  analyticsSource: "profile-card",
185
184
  teamCentralBaseUrl: newProps.teamCentralBaseUrl,
186
185
  cloudId: this.props.cloudId,
@@ -245,7 +245,6 @@ class ProfilecardTrigger extends React.PureComponent {
245
245
  type: KudosType.INDIVIDUAL,
246
246
  recipientId: this.props.userId
247
247
  },
248
- analytics: this.props.analytics,
249
248
  analyticsSource: "profile-card",
250
249
  teamCentralBaseUrl: this.state.teamCentralBaseUrl,
251
250
  cloudId: this.props.cloudId,
@@ -35,7 +35,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
35
35
  actionSubjectId,
36
36
  attributes: {
37
37
  packageName: "@atlaskit/profilecard",
38
- packageVersion: "16.9.1",
38
+ packageVersion: "16.11.0",
39
39
  ...attributes,
40
40
  firedAt: getPageTime()
41
41
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.9.1"
3
+ "version": "16.11.0"
4
4
  }
@@ -1,10 +1,10 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
5
4
  import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
 
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
10
 
@@ -1,4 +1,3 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -6,6 +5,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
 
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
 
@@ -1,6 +1,6 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
 
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
 
@@ -148,6 +148,10 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
148
148
  }
149
149
  });
150
150
 
151
+ _defineProperty(_assertThisInitialized(_this), "onClose", function () {
152
+ _this.hideProfilecard();
153
+ });
154
+
151
155
  _defineProperty(_assertThisInitialized(_this), "openKudosDrawer", function () {
152
156
  _this.hideProfilecard(DELAY_MS_HIDE);
153
157
 
@@ -282,7 +286,6 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
282
286
  type: KudosType.TEAM,
283
287
  recipientId: _this.props.teamId
284
288
  },
285
- analytics: _this.fireAnalytics,
286
289
  analyticsSource: "team-profile-card",
287
290
  teamCentralBaseUrl: _this.state.teamCentralBaseUrl,
288
291
  cloudId: _this.props.cloudId || '',
@@ -407,7 +410,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
407
410
  onError: this.onErrorBoundary
408
411
  }, /*#__PURE__*/React.createElement(Popup, {
409
412
  isOpen: !!this.state.visible,
410
- onClose: this.hideProfilecard,
413
+ onClose: this.onClose,
411
414
  placement: this.props.position,
412
415
  content: this.renderProfileCard,
413
416
  trigger: function trigger(triggerProps) {
@@ -220,7 +220,6 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
220
220
  type: KudosType.INDIVIDUAL,
221
221
  recipientId: this.props.userId
222
222
  },
223
- analytics: this.props.analytics,
224
223
  analyticsSource: "profile-card",
225
224
  teamCentralBaseUrl: newProps.teamCentralBaseUrl,
226
225
  cloudId: this.props.cloudId,
@@ -292,7 +292,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
292
292
  type: KudosType.INDIVIDUAL,
293
293
  recipientId: this.props.userId
294
294
  },
295
- analytics: this.props.analytics,
296
295
  analyticsSource: "profile-card",
297
296
  teamCentralBaseUrl: this.state.teamCentralBaseUrl,
298
297
  cloudId: this.props.cloudId,
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
45
45
  actionSubjectId: actionSubjectId,
46
46
  attributes: _objectSpread(_objectSpread({
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "16.9.1"
48
+ packageVersion: "16.11.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: getPageTime()
51
51
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.9.1"
3
+ "version": "16.11.0"
4
4
  }
@@ -18,6 +18,7 @@ export declare class TeamProfileCardTriggerInternal extends React.PureComponent<
18
18
  onClick: (event: React.MouseEvent<HTMLElement>) => void;
19
19
  onMouseEnter: () => void;
20
20
  onMouseLeave: () => void;
21
+ onClose: () => void;
21
22
  openKudosDrawer: () => void;
22
23
  closeKudosDrawer: () => void;
23
24
  kudosUrl: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.9.1",
3
+ "version": "16.11.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -42,12 +42,12 @@
42
42
  "@atlaskit/avatar": "^21.0.0",
43
43
  "@atlaskit/avatar-group": "^9.0.0",
44
44
  "@atlaskit/button": "^16.3.0",
45
- "@atlaskit/dropdown-menu": "^11.2.0",
46
- "@atlaskit/give-kudos": "^0.4.0",
45
+ "@atlaskit/dropdown-menu": "^11.3.0",
46
+ "@atlaskit/give-kudos": "^0.6.0",
47
47
  "@atlaskit/icon": "^21.10.0",
48
48
  "@atlaskit/lozenge": "^11.0.0",
49
49
  "@atlaskit/menu": "^1.3.0",
50
- "@atlaskit/popup": "^1.3.0",
50
+ "@atlaskit/popup": "^1.4.0",
51
51
  "@atlaskit/spinner": "^15.0.0",
52
52
  "@atlaskit/theme": "^12.1.0",
53
53
  "@atlaskit/tokens": "^0.10.0",
@@ -64,11 +64,11 @@
64
64
  },
65
65
  "devDependencies": {
66
66
  "@atlaskit/docs": "*",
67
- "@atlaskit/dynamic-table": "^14.6.0",
67
+ "@atlaskit/dynamic-table": "^14.7.0",
68
68
  "@atlaskit/flag": "^14.5.0",
69
69
  "@atlaskit/inline-edit": "^12.0.0",
70
- "@atlaskit/select": "^15.3.0",
71
- "@atlaskit/util-data-test": "^17.3.0",
70
+ "@atlaskit/select": "^15.5.0",
71
+ "@atlaskit/util-data-test": "^17.5.0",
72
72
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
73
73
  "@testing-library/react": "^8.0.1",
74
74
  "enzyme": "^3.10.0",
package/report.api.md ADDED
@@ -0,0 +1,679 @@
1
+ ## API Report File for "@atlaskit/profilecard".
2
+
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
+
7
+ ```ts
8
+ /// <reference types="react" />
9
+
10
+ import { ComponentType } from 'react';
11
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
12
+ import { IntlShape } from 'react-intl-next';
13
+ import { LRUCache } from 'lru-fast';
14
+ import { default as React_2 } from 'react';
15
+ import { ReactElement } from 'react';
16
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
17
+
18
+ declare type AnalyticsFromDuration = (duration: number) => Record<string, any>;
19
+
20
+ declare type AnalyticsFunction = (generator: AnalyticsFromDuration) => void;
21
+
22
+ export declare interface ApiClientResponse {
23
+ User: {
24
+ id: string;
25
+ isBot: boolean;
26
+ isCurrentUser: boolean;
27
+ isNotMentionable: boolean;
28
+ avatarUrl: string | null;
29
+ email: string | null;
30
+ fullName: string | null;
31
+ location: string | null;
32
+ meta: string | null;
33
+ nickname: string | null;
34
+ companyName: string | null;
35
+ remoteTimeString: string | null;
36
+ remoteWeekdayIndex: string | null;
37
+ remoteWeekdayString: string | null;
38
+ status: StatusType;
39
+ statusModifiedDate: number | null;
40
+ };
41
+ }
42
+
43
+ declare interface CacheConfig {
44
+ cacheSize?: number;
45
+ cacheMaxAge?: number;
46
+ }
47
+
48
+ declare interface CachedData<T> {
49
+ expire: number;
50
+ profile: T;
51
+ }
52
+
53
+ declare class CachingClient<T> {
54
+ config: Required<CacheConfig>;
55
+ cache: LRUCache<string, CachedData<T>> | null;
56
+ constructor(config: CacheConfig);
57
+ setCachedProfile(cacheIdentifier: string, profile: T): void;
58
+ getCachedProfile(cacheIdentifier: string): T | null;
59
+ flushCache(): void;
60
+ }
61
+
62
+ declare interface ClientOverrides {
63
+ userClient?: UserProfileClient;
64
+ teamClient?: TeamProfileClient;
65
+ teamCentralClient?: TeamCentralCardClient;
66
+ }
67
+
68
+ export declare const DELAY_MS_HIDE = 200;
69
+
70
+ export declare const DELAY_MS_SHOW = 800;
71
+
72
+ declare type FeatureFlagExtraContext = {
73
+ key: string;
74
+ value: string;
75
+ };
76
+
77
+ declare type LozengeColor =
78
+ | 'default'
79
+ | 'success'
80
+ | 'removed'
81
+ | 'inprogress'
82
+ | 'new'
83
+ | 'moved';
84
+
85
+ declare interface LozengeProps {
86
+ text: React_2.ReactNode;
87
+ appearance?: LozengeColor;
88
+ isBold?: boolean;
89
+ }
90
+
91
+ export declare interface MessageIntlProviderProps {
92
+ children: React_2.ReactNode;
93
+ intl: IntlShape;
94
+ }
95
+
96
+ /**
97
+ * Transform response from GraphQL
98
+ * - Prefix `timestring` with `remoteWeekdayString` depending on `remoteWeekdayIndex`
99
+ * - Remove properties which will be not used later
100
+ * @ignore
101
+ * @param {object} response
102
+ * @return {object}
103
+ */
104
+ export declare const modifyResponse: (
105
+ response: ApiClientResponse,
106
+ ) => ProfileCardClientData;
107
+
108
+ export declare class ProfileCard extends React_2.PureComponent<
109
+ ProfilecardProps
110
+ > {
111
+ static defaultProps: ProfilecardProps;
112
+ GIVE_KUDOS_ACTION_ID: string;
113
+ private timeOpen;
114
+ clientFetchProfile: () => void;
115
+ constructor(props: ProfilecardProps);
116
+ private durationSince;
117
+ callClientFetchProfile: (...args: any) => void;
118
+ callAnalytics: (id: string, options: any) => void;
119
+ componentDidMount(): void;
120
+ renderErrorMessage(): JSX.Element;
121
+ kudosUrl: () => string;
122
+ kudosButtonCallback: () => void;
123
+ getActions(): ProfileCardAction[];
124
+ renderButton: (action: ProfileCardAction, idx: number) => ReactElement;
125
+ renderActionsButtons(): JSX.Element | null;
126
+ private onActionClick;
127
+ renderCardDetailsDefault(): JSX.Element;
128
+ renderCardDetailsForDisabledAccount(): JSX.Element;
129
+ getDisabledAccountName(): string | JSX.Element | null | undefined;
130
+ getDisabledAccountDesc(): {};
131
+ private renderFullNameAndPublicName;
132
+ renderCustomLozenges(lozenges: LozengeProps[]): JSX.Element | null;
133
+ renderCardDetailsApp(): JSX.Element;
134
+ renderCardDetails(): JSX.Element;
135
+ render(): JSX.Element;
136
+ }
137
+
138
+ export declare interface ProfileCardAction {
139
+ callback?: (...args: any[]) => any;
140
+ shouldRender?: (data: any) => boolean;
141
+ id?: string;
142
+ label: React_2.ReactNode;
143
+ link?: string;
144
+ }
145
+
146
+ export declare interface ProfileCardClientData {
147
+ isBot: boolean;
148
+ isCurrentUser: boolean;
149
+ isNotMentionable: boolean;
150
+ avatarUrl?: string;
151
+ email?: string;
152
+ fullName?: string;
153
+ location?: string;
154
+ meta?: string;
155
+ nickname?: string;
156
+ companyName?: string;
157
+ timestring?: string;
158
+ status: StatusType;
159
+ statusModifiedDate?: number | null;
160
+ customLozenges?: LozengeProps[];
161
+ }
162
+
163
+ export declare type ProfileCardErrorType = {
164
+ reason: 'default' | 'NotFound';
165
+ } | null;
166
+
167
+ export declare interface ProfilecardProps {
168
+ isLoading?: boolean;
169
+ hasError?: boolean;
170
+ errorType?: ProfileCardErrorType;
171
+ status?: StatusType;
172
+ isBot?: boolean;
173
+ isNotMentionable?: boolean;
174
+ avatarUrl?: string;
175
+ fullName?: string;
176
+ meta?: string;
177
+ userId?: string;
178
+ isCurrentUser?: boolean;
179
+ nickname?: string;
180
+ email?: string;
181
+ location?: string;
182
+ companyName?: string;
183
+ timestring?: string;
184
+ actions?: ProfileCardAction[];
185
+ clientFetchProfile?: any;
186
+ analytics?: any;
187
+ statusModifiedDate?: number | null;
188
+ withoutElevation?: boolean;
189
+ /** Show manager and direct reports section on profile hover card, if available */
190
+ reportingLines?: TeamCentralReportingLinesData;
191
+ /** Base URL to populate href value for manager's and direct reports' user avatar */
192
+ reportingLinesProfileUrl?: string;
193
+ /** Click handler when user clicks on manager's and direct reports' user avatar, un-clickable otherwise */
194
+ onReportingLinesClick?: (user: ReportingLinesUser) => void;
195
+ isKudosEnabled?: boolean;
196
+ teamCentralBaseUrl?: string;
197
+ addFlag?: (flag: any) => void;
198
+ cloudId?: string;
199
+ disabledAccountMessage?: React_2.ReactNode;
200
+ hasDisabledAccountLozenge?: boolean;
201
+ customLozenges?: LozengeProps[];
202
+ openKudosDrawer?: () => void;
203
+ }
204
+
205
+ declare class ProfileCardResourced extends React_2.PureComponent<
206
+ ProfileCardResourcedProps,
207
+ ProfileCardResourcedState
208
+ > {
209
+ static defaultProps: Partial<ProfileCardResourcedProps>;
210
+ _isMounted: boolean;
211
+ state: ProfileCardResourcedState;
212
+ componentDidMount(): void;
213
+ componentDidUpdate(
214
+ prevProps: ProfileCardResourcedProps,
215
+ prevState: ProfileCardResourcedState,
216
+ ): void;
217
+ componentWillUnmount(): void;
218
+ private callAnalytics;
219
+ clientFetchProfile: () => void;
220
+ handleClientSuccess(
221
+ profileData: ProfileCardClientData,
222
+ reportingLinesData: TeamCentralReportingLinesData,
223
+ shouldShowGiveKudos: boolean,
224
+ ): void;
225
+ handleClientError(err: any): void;
226
+ filterActions: () => ProfileCardAction[];
227
+ openKudosDrawer: () => void;
228
+ closeKudosDrawer: () => void;
229
+ render(): React_2.ReactNode;
230
+ }
231
+ export default ProfileCardResourced;
232
+
233
+ export declare interface ProfileCardResourcedProps {
234
+ userId: string;
235
+ cloudId: string;
236
+ resourceClient: ProfileClient_2;
237
+ actions?: ProfileCardAction[];
238
+ reportingLinesProfileUrl?: string;
239
+ onReportingLinesClick?: (user: ReportingLinesUser) => void;
240
+ analytics?: any;
241
+ position?: ProfilecardTriggerPosition;
242
+ trigger?: TriggerType;
243
+ children?: React_2.ReactNode;
244
+ addFlag?: (flag: any) => void;
245
+ }
246
+
247
+ export declare interface ProfileCardResourcedState {
248
+ visible?: boolean;
249
+ isLoading?: boolean;
250
+ hasError: boolean;
251
+ error?: ProfileCardErrorType;
252
+ data: ProfileCardClientData | null;
253
+ reportingLinesData?: TeamCentralReportingLinesData;
254
+ isKudosEnabled?: boolean;
255
+ kudosDrawerOpen: boolean;
256
+ }
257
+
258
+ export declare class ProfileCardTrigger extends React_2.PureComponent<
259
+ ProfileCardTriggerProps,
260
+ ProfileCardTriggerState
261
+ > {
262
+ static defaultProps: Partial<ProfileCardTriggerProps>;
263
+ _isMounted: boolean;
264
+ showDelay: number;
265
+ hideDelay: number;
266
+ showTimer: number;
267
+ hideTimer: number;
268
+ hideProfilecard: () => void;
269
+ showProfilecard: () => void;
270
+ onClick: (event: React_2.MouseEvent) => void;
271
+ containerListeners:
272
+ | {
273
+ onMouseEnter: () => void;
274
+ onMouseLeave: () => void;
275
+ onClick?: undefined;
276
+ }
277
+ | {
278
+ onClick: (event: React_2.MouseEvent) => void;
279
+ onMouseEnter?: undefined;
280
+ onMouseLeave?: undefined;
281
+ };
282
+ layerListeners: {
283
+ handleClickOutside: () => void;
284
+ handleEscapeKeydown: () => void;
285
+ };
286
+ state: ProfileCardTriggerState;
287
+ componentDidMount(): void;
288
+ componentDidUpdate(prevProps: ProfileCardTriggerProps): void;
289
+ componentWillUnmount(): void;
290
+ clientFetchProfile: () => void;
291
+ handleClientSuccess(
292
+ profileData: ProfileCardClientData,
293
+ reportingLinesData: TeamCentralReportingLinesData,
294
+ shouldShowGiveKudos: boolean,
295
+ ): void;
296
+ handleClientError(err: any): void;
297
+ filterActions(): ProfileCardAction[];
298
+ renderProfileCard(): JSX.Element;
299
+ openKudosDrawer: () => void;
300
+ closeKudosDrawer: () => void;
301
+ renderCard: () => JSX.Element;
302
+ renderWithTrigger(): JSX.Element;
303
+ render(): JSX.Element;
304
+ }
305
+
306
+ export declare type ProfilecardTriggerPosition =
307
+ | 'bottom-start'
308
+ | 'bottom'
309
+ | 'bottom-end'
310
+ | 'left-start'
311
+ | 'left'
312
+ | 'left-end'
313
+ | 'top-end'
314
+ | 'top'
315
+ | 'top-start'
316
+ | 'right-end'
317
+ | 'right'
318
+ | 'right-start';
319
+
320
+ export declare interface ProfileCardTriggerProps {
321
+ userId: string;
322
+ /**
323
+ A cloudId can be provided, and we'll verify that the target userId is an
324
+ actual user in the specified site.
325
+
326
+ Instead you can omit the cloudId and we won't do such a check.
327
+
328
+ If you have a cloudId and only want to show users who are in that site
329
+ then please provide it. If you're a site-less product or don't care about
330
+ verifying that the shown user is in a particular site, don't provide a
331
+ cloudId.
332
+ */
333
+ cloudId?: string;
334
+ resourceClient: ProfileClient_2;
335
+ actions?: ProfileCardAction[];
336
+ reportingLinesProfileUrl?: string;
337
+ onReportingLinesClick?: (user: ReportingLinesUser) => void;
338
+ analytics?: any;
339
+ position?: ProfilecardTriggerPosition;
340
+ trigger?: TriggerType;
341
+ children?: React_2.ReactNode;
342
+ testId?: string;
343
+ addFlag?: (flag: any) => void;
344
+ }
345
+
346
+ export declare interface ProfileCardTriggerState {
347
+ visible?: boolean;
348
+ isLoading?: boolean;
349
+ hasError: boolean;
350
+ error?: ProfileCardErrorType;
351
+ data: ProfileCardClientData | null;
352
+ reportingLinesData?: TeamCentralReportingLinesData;
353
+ shouldShowGiveKudos?: boolean;
354
+ teamCentralBaseUrl?: string;
355
+ kudosDrawerOpen: boolean;
356
+ }
357
+
358
+ export declare class ProfileClient {
359
+ userClient: UserProfileClient;
360
+ teamClient: TeamProfileClient;
361
+ tcClient?: TeamCentralCardClient;
362
+ constructor(config: ProfileClientOptions, clients?: ClientOverrides);
363
+ flushCache(): void;
364
+ getProfile(cloudId: string, userId: string): Promise<any>;
365
+ getTeamProfile(
366
+ teamId: string,
367
+ orgId?: string,
368
+ analytics?: (event: Record<string, any>) => void,
369
+ ): Promise<Team>;
370
+ getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
371
+ getTeamCentralBaseUrl(): string | undefined;
372
+ shouldShowGiveKudos(): Promise<boolean>;
373
+ }
374
+
375
+ declare interface ProfileClient_2 {
376
+ flushCache: () => void;
377
+ getProfile: (
378
+ cloudId: string,
379
+ userId: string,
380
+ ) => Promise<ProfileCardClientData>;
381
+ getTeamProfile: (
382
+ teamId: string,
383
+ orgId?: string,
384
+ fireAnalytics?: (event: Record<string, any>) => void,
385
+ ) => Promise<Team>;
386
+ getReportingLines: (userId: string) => Promise<TeamCentralReportingLinesData>;
387
+ shouldShowGiveKudos: () => Promise<boolean>;
388
+ getTeamCentralBaseUrl: () => string | undefined;
389
+ }
390
+
391
+ export declare interface ProfileClientOptions {
392
+ url: string;
393
+ gatewayGraphqlUrl?: string;
394
+ cacheSize?: number;
395
+ cacheMaxAge?: number;
396
+ /** Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql*/
397
+ teamCentralUrl?: string;
398
+ /** URL to the Team Central app e.g. team.atlassian.com */
399
+ teamCentralBaseUrl?: string;
400
+ /** Name of integrating product e.g. jira, atlas, confluence **/
401
+ productIdentifier?: string;
402
+ }
403
+
404
+ export declare type RelativeDateKeyType =
405
+ | 'ThisWeek'
406
+ | 'ThisMonth'
407
+ | 'LastMonth'
408
+ | 'AFewMonths'
409
+ | 'SeveralMonths'
410
+ | 'MoreThanAYear'
411
+ | null;
412
+
413
+ declare interface ReportingLinesUser {
414
+ accountIdentifier: string;
415
+ identifierType: 'ATLASSIAN_ID' | 'BASE64_HASH' | 'UNKNOWN';
416
+ pii?: ReportingLinesUserPII;
417
+ }
418
+
419
+ declare interface ReportingLinesUserPII {
420
+ name: string;
421
+ picture?: string;
422
+ }
423
+
424
+ export declare type StatusModifiedDateType =
425
+ | 'noDate'
426
+ | 'thisWeek'
427
+ | 'thisMonth'
428
+ | 'lastMonth'
429
+ | 'aFewMonths'
430
+ | 'severalMonths'
431
+ | 'moreThanAYear';
432
+
433
+ export declare type StatusType = 'active' | 'inactive' | 'closed';
434
+
435
+ export declare interface Team {
436
+ largeAvatarImageUrl?: string;
437
+ smallAvatarImageUrl?: string;
438
+ largeHeaderImageUrl?: string;
439
+ smallHeaderImageUrl?: string;
440
+ id: string;
441
+ displayName: string;
442
+ description: string;
443
+ organizationId?: string;
444
+ members?: {
445
+ id: string;
446
+ fullName: string;
447
+ avatarUrl: string;
448
+ }[];
449
+ }
450
+
451
+ declare class TeamCentralCardClient extends CachingClient<
452
+ TeamCentralReportingLinesData
453
+ > {
454
+ options: TeamCentralCardClientOptions;
455
+ /**
456
+ * Simple circuit breaker to avoid making unnecessary calls to Team Central on auth failures
457
+ * This is to handle the case where products may have provided teamCentralUrl, but the site itself
458
+ * doesn't actually have any TC product.
459
+ *
460
+ * There's currently no way to reset this circuit breaker, but that's fine. This is meant to
461
+ * catch a pretty specific edge case.
462
+ */
463
+ bypassOnFailure: boolean;
464
+ featureFlagKeys: Map<string, boolean>;
465
+ constructor(options: TeamCentralCardClientOptions);
466
+ makeFeatureFlagCheckRequest(
467
+ featureKey: string,
468
+ context?: FeatureFlagExtraContext[],
469
+ ): Promise<boolean>;
470
+ makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
471
+ getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
472
+ getFlagEnabled(
473
+ featureKey: string,
474
+ productIdentifier?: string,
475
+ ): Promise<boolean>;
476
+ private filterReportingLinesUser;
477
+ }
478
+
479
+ declare type TeamCentralCardClientOptions = ProfileClientOptions & {
480
+ teamCentralUrl: string;
481
+ };
482
+
483
+ declare interface TeamCentralReportingLinesData {
484
+ managers?: ReportingLinesUser[];
485
+ reports?: ReportingLinesUser[];
486
+ }
487
+
488
+ export declare const TeamProfileCard: (
489
+ props: TeamProfilecardProps,
490
+ ) => JSX.Element | null;
491
+
492
+ declare interface TeamProfilecardCoreProps {
493
+ /**
494
+ The id of the user viewing the profile card.
495
+
496
+ This is used to determine whether to say that the member count is
497
+ "including you" or not.
498
+ */
499
+ viewingUserId?: string;
500
+ /**
501
+ A list of extra buttons to be displayed at the bottom of the card.
502
+ View Profile is always included by default.
503
+ */
504
+ actions?: ProfileCardAction[];
505
+ /**
506
+ A function allowing products to provide an href for the user avatars in the
507
+ profilecard, e.g. so they can link to user's profile pages.
508
+ */
509
+ generateUserLink?: (userId: string) => string;
510
+ /**
511
+ A function allowing products to provide an onClick handler for when the
512
+ user clicks on a user's avatar or avatar group item.
513
+ */
514
+ onUserClick?: (userId: string, event: React_2.MouseEvent<Element>) => void;
515
+ /**
516
+ This should be a link to the team's profile page. This will be used for:
517
+
518
+ - Wrapping the trigger in a link to the team profile page (unless
519
+ triggerLinkType is `none`).
520
+
521
+ - Providing the link for the View Profile action button on the card.
522
+ */
523
+ viewProfileLink: string;
524
+ /**
525
+ An onClick action that navigates to the team's profile page. Something you
526
+ may want, e.g. for an SPA site or tracking analytics of navigation. This
527
+ is optional, just the viewProfileLink will suffice. Will be used for:
528
+
529
+ - Adding an onClick to the trigger if the triggerLinkType is
530
+ `clickable-link`.
531
+
532
+ - Providing an onClick for the View Profile action button on the card.
533
+ */
534
+ viewProfileOnClick?: (event?: React_2.MouseEvent<Element>) => void;
535
+ }
536
+
537
+ declare interface TeamProfilecardProps extends TeamProfilecardCoreProps {
538
+ /** Indicates whether the team's details are still loading. */
539
+ isLoading?: boolean;
540
+ /** Indicates whether an error occurred whilst fetching team details. */
541
+ hasError?: boolean;
542
+ /** Describes the type of error that occurred, if any. */
543
+ errorType?: ProfileCardErrorType;
544
+ /** The details of the team to be shown. */
545
+ team?: Team;
546
+ /** A callback that will try to re-fetch data in case an error occurred. */
547
+ clientFetchProfile?: () => void;
548
+ /** Details relevant to passing around analytics. */
549
+ analytics: AnalyticsFunction;
550
+ }
551
+
552
+ export declare const TeamProfileCardTrigger: React_2.ForwardRefExoticComponent<
553
+ Pick<
554
+ Omit<
555
+ TeamProfileCardTriggerProps & {
556
+ createAnalyticsEvent?: CreateUIAnalyticsEvent | undefined;
557
+ },
558
+ keyof WithAnalyticsEventsProps
559
+ >,
560
+ never
561
+ > &
562
+ Partial<
563
+ Pick<
564
+ Omit<
565
+ TeamProfileCardTriggerProps & {
566
+ createAnalyticsEvent?: CreateUIAnalyticsEvent | undefined;
567
+ },
568
+ keyof WithAnalyticsEventsProps
569
+ >,
570
+ keyof TeamProfileCardTriggerProps
571
+ >
572
+ > &
573
+ Partial<Pick<Partial<TeamProfileCardTriggerProps>, never>> &
574
+ React_2.RefAttributes<any>
575
+ >;
576
+
577
+ declare interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps {
578
+ /** The id of the team. */
579
+ teamId: string;
580
+ /**
581
+ The id of the organization that the team belongs to.
582
+ Currently this is unused, but will become necessary in the future.
583
+ */
584
+ orgId: string;
585
+ /** An instance of ProfileClient. */
586
+ resourceClient: ProfileClient_2;
587
+ /**
588
+ The position relative to the trigger that the card should be displayed in.
589
+ */
590
+ position?: ProfilecardTriggerPosition;
591
+ /**
592
+ The interaction method used to trigger the team profile card to appear.
593
+
594
+ - Click is generally recommended, but your needs may vary.
595
+
596
+ - Hover works for mouse users, but does not support those who use a
597
+ keyboard or screen reader, avoid using this if it's possible or makes
598
+ sense.
599
+
600
+ - Hover-click is usable for scenarios like inline-edits, where mouse users
601
+ cannot click on the trigger without causing side effects, but keyboard
602
+ users are still able to navigate into and trigger the profile card.
603
+
604
+ Look at the "Team Profilecard Trigger" or "Trigger Link Types" examples to
605
+ see how they behave, or ask in #team-twp-people-teams on Slack for our
606
+ recommendations.
607
+ */
608
+ trigger?: 'hover' | 'click' | 'hover-click';
609
+ /**
610
+ We generally prefer to wrap the trigger in a link to the team profile
611
+ page. This prop determines how that link behaves.
612
+
613
+ - Link is generally the recommended prop (especially in combination with
614
+ click or hover-click for the trigger prop above). It wraps the trigger in
615
+ an anchor tag with the team profile link (that users can interact with
616
+ via middle-click, etc.), but left clicking on the link is suppressed.
617
+
618
+ - None does not wrap the trigger in a link at all. This makes it difficult
619
+ for keyboard or screen reader users to know how to trigger the profile
620
+ card. Generally avoid this.
621
+
622
+ - Clickable-link wraps the trigger in a link with no special behaviour.
623
+ This is suitable for places where you want the trigger to serve primarily
624
+ as a link, and optionally allow hovering to preview the team first.
625
+
626
+ Look at the example on "Trigger Link Types" for more in-depth analysis, or
627
+ ask in #team-twp-people-teams on Slack for our recommendations.
628
+ */
629
+ triggerLinkType?: 'none' | 'link' | 'clickable-link';
630
+ /**
631
+ This is the component that will cause a team profile card to appear when
632
+ interacted with according to the method specified by the trigger prop.
633
+ */
634
+ children?: React_2.ReactNode;
635
+ /**
636
+ * Used by the card to show Flags.
637
+ */
638
+ addFlag?: (flag: any) => void;
639
+ /**
640
+ * Optional cloudId. Pass this if rendering card within a sited context.
641
+ */
642
+ cloudId?: string;
643
+ }
644
+
645
+ export declare class TeamProfileClient extends CachingClient<Team> {
646
+ options: ProfileClientOptions;
647
+ constructor(options: ProfileClientOptions);
648
+ makeRequestViaGateway(
649
+ teamId: string,
650
+ _orgId: string | undefined,
651
+ ): Promise<Team>;
652
+ makeRequest(teamId: string, orgId: string | undefined): Promise<Team>;
653
+ getProfile(
654
+ teamId: string,
655
+ orgId: string | undefined,
656
+ analytics?: (event: Record<string, any>) => void,
657
+ ): Promise<Team>;
658
+ }
659
+
660
+ export declare type TriggerType = 'hover' | 'click';
661
+
662
+ export declare class UserProfileClient extends CachingClient<any> {
663
+ options: ProfileClientOptions;
664
+ constructor(options: ProfileClientOptions);
665
+ makeRequest(cloudId: string, userId: string): Promise<ProfileCardClientData>;
666
+ getProfile(cloudId: string, userId: string): Promise<any>;
667
+ }
668
+
669
+ export declare function withOuterListeners<P>(
670
+ Component: ComponentType<P>,
671
+ ): React_2.ComponentClass<P & WithOuterListenersProps>;
672
+
673
+ export declare interface WithOuterListenersProps {
674
+ handleClickOutside?: () => void;
675
+ handleEscapeKeydown?: () => void;
676
+ }
677
+
678
+ export {};
679
+ ```