@atlaskit/profilecard
Version:
A React component to display a card with user information.
85 lines • 4.38 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
import ProfileCardClient from '../client/ProfileCardClient';
import RovoAgentCardClient from '../client/RovoAgentCardClient';
import TeamProfileCardClient from '../client/TeamProfileCardClient';
import UserProfileCardClient from '../client/UserProfileCardClient';
import agentData, { agentAggData } from './agent-data';
import profiles from './profile-data';
import teamData from './team-data';
import { getTimeString, getWeekday } from './util';
var SimpleMockTeamClient = /*#__PURE__*/function (_TeamProfileCardClien) {
function SimpleMockTeamClient() {
_classCallCheck(this, SimpleMockTeamClient);
return _callSuper(this, SimpleMockTeamClient, arguments);
}
_inherits(SimpleMockTeamClient, _TeamProfileCardClien);
return _createClass(SimpleMockTeamClient, [{
key: "makeRequest",
value: function makeRequest(teamId) {
var simpleMockTeam = teamData({
members: 5
});
return Promise.resolve(_objectSpread({
teamId: teamId
}, simpleMockTeam));
}
}]);
}(TeamProfileCardClient);
var SimpleMockUserClient = /*#__PURE__*/function (_UserProfileCardClien) {
function SimpleMockUserClient() {
_classCallCheck(this, SimpleMockUserClient);
return _callSuper(this, SimpleMockUserClient, arguments);
}
_inherits(SimpleMockUserClient, _UserProfileCardClien);
return _createClass(SimpleMockUserClient, [{
key: "makeRequest",
value: function makeRequest(cloudId, userId) {
var profile = profiles[0];
var weekday = getWeekday();
var data = _objectSpread({}, profile);
data.remoteTimeString = getTimeString();
data.remoteWeekdayIndex = weekday.index;
data.remoteWeekdayString = weekday.string;
return Promise.resolve(data);
}
}]);
}(UserProfileCardClient);
var SimpleMockAgentClient = /*#__PURE__*/function (_RovoAgentCardClient) {
function SimpleMockAgentClient() {
_classCallCheck(this, SimpleMockAgentClient);
return _callSuper(this, SimpleMockAgentClient, arguments);
}
_inherits(SimpleMockAgentClient, _RovoAgentCardClient);
return _createClass(SimpleMockAgentClient, [{
key: "makeRequest",
value: function makeRequest(id) {
return Promise.resolve({
restData: agentData,
aggData: agentAggData
});
}
}]);
}(RovoAgentCardClient);
var args = {
cacheSize: 10,
maxCacheAge: 0,
url: '/graphql/directory',
gatewayGraphqlUrl: '/gateway/api/graphql'
};
export var simpleMockUserClient = new SimpleMockUserClient(args);
export var simpleMockTeamClient = new SimpleMockTeamClient(args);
export var simpleMockAgentClient = new SimpleMockAgentClient(args);
export var simpleProfileClient = new ProfileCardClient(args, {
userClient: simpleMockUserClient,
teamClient: simpleMockTeamClient,
rovoAgentClient: simpleMockAgentClient
});