@atlaskit/profilecard 16.1.0 → 16.2.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,11 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 16.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`4039320b130`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4039320b130) - Support lazy loading in the ProfileCardTrigger component
8
+
3
9
  ## 16.1.0
4
10
 
5
11
  ### Minor Changes
@@ -16,10 +16,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (0, _typeof2.default)(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
18
  var TeamProfileCardLazy = /*#__PURE__*/(0, _react.lazy)(function () {
19
- return (// eslint-disable-next-line import/dynamic-import-chunkname
20
- Promise.resolve().then(function () {
21
- return _interopRequireWildcard(require('./TeamProfileCard'));
22
- })
23
- );
19
+ return Promise.resolve().then(function () {
20
+ return _interopRequireWildcard(require('./TeamProfileCard'));
21
+ });
24
22
  });
25
23
  exports.TeamProfileCardLazy = TeamProfileCardLazy;
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -25,7 +27,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
25
27
 
26
28
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
29
 
28
- var _react = _interopRequireDefault(require("react"));
30
+ var _react = _interopRequireWildcard(require("react"));
29
31
 
30
32
  var _popup = _interopRequireDefault(require("@atlaskit/popup"));
31
33
 
@@ -37,10 +39,14 @@ var _Card = require("../../styled/Card");
37
39
 
38
40
  var _config = require("../../util/config");
39
41
 
40
- var _ProfileCard = _interopRequireDefault(require("./ProfileCard"));
42
+ var _lazyProfileCard = require("./lazyProfileCard");
41
43
 
42
44
  var _UserLoadingState = _interopRequireDefault(require("./UserLoadingState"));
43
45
 
46
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
+
48
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
+
44
50
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
45
51
 
46
52
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -221,12 +227,14 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
221
227
  onMouseEnter: this.showProfilecard,
222
228
  onMouseLeave: this.hideProfilecard
223
229
  } : {};
224
- return /*#__PURE__*/_react.default.createElement("div", wrapperProps, /*#__PURE__*/_react.default.createElement(_ProfileCard.default, (0, _extends2.default)({}, newProps, {
230
+ return /*#__PURE__*/_react.default.createElement("div", wrapperProps, this.state.visible && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
231
+ fallback: null
232
+ }, /*#__PURE__*/_react.default.createElement(_lazyProfileCard.ProfileCardLazy, (0, _extends2.default)({}, newProps, {
225
233
  actions: this.filterActions(),
226
234
  hasError: this.state.hasError,
227
235
  errorType: this.state.error,
228
236
  withoutElevation: true
229
- })));
237
+ }))));
230
238
  }
231
239
  }, {
232
240
  key: "renderWithTrigger",
@@ -17,33 +17,19 @@ Object.defineProperty(exports, "DELAY_MS_SHOW", {
17
17
  return _config.DELAY_MS_SHOW;
18
18
  }
19
19
  });
20
- Object.defineProperty(exports, "ProfileCard", {
20
+ Object.defineProperty(exports, "ProfileCardLazy", {
21
21
  enumerable: true,
22
22
  get: function get() {
23
- return _ProfileCard.default;
24
- }
25
- });
26
- Object.defineProperty(exports, "ProfileCardResourced", {
27
- enumerable: true,
28
- get: function get() {
29
- return _ProfileCardResourced.default;
30
- }
31
- });
32
- Object.defineProperty(exports, "ProfileCardTrigger", {
33
- enumerable: true,
34
- get: function get() {
35
- return _ProfileCardTrigger.default;
23
+ return _lazyProfileCard.ProfileCardLazy;
36
24
  }
37
25
  });
38
26
  exports.default = void 0;
39
27
 
40
28
  var _config = require("../../util/config");
41
29
 
42
- var _ProfileCard = _interopRequireDefault(require("./ProfileCard"));
30
+ var _lazyProfileCard = require("./lazyProfileCard");
43
31
 
44
32
  var _ProfileCardTrigger = _interopRequireDefault(require("./ProfileCardTrigger"));
45
33
 
46
- var _ProfileCardResourced = _interopRequireDefault(require("./ProfileCardResourced"));
47
-
48
34
  var _default = _ProfileCardTrigger.default;
49
35
  exports.default = _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ProfileCardLazy = void 0;
9
+
10
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
+
12
+ var _react = require("react");
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (0, _typeof2.default)(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ var ProfileCardLazy = /*#__PURE__*/(0, _react.lazy)(function () {
19
+ return Promise.resolve().then(function () {
20
+ return _interopRequireWildcard(require('./ProfileCard'));
21
+ });
22
+ });
23
+ exports.ProfileCardLazy = ProfileCardLazy;
package/dist/cjs/index.js CHANGED
@@ -103,7 +103,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
103
103
  // importing directly from @atlaskit/profilecard.
104
104
  // Note: when generating and updating Flow types in Jira, `TeamProfileClient` and `TeamProfileCardClient` are the same type
105
105
  // Note: when generating and updating Flow types in Jira, `UserProfileClient` and `UserProfileCardClient` are the same type
106
- // Do not export TeamProfileCard here as it will break lazy-loading for the team trigger.
107
106
  // Legacy Profile Card in Jira still needs to use `withOuterListeners`
108
107
  // We cannot export this component inside `./components/Team/index.ts` because it breaks the lazyload
109
108
  // so we have to export this here. `TeamProfileCard` helps to build legacy team profile card inside Jira FE.
@@ -31,7 +31,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
31
31
  actionSubjectId: actionSubjectId,
32
32
  attributes: _objectSpread(_objectSpread({
33
33
  packageName: "@atlaskit/profilecard",
34
- packageVersion: "16.1.0"
34
+ packageVersion: "16.2.0"
35
35
  }, attributes), {}, {
36
36
  firedAt: (0, _performance.getPageTime)()
37
37
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.1.0"
3
+ "version": "16.2.0"
4
4
  }
@@ -1,5 +1,4 @@
1
1
  import { lazy } from 'react';
2
- export const TeamProfileCardLazy = /*#__PURE__*/lazy(() => // eslint-disable-next-line import/dynamic-import-chunkname
3
- import(
4
- /* webpackChunkName:"lazy-team-profilecard" */
2
+ export const TeamProfileCardLazy = /*#__PURE__*/lazy(() => import(
3
+ /* webpackChunkName: "@atlaskit-internal_lazy-team-profilecard" */
5
4
  './TeamProfileCard'));
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React from 'react';
3
+ import React, { Suspense } from 'react';
4
4
  import Popup from '@atlaskit/popup';
5
5
  import { layers } from '@atlaskit/theme/constants';
6
6
  import filterActions from '../../internal/filterActions';
7
7
  import { CardWrapper } from '../../styled/Card';
8
8
  import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
9
- import Profilecard from './ProfileCard';
9
+ import { ProfileCardLazy } from './lazyProfileCard';
10
10
  import UserLoadingState from './UserLoadingState';
11
11
 
12
12
  class ProfilecardTrigger extends React.PureComponent {
@@ -172,12 +172,14 @@ class ProfilecardTrigger extends React.PureComponent {
172
172
  onMouseEnter: this.showProfilecard,
173
173
  onMouseLeave: this.hideProfilecard
174
174
  } : {};
175
- return /*#__PURE__*/React.createElement("div", wrapperProps, /*#__PURE__*/React.createElement(Profilecard, _extends({}, newProps, {
175
+ return /*#__PURE__*/React.createElement("div", wrapperProps, this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
176
+ fallback: null
177
+ }, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({}, newProps, {
176
178
  actions: this.filterActions(),
177
179
  hasError: this.state.hasError,
178
180
  errorType: this.state.error,
179
181
  withoutElevation: true
180
- })));
182
+ }))));
181
183
  }
182
184
 
183
185
  renderWithTrigger() {
@@ -1,6 +1,4 @@
1
- import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
2
- import ProfileCard from './ProfileCard';
1
+ export { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
2
+ export { ProfileCardLazy } from './lazyProfileCard';
3
3
  import ProfileCardTrigger from './ProfileCardTrigger';
4
- export { DELAY_MS_HIDE, DELAY_MS_SHOW, ProfileCard, ProfileCardTrigger };
5
- export { default as ProfileCardResourced } from './ProfileCardResourced';
6
4
  export default ProfileCardTrigger;
@@ -0,0 +1,4 @@
1
+ import { lazy } from 'react';
2
+ export const ProfileCardLazy = /*#__PURE__*/lazy(() => import(
3
+ /* webpackChunkName: "@atlaskit-internal_lazy-profilecard" */
4
+ './ProfileCard'));
@@ -8,8 +8,7 @@ import UserProfileClient, { modifyResponse } from './client/UserProfileCardClien
8
8
  import TeamProfileCardTrigger from './components/Team/TeamProfileCardTrigger';
9
9
  import ProfileCard from './components/User/ProfileCard';
10
10
  import ProfileCardResourced from './components/User/ProfileCardResourced';
11
- import ProfileCardTrigger from './components/User/ProfileCardTrigger'; // Do not export TeamProfileCard here as it will break lazy-loading for the team trigger.
12
-
11
+ import ProfileCardTrigger from './components/User/ProfileCardTrigger';
13
12
  import { DELAY_MS_HIDE, DELAY_MS_SHOW } from './util/config'; // Legacy Profile Card in Jira still needs to use `withOuterListeners`
14
13
 
15
14
  export { default as withOuterListeners } from './util/withOuterListeners';
@@ -11,7 +11,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
11
11
  actionSubjectId,
12
12
  attributes: {
13
13
  packageName: "@atlaskit/profilecard",
14
- packageVersion: "16.1.0",
14
+ packageVersion: "16.2.0",
15
15
  ...attributes,
16
16
  firedAt: getPageTime()
17
17
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.1.0"
3
+ "version": "16.2.0"
4
4
  }
@@ -1,8 +1,6 @@
1
1
  import { lazy } from 'react';
2
2
  export var TeamProfileCardLazy = /*#__PURE__*/lazy(function () {
3
- return (// eslint-disable-next-line import/dynamic-import-chunkname
4
- import(
5
- /* webpackChunkName:"lazy-team-profilecard" */
6
- './TeamProfileCard')
7
- );
3
+ return import(
4
+ /* webpackChunkName: "@atlaskit-internal_lazy-team-profilecard" */
5
+ './TeamProfileCard');
8
6
  });
@@ -16,13 +16,13 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
16
16
 
17
17
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
18
18
 
19
- import React from 'react';
19
+ import React, { Suspense } from 'react';
20
20
  import Popup from '@atlaskit/popup';
21
21
  import { layers } from '@atlaskit/theme/constants';
22
22
  import _filterActions from '../../internal/filterActions';
23
23
  import { CardWrapper } from '../../styled/Card';
24
24
  import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
25
- import Profilecard from './ProfileCard';
25
+ import { ProfileCardLazy } from './lazyProfileCard';
26
26
  import UserLoadingState from './UserLoadingState';
27
27
 
28
28
  var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
@@ -210,12 +210,14 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
210
210
  onMouseEnter: this.showProfilecard,
211
211
  onMouseLeave: this.hideProfilecard
212
212
  } : {};
213
- return /*#__PURE__*/React.createElement("div", wrapperProps, /*#__PURE__*/React.createElement(Profilecard, _extends({}, newProps, {
213
+ return /*#__PURE__*/React.createElement("div", wrapperProps, this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
214
+ fallback: null
215
+ }, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({}, newProps, {
214
216
  actions: this.filterActions(),
215
217
  hasError: this.state.hasError,
216
218
  errorType: this.state.error,
217
219
  withoutElevation: true
218
- })));
220
+ }))));
219
221
  }
220
222
  }, {
221
223
  key: "renderWithTrigger",
@@ -1,6 +1,4 @@
1
- import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
2
- import ProfileCard from './ProfileCard';
1
+ export { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
2
+ export { ProfileCardLazy } from './lazyProfileCard';
3
3
  import ProfileCardTrigger from './ProfileCardTrigger';
4
- export { DELAY_MS_HIDE, DELAY_MS_SHOW, ProfileCard, ProfileCardTrigger };
5
- export { default as ProfileCardResourced } from './ProfileCardResourced';
6
4
  export default ProfileCardTrigger;
@@ -0,0 +1,6 @@
1
+ import { lazy } from 'react';
2
+ export var ProfileCardLazy = /*#__PURE__*/lazy(function () {
3
+ return import(
4
+ /* webpackChunkName: "@atlaskit-internal_lazy-profilecard" */
5
+ './ProfileCard');
6
+ });
package/dist/esm/index.js CHANGED
@@ -8,8 +8,7 @@ import UserProfileClient, { modifyResponse } from './client/UserProfileCardClien
8
8
  import TeamProfileCardTrigger from './components/Team/TeamProfileCardTrigger';
9
9
  import ProfileCard from './components/User/ProfileCard';
10
10
  import ProfileCardResourced from './components/User/ProfileCardResourced';
11
- import ProfileCardTrigger from './components/User/ProfileCardTrigger'; // Do not export TeamProfileCard here as it will break lazy-loading for the team trigger.
12
-
11
+ import ProfileCardTrigger from './components/User/ProfileCardTrigger';
13
12
  import { DELAY_MS_HIDE, DELAY_MS_SHOW } from './util/config'; // Legacy Profile Card in Jira still needs to use `withOuterListeners`
14
13
 
15
14
  export { default as withOuterListeners } from './util/withOuterListeners';
@@ -19,7 +19,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
19
19
  actionSubjectId: actionSubjectId,
20
20
  attributes: _objectSpread(_objectSpread({
21
21
  packageName: "@atlaskit/profilecard",
22
- packageVersion: "16.1.0"
22
+ packageVersion: "16.2.0"
23
23
  }, attributes), {}, {
24
24
  firedAt: getPageTime()
25
25
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.1.0"
3
+ "version": "16.2.0"
4
4
  }
@@ -1,6 +1,4 @@
1
- import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
2
- import ProfileCard from './ProfileCard';
1
+ export { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
2
+ export { ProfileCardLazy } from './lazyProfileCard';
3
3
  import ProfileCardTrigger from './ProfileCardTrigger';
4
- export { DELAY_MS_HIDE, DELAY_MS_SHOW, ProfileCard, ProfileCardTrigger };
5
- export { default as ProfileCardResourced } from './ProfileCardResourced';
6
4
  export default ProfileCardTrigger;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ProfileCardLazy: import("react").LazyExoticComponent<typeof import("./ProfileCard").default>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.1.0",
3
+ "version": "16.2.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": "^20.5.0",
43
43
  "@atlaskit/avatar-group": "^8.3.0",
44
44
  "@atlaskit/button": "^16.0.0",
45
- "@atlaskit/icon": "^21.9.0",
45
+ "@atlaskit/icon": "^21.10.0",
46
46
  "@atlaskit/lozenge": "^11.0.0",
47
47
  "@atlaskit/menu": "^1.2.0",
48
- "@atlaskit/popup": "^1.2.0",
48
+ "@atlaskit/popup": "^1.3.0",
49
49
  "@atlaskit/spinner": "^15.0.0",
50
- "@atlaskit/theme": "^12.0.0",
50
+ "@atlaskit/theme": "^12.1.0",
51
51
  "@atlaskit/tokens": "^0.4.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "date-fns": "^2.17.0",