@atlaskit/profilecard 16.10.0 → 16.12.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,27 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 16.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`12835d685b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12835d685b4) - [ux] Only show give kudos button on active profiles
8
+
9
+ ## 16.11.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`01d80d395bc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/01d80d395bc) - pass event to onOpenChange consistently
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
19
+ ## 16.10.1
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 16.10.0
4
26
 
5
27
  ### Minor 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
 
@@ -419,7 +422,7 @@ var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureComponent
419
422
  onError: this.onErrorBoundary
420
423
  }, /*#__PURE__*/_react.default.createElement(_popup.default, {
421
424
  isOpen: !!this.state.visible,
422
- onClose: this.hideProfilecard,
425
+ onClose: this.onClose,
423
426
  placement: this.props.position,
424
427
  content: this.renderProfileCard,
425
428
  trigger: function trigger(triggerProps) {
@@ -162,7 +162,7 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
162
162
 
163
163
  var actions = this.props.actions || [];
164
164
 
165
- if (!this.props.isCurrentUser && this.props.isKudosEnabled) {
165
+ if (!this.props.isCurrentUser && this.props.status === 'active' && this.props.isKudosEnabled) {
166
166
  var kudosAction = {
167
167
  label: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.default.giveKudosButton),
168
168
  id: this.GIVE_KUDOS_ACTION_ID,
@@ -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.10.0"
59
+ packageVersion: "16.12.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.10.0"
3
+ "version": "16.12.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({
@@ -360,7 +364,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
360
364
  onError: this.onErrorBoundary
361
365
  }, /*#__PURE__*/React.createElement(Popup, {
362
366
  isOpen: !!this.state.visible,
363
- onClose: this.hideProfilecard,
367
+ onClose: this.onClose,
364
368
  placement: this.props.position,
365
369
  content: this.renderProfileCard,
366
370
  trigger: triggerProps => this.renderTrigger(triggerProps),
@@ -93,7 +93,7 @@ export default class Profilecard extends React.PureComponent {
93
93
  getActions() {
94
94
  const actions = this.props.actions || [];
95
95
 
96
- if (!this.props.isCurrentUser && this.props.isKudosEnabled) {
96
+ if (!this.props.isCurrentUser && this.props.status === 'active' && this.props.isKudosEnabled) {
97
97
  const kudosAction = {
98
98
  label: /*#__PURE__*/React.createElement(FormattedMessage, messages.giveKudosButton),
99
99
  id: this.GIVE_KUDOS_ACTION_ID,
@@ -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.10.0",
38
+ packageVersion: "16.12.0",
39
39
  ...attributes,
40
40
  firedAt: getPageTime()
41
41
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.10.0"
3
+ "version": "16.12.0"
4
4
  }
@@ -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
 
@@ -406,7 +410,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
406
410
  onError: this.onErrorBoundary
407
411
  }, /*#__PURE__*/React.createElement(Popup, {
408
412
  isOpen: !!this.state.visible,
409
- onClose: this.hideProfilecard,
413
+ onClose: this.onClose,
410
414
  placement: this.props.position,
411
415
  content: this.renderProfileCard,
412
416
  trigger: function trigger(triggerProps) {
@@ -135,7 +135,7 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
135
135
 
136
136
  var actions = this.props.actions || [];
137
137
 
138
- if (!this.props.isCurrentUser && this.props.isKudosEnabled) {
138
+ if (!this.props.isCurrentUser && this.props.status === 'active' && this.props.isKudosEnabled) {
139
139
  var kudosAction = {
140
140
  label: /*#__PURE__*/React.createElement(FormattedMessage, messages.giveKudosButton),
141
141
  id: this.GIVE_KUDOS_ACTION_ID,
@@ -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.10.0"
48
+ packageVersion: "16.12.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: getPageTime()
51
51
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.10.0"
3
+ "version": "16.12.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.10.0",
3
+ "version": "16.12.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.5.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 CHANGED
@@ -1,6 +1,8 @@
1
- ## API Report File for "@atlaskit/profilecard"
1
+ ## API Report File for "@atlaskit/profilecard".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
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)
4
6
 
5
7
  ```ts
6
8
  /// <reference types="react" />
@@ -13,9 +15,11 @@ import { default as React_2 } from 'react';
13
15
  import { ReactElement } from 'react';
14
16
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
15
17
 
16
- // @public (undocumented)
17
- export interface ApiClientResponse {
18
- // (undocumented)
18
+ declare type AnalyticsFromDuration = (duration: number) => Record<string, any>;
19
+
20
+ declare type AnalyticsFunction = (generator: AnalyticsFromDuration) => void;
21
+
22
+ export declare interface ApiClientResponse {
19
23
  User: {
20
24
  id: string;
21
25
  isBot: boolean;
@@ -36,289 +40,234 @@ export interface ApiClientResponse {
36
40
  };
37
41
  }
38
42
 
39
- // @public (undocumented)
40
- export const DELAY_MS_HIDE = 200;
43
+ declare interface CacheConfig {
44
+ cacheSize?: number;
45
+ cacheMaxAge?: number;
46
+ }
47
+
48
+ declare interface CachedData<T> {
49
+ expire: number;
50
+ profile: T;
51
+ }
41
52
 
42
- // @public (undocumented)
43
- export const DELAY_MS_SHOW = 800;
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
+ }
44
61
 
45
- // @public (undocumented)
46
- export interface MessageIntlProviderProps {
47
- // (undocumented)
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 {
48
92
  children: React_2.ReactNode;
49
- // (undocumented)
50
93
  intl: IntlShape;
51
94
  }
52
95
 
53
- // @public
54
- export const modifyResponse: (
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: (
55
105
  response: ApiClientResponse,
56
106
  ) => ProfileCardClientData;
57
107
 
58
- // @public (undocumented)
59
- export class ProfileCard extends React_2.PureComponent<ProfilecardProps> {
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;
60
115
  constructor(props: ProfilecardProps);
61
- // (undocumented)
62
- callAnalytics: (id: string, options: any) => void;
63
- // (undocumented)
116
+ private durationSince;
64
117
  callClientFetchProfile: (...args: any) => void;
65
- // (undocumented)
66
- clientFetchProfile: () => void;
67
- // (undocumented)
118
+ callAnalytics: (id: string, options: any) => void;
68
119
  componentDidMount(): void;
69
- // (undocumented)
70
- static defaultProps: ProfilecardProps;
71
- // (undocumented)
72
- getActions(): ProfileCardAction[];
73
- // (undocumented)
74
- getDisabledAccountDesc(): {};
75
- // (undocumented)
76
- getDisabledAccountName(): string | JSX.Element | null | undefined;
77
- // (undocumented)
78
- GIVE_KUDOS_ACTION_ID: string;
79
- // (undocumented)
80
- kudosButtonCallback: () => void;
81
- // (undocumented)
120
+ renderErrorMessage(): JSX.Element;
82
121
  kudosUrl: () => string;
83
- // (undocumented)
84
- render(): JSX.Element;
85
- // (undocumented)
86
- renderActionsButtons(): JSX.Element | null;
87
- // (undocumented)
122
+ kudosButtonCallback: () => void;
123
+ getActions(): ProfileCardAction[];
88
124
  renderButton: (action: ProfileCardAction, idx: number) => ReactElement;
89
- // (undocumented)
90
- renderCardDetails(): JSX.Element;
91
- // (undocumented)
92
- renderCardDetailsApp(): JSX.Element;
93
- // (undocumented)
125
+ renderActionsButtons(): JSX.Element | null;
126
+ private onActionClick;
94
127
  renderCardDetailsDefault(): JSX.Element;
95
- // (undocumented)
96
128
  renderCardDetailsForDisabledAccount(): JSX.Element;
97
- // (undocumented)
129
+ getDisabledAccountName(): string | JSX.Element | null | undefined;
130
+ getDisabledAccountDesc(): {};
131
+ private renderFullNameAndPublicName;
98
132
  renderCustomLozenges(lozenges: LozengeProps[]): JSX.Element | null;
99
- // (undocumented)
100
- renderErrorMessage(): JSX.Element;
133
+ renderCardDetailsApp(): JSX.Element;
134
+ renderCardDetails(): JSX.Element;
135
+ render(): JSX.Element;
101
136
  }
102
137
 
103
- // @public (undocumented)
104
- export interface ProfileCardAction {
105
- // (undocumented)
138
+ export declare interface ProfileCardAction {
106
139
  callback?: (...args: any[]) => any;
107
- // (undocumented)
140
+ shouldRender?: (data: any) => boolean;
108
141
  id?: string;
109
- // (undocumented)
110
142
  label: React_2.ReactNode;
111
- // (undocumented)
112
143
  link?: string;
113
- // (undocumented)
114
- shouldRender?: (data: any) => boolean;
115
144
  }
116
145
 
117
- // @public (undocumented)
118
- export interface ProfileCardClientData {
119
- // (undocumented)
120
- avatarUrl?: string;
121
- // (undocumented)
122
- companyName?: string;
123
- // (undocumented)
124
- customLozenges?: LozengeProps[];
125
- // (undocumented)
126
- email?: string;
127
- // (undocumented)
128
- fullName?: string;
129
- // (undocumented)
146
+ export declare interface ProfileCardClientData {
130
147
  isBot: boolean;
131
- // (undocumented)
132
148
  isCurrentUser: boolean;
133
- // (undocumented)
134
149
  isNotMentionable: boolean;
135
- // (undocumented)
150
+ avatarUrl?: string;
151
+ email?: string;
152
+ fullName?: string;
136
153
  location?: string;
137
- // (undocumented)
138
154
  meta?: string;
139
- // (undocumented)
140
155
  nickname?: string;
141
- // (undocumented)
156
+ companyName?: string;
157
+ timestring?: string;
142
158
  status: StatusType;
143
- // (undocumented)
144
159
  statusModifiedDate?: number | null;
145
- // (undocumented)
146
- timestring?: string;
160
+ customLozenges?: LozengeProps[];
147
161
  }
148
162
 
149
- // @public (undocumented)
150
- export type ProfileCardErrorType = {
163
+ export declare type ProfileCardErrorType = {
151
164
  reason: 'default' | 'NotFound';
152
165
  } | null;
153
166
 
154
- // @public (undocumented)
155
- export interface ProfilecardProps {
156
- // (undocumented)
157
- actions?: ProfileCardAction[];
158
- // (undocumented)
159
- addFlag?: (flag: any) => void;
160
- // (undocumented)
161
- analytics?: any;
162
- // (undocumented)
163
- avatarUrl?: string;
164
- // (undocumented)
165
- clientFetchProfile?: any;
166
- // (undocumented)
167
- cloudId?: string;
168
- // (undocumented)
169
- companyName?: string;
170
- // (undocumented)
171
- customLozenges?: LozengeProps[];
172
- // (undocumented)
173
- disabledAccountMessage?: React_2.ReactNode;
174
- // (undocumented)
175
- email?: string;
176
- // (undocumented)
177
- errorType?: ProfileCardErrorType;
178
- // (undocumented)
179
- fullName?: string;
180
- // (undocumented)
181
- hasDisabledAccountLozenge?: boolean;
182
- // (undocumented)
167
+ export declare interface ProfilecardProps {
168
+ isLoading?: boolean;
183
169
  hasError?: boolean;
184
- // (undocumented)
170
+ errorType?: ProfileCardErrorType;
171
+ status?: StatusType;
185
172
  isBot?: boolean;
186
- // (undocumented)
187
- isCurrentUser?: boolean;
188
- // (undocumented)
189
- isKudosEnabled?: boolean;
190
- // (undocumented)
191
- isLoading?: boolean;
192
- // (undocumented)
193
173
  isNotMentionable?: boolean;
194
- // (undocumented)
195
- location?: string;
196
- // (undocumented)
174
+ avatarUrl?: string;
175
+ fullName?: string;
197
176
  meta?: string;
198
- // (undocumented)
177
+ userId?: string;
178
+ isCurrentUser?: boolean;
199
179
  nickname?: string;
200
- onReportingLinesClick?: (user: ReportingLinesUser) => void;
201
- // (undocumented)
202
- openKudosDrawer?: () => void;
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 */
203
190
  reportingLines?: TeamCentralReportingLinesData;
191
+ /** Base URL to populate href value for manager's and direct reports' user avatar */
204
192
  reportingLinesProfileUrl?: string;
205
- // (undocumented)
206
- status?: StatusType;
207
- // (undocumented)
208
- statusModifiedDate?: number | null;
209
- // (undocumented)
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;
210
196
  teamCentralBaseUrl?: string;
211
- // (undocumented)
212
- timestring?: string;
213
- // (undocumented)
214
- userId?: string;
215
- // (undocumented)
216
- withoutElevation?: boolean;
197
+ addFlag?: (flag: any) => void;
198
+ cloudId?: string;
199
+ disabledAccountMessage?: React_2.ReactNode;
200
+ hasDisabledAccountLozenge?: boolean;
201
+ customLozenges?: LozengeProps[];
202
+ openKudosDrawer?: () => void;
217
203
  }
218
204
 
219
- // @public (undocumented)
220
- class ProfileCardResourced extends React_2.PureComponent<
205
+ declare class ProfileCardResourced extends React_2.PureComponent<
221
206
  ProfileCardResourcedProps,
222
207
  ProfileCardResourcedState
223
208
  > {
224
- // (undocumented)
225
- clientFetchProfile: () => void;
226
- // (undocumented)
227
- closeKudosDrawer: () => void;
228
- // (undocumented)
209
+ static defaultProps: Partial<ProfileCardResourcedProps>;
210
+ _isMounted: boolean;
211
+ state: ProfileCardResourcedState;
229
212
  componentDidMount(): void;
230
- // (undocumented)
231
213
  componentDidUpdate(
232
214
  prevProps: ProfileCardResourcedProps,
233
215
  prevState: ProfileCardResourcedState,
234
216
  ): void;
235
- // (undocumented)
236
217
  componentWillUnmount(): void;
237
- // (undocumented)
238
- static defaultProps: Partial<ProfileCardResourcedProps>;
239
- // (undocumented)
240
- filterActions: () => ProfileCardAction[];
241
- // (undocumented)
242
- handleClientError(err: any): void;
243
- // (undocumented)
218
+ private callAnalytics;
219
+ clientFetchProfile: () => void;
244
220
  handleClientSuccess(
245
221
  profileData: ProfileCardClientData,
246
222
  reportingLinesData: TeamCentralReportingLinesData,
247
223
  shouldShowGiveKudos: boolean,
248
224
  ): void;
249
- // (undocumented)
250
- _isMounted: boolean;
251
- // (undocumented)
225
+ handleClientError(err: any): void;
226
+ filterActions: () => ProfileCardAction[];
252
227
  openKudosDrawer: () => void;
253
- // (undocumented)
228
+ closeKudosDrawer: () => void;
254
229
  render(): React_2.ReactNode;
255
- // (undocumented)
256
- state: ProfileCardResourcedState;
257
230
  }
258
231
  export default ProfileCardResourced;
259
232
 
260
- // @public (undocumented)
261
- export interface ProfileCardResourcedProps {
262
- // (undocumented)
263
- actions?: ProfileCardAction[];
264
- // (undocumented)
265
- addFlag?: (flag: any) => void;
266
- // (undocumented)
267
- analytics?: any;
268
- // (undocumented)
269
- children?: React_2.ReactNode;
270
- // (undocumented)
233
+ export declare interface ProfileCardResourcedProps {
234
+ userId: string;
271
235
  cloudId: string;
272
- // (undocumented)
236
+ resourceClient: ProfileClient_2;
237
+ actions?: ProfileCardAction[];
238
+ reportingLinesProfileUrl?: string;
273
239
  onReportingLinesClick?: (user: ReportingLinesUser) => void;
274
- // (undocumented)
240
+ analytics?: any;
275
241
  position?: ProfilecardTriggerPosition;
276
- // (undocumented)
277
- reportingLinesProfileUrl?: string;
278
- // (undocumented)
279
- resourceClient: ProfileClient_2;
280
- // (undocumented)
281
242
  trigger?: TriggerType;
282
- // (undocumented)
283
- userId: string;
243
+ children?: React_2.ReactNode;
244
+ addFlag?: (flag: any) => void;
284
245
  }
285
246
 
286
- // @public (undocumented)
287
- export interface ProfileCardResourcedState {
288
- // (undocumented)
289
- data: ProfileCardClientData | null;
290
- // (undocumented)
291
- error?: ProfileCardErrorType;
292
- // (undocumented)
247
+ export declare interface ProfileCardResourcedState {
248
+ visible?: boolean;
249
+ isLoading?: boolean;
293
250
  hasError: boolean;
294
- // (undocumented)
251
+ error?: ProfileCardErrorType;
252
+ data: ProfileCardClientData | null;
253
+ reportingLinesData?: TeamCentralReportingLinesData;
295
254
  isKudosEnabled?: boolean;
296
- // (undocumented)
297
- isLoading?: boolean;
298
- // (undocumented)
299
255
  kudosDrawerOpen: boolean;
300
- // (undocumented)
301
- reportingLinesData?: TeamCentralReportingLinesData;
302
- // (undocumented)
303
- visible?: boolean;
304
256
  }
305
257
 
306
- // @public (undocumented)
307
- export class ProfileCardTrigger extends React_2.PureComponent<
258
+ export declare class ProfileCardTrigger extends React_2.PureComponent<
308
259
  ProfileCardTriggerProps,
309
260
  ProfileCardTriggerState
310
261
  > {
311
- // (undocumented)
312
- clientFetchProfile: () => void;
313
- // (undocumented)
314
- closeKudosDrawer: () => void;
315
- // (undocumented)
316
- componentDidMount(): void;
317
- // (undocumented)
318
- componentDidUpdate(prevProps: ProfileCardTriggerProps): void;
319
- // (undocumented)
320
- componentWillUnmount(): void;
321
- // (undocumented)
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;
322
271
  containerListeners:
323
272
  | {
324
273
  onMouseEnter: () => void;
@@ -330,55 +279,31 @@ export class ProfileCardTrigger extends React_2.PureComponent<
330
279
  onMouseEnter?: undefined;
331
280
  onMouseLeave?: undefined;
332
281
  };
333
- // (undocumented)
334
- static defaultProps: Partial<ProfileCardTriggerProps>;
335
- // (undocumented)
336
- filterActions(): ProfileCardAction[];
337
- // (undocumented)
338
- handleClientError(err: any): void;
339
- // (undocumented)
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;
340
291
  handleClientSuccess(
341
292
  profileData: ProfileCardClientData,
342
293
  reportingLinesData: TeamCentralReportingLinesData,
343
294
  shouldShowGiveKudos: boolean,
344
295
  ): void;
345
- // (undocumented)
346
- hideDelay: number;
347
- // (undocumented)
348
- hideProfilecard: () => void;
349
- // (undocumented)
350
- hideTimer: number;
351
- // (undocumented)
352
- _isMounted: boolean;
353
- // (undocumented)
354
- layerListeners: {
355
- handleClickOutside: () => void;
356
- handleEscapeKeydown: () => void;
357
- };
358
- // (undocumented)
359
- onClick: (event: React_2.MouseEvent) => void;
360
- // (undocumented)
296
+ handleClientError(err: any): void;
297
+ filterActions(): ProfileCardAction[];
298
+ renderProfileCard(): JSX.Element;
361
299
  openKudosDrawer: () => void;
362
- // (undocumented)
363
- render(): JSX.Element;
364
- // (undocumented)
300
+ closeKudosDrawer: () => void;
365
301
  renderCard: () => JSX.Element;
366
- // (undocumented)
367
- renderProfileCard(): JSX.Element;
368
- // (undocumented)
369
302
  renderWithTrigger(): JSX.Element;
370
- // (undocumented)
371
- showDelay: number;
372
- // (undocumented)
373
- showProfilecard: () => void;
374
- // (undocumented)
375
- showTimer: number;
376
- // (undocumented)
377
- state: ProfileCardTriggerState;
303
+ render(): JSX.Element;
378
304
  }
379
305
 
380
- // @public (undocumented)
381
- export type ProfilecardTriggerPosition =
306
+ export declare type ProfilecardTriggerPosition =
382
307
  | 'bottom-start'
383
308
  | 'bottom'
384
309
  | 'bottom-end'
@@ -392,99 +317,91 @@ export type ProfilecardTriggerPosition =
392
317
  | 'right'
393
318
  | 'right-start';
394
319
 
395
- // @public (undocumented)
396
- export interface ProfileCardTriggerProps {
397
- // (undocumented)
398
- actions?: ProfileCardAction[];
399
- // (undocumented)
400
- addFlag?: (flag: any) => void;
401
- // (undocumented)
402
- analytics?: any;
403
- // (undocumented)
404
- children?: React_2.ReactNode;
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
+ */
405
333
  cloudId?: string;
406
- // (undocumented)
334
+ resourceClient: ProfileClient_2;
335
+ actions?: ProfileCardAction[];
336
+ reportingLinesProfileUrl?: string;
407
337
  onReportingLinesClick?: (user: ReportingLinesUser) => void;
408
- // (undocumented)
338
+ analytics?: any;
409
339
  position?: ProfilecardTriggerPosition;
410
- // (undocumented)
411
- reportingLinesProfileUrl?: string;
412
- // (undocumented)
413
- resourceClient: ProfileClient_2;
414
- // (undocumented)
415
- testId?: string;
416
- // (undocumented)
417
340
  trigger?: TriggerType;
418
- // (undocumented)
419
- userId: string;
341
+ children?: React_2.ReactNode;
342
+ testId?: string;
343
+ addFlag?: (flag: any) => void;
420
344
  }
421
345
 
422
- // @public (undocumented)
423
- export interface ProfileCardTriggerState {
424
- // (undocumented)
425
- data: ProfileCardClientData | null;
426
- // (undocumented)
427
- error?: ProfileCardErrorType;
428
- // (undocumented)
429
- hasError: boolean;
430
- // (undocumented)
346
+ export declare interface ProfileCardTriggerState {
347
+ visible?: boolean;
431
348
  isLoading?: boolean;
432
- // (undocumented)
433
- kudosDrawerOpen: boolean;
434
- // (undocumented)
349
+ hasError: boolean;
350
+ error?: ProfileCardErrorType;
351
+ data: ProfileCardClientData | null;
435
352
  reportingLinesData?: TeamCentralReportingLinesData;
436
- // (undocumented)
437
353
  shouldShowGiveKudos?: boolean;
438
- // (undocumented)
439
354
  teamCentralBaseUrl?: string;
440
- // (undocumented)
441
- visible?: boolean;
355
+ kudosDrawerOpen: boolean;
442
356
  }
443
357
 
444
- // @public (undocumented)
445
- export class ProfileClient {
358
+ export declare class ProfileClient {
359
+ userClient: UserProfileClient;
360
+ teamClient: TeamProfileClient;
361
+ tcClient?: TeamCentralCardClient;
446
362
  constructor(config: ProfileClientOptions, clients?: ClientOverrides);
447
- // (undocumented)
448
363
  flushCache(): void;
449
- // (undocumented)
450
364
  getProfile(cloudId: string, userId: string): Promise<any>;
451
- // (undocumented)
452
- getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
453
- // (undocumented)
454
- getTeamCentralBaseUrl(): string | undefined;
455
- // (undocumented)
456
365
  getTeamProfile(
457
366
  teamId: string,
458
367
  orgId?: string,
459
368
  analytics?: (event: Record<string, any>) => void,
460
369
  ): Promise<Team>;
461
- // (undocumented)
370
+ getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
371
+ getTeamCentralBaseUrl(): string | undefined;
462
372
  shouldShowGiveKudos(): Promise<boolean>;
463
- // (undocumented)
464
- tcClient?: TeamCentralCardClient;
465
- // (undocumented)
466
- teamClient: TeamProfileClient;
467
- // (undocumented)
468
- userClient: UserProfileClient;
469
373
  }
470
374
 
471
- // @public (undocumented)
472
- export interface ProfileClientOptions {
473
- // (undocumented)
474
- cacheMaxAge?: number;
475
- // (undocumented)
476
- cacheSize?: number;
477
- // (undocumented)
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;
478
393
  gatewayGraphqlUrl?: string;
479
- productIdentifier?: string;
480
- teamCentralBaseUrl?: string;
394
+ cacheSize?: number;
395
+ cacheMaxAge?: number;
396
+ /** Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql*/
481
397
  teamCentralUrl?: string;
482
- // (undocumented)
483
- url: 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;
484
402
  }
485
403
 
486
- // @public (undocumented)
487
- export type RelativeDateKeyType =
404
+ export declare type RelativeDateKeyType =
488
405
  | 'ThisWeek'
489
406
  | 'ThisMonth'
490
407
  | 'LastMonth'
@@ -493,8 +410,18 @@ export type RelativeDateKeyType =
493
410
  | 'MoreThanAYear'
494
411
  | null;
495
412
 
496
- // @public (undocumented)
497
- export type StatusModifiedDateType =
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 =
498
425
  | 'noDate'
499
426
  | 'thisWeek'
500
427
  | 'thisMonth'
@@ -503,42 +430,126 @@ export type StatusModifiedDateType =
503
430
  | 'severalMonths'
504
431
  | 'moreThanAYear';
505
432
 
506
- // @public (undocumented)
507
- export type StatusType = 'active' | 'inactive' | 'closed';
433
+ export declare type StatusType = 'active' | 'inactive' | 'closed';
508
434
 
509
- // @public (undocumented)
510
- export interface Team {
511
- // (undocumented)
512
- description: string;
513
- // (undocumented)
514
- displayName: string;
515
- // (undocumented)
516
- id: string;
517
- // (undocumented)
435
+ export declare interface Team {
518
436
  largeAvatarImageUrl?: string;
519
- // (undocumented)
437
+ smallAvatarImageUrl?: string;
520
438
  largeHeaderImageUrl?: string;
521
- // (undocumented)
439
+ smallHeaderImageUrl?: string;
440
+ id: string;
441
+ displayName: string;
442
+ description: string;
443
+ organizationId?: string;
522
444
  members?: {
523
445
  id: string;
524
446
  fullName: string;
525
447
  avatarUrl: string;
526
448
  }[];
527
- // (undocumented)
528
- organizationId?: string;
529
- // (undocumented)
530
- smallAvatarImageUrl?: string;
531
- // (undocumented)
532
- smallHeaderImageUrl?: string;
533
449
  }
534
450
 
535
- // @public (undocumented)
536
- export const TeamProfileCard: (
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: (
537
489
  props: TeamProfilecardProps,
538
490
  ) => JSX.Element | null;
539
491
 
540
- // @public (undocumented)
541
- export const TeamProfileCardTrigger: React_2.ForwardRefExoticComponent<
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<
542
553
  Pick<
543
554
  Omit<
544
555
  TeamProfileCardTriggerProps & {
@@ -563,52 +574,106 @@ export const TeamProfileCardTrigger: React_2.ForwardRefExoticComponent<
563
574
  React_2.RefAttributes<any>
564
575
  >;
565
576
 
566
- // @public (undocumented)
567
- export class TeamProfileClient extends CachingClient<Team> {
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;
568
647
  constructor(options: ProfileClientOptions);
569
- // (undocumented)
570
- getProfile(
648
+ makeRequestViaGateway(
571
649
  teamId: string,
572
- orgId: string | undefined,
573
- analytics?: (event: Record<string, any>) => void,
650
+ _orgId: string | undefined,
574
651
  ): Promise<Team>;
575
- // (undocumented)
576
652
  makeRequest(teamId: string, orgId: string | undefined): Promise<Team>;
577
- // (undocumented)
578
- makeRequestViaGateway(
653
+ getProfile(
579
654
  teamId: string,
580
- _orgId: string | undefined,
655
+ orgId: string | undefined,
656
+ analytics?: (event: Record<string, any>) => void,
581
657
  ): Promise<Team>;
582
- // (undocumented)
583
- options: ProfileClientOptions;
584
658
  }
585
659
 
586
- // @public (undocumented)
587
- export type TriggerType = 'hover' | 'click';
660
+ export declare type TriggerType = 'hover' | 'click';
588
661
 
589
- // @public (undocumented)
590
- export class UserProfileClient extends CachingClient<any> {
662
+ export declare class UserProfileClient extends CachingClient<any> {
663
+ options: ProfileClientOptions;
591
664
  constructor(options: ProfileClientOptions);
592
- // (undocumented)
593
- getProfile(cloudId: string, userId: string): Promise<any>;
594
- // (undocumented)
595
665
  makeRequest(cloudId: string, userId: string): Promise<ProfileCardClientData>;
596
- // (undocumented)
597
- options: ProfileClientOptions;
666
+ getProfile(cloudId: string, userId: string): Promise<any>;
598
667
  }
599
668
 
600
- // @public (undocumented)
601
- export function withOuterListeners<P>(
669
+ export declare function withOuterListeners<P>(
602
670
  Component: ComponentType<P>,
603
671
  ): React_2.ComponentClass<P & WithOuterListenersProps>;
604
672
 
605
- // @public (undocumented)
606
- export interface WithOuterListenersProps {
607
- // (undocumented)
673
+ export declare interface WithOuterListenersProps {
608
674
  handleClickOutside?: () => void;
609
- // (undocumented)
610
675
  handleEscapeKeydown?: () => void;
611
676
  }
612
677
 
613
- // (No @packageDocumentation comment for this package)
678
+ export {};
614
679
  ```