@atlaskit/util-data-test 17.0.0 → 17.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/cjs/emoji/emoji-repository-usage-clear.js +1 -1
- package/dist/cjs/emoji-constants/index.js +1 -1
- package/dist/cjs/emoji-test/emoji-samples.js +1 -1
- package/dist/cjs/emoji-test/media-emoji.js +1 -1
- package/dist/cjs/json-data/emoji-all.json +3 -0
- package/dist/cjs/json-data/user-picker-data.json +9 -0
- package/dist/cjs/logger.js +1 -1
- package/dist/cjs/mention/mention-story-data.js +1 -1
- package/dist/cjs/mention/mention-test-data.js +1 -1
- package/dist/cjs/mention/presence-data.js +1 -1
- package/dist/cjs/profilecard/get-mock-profilecard-client.js +97 -27
- package/dist/cjs/profilecard/util.js +1 -1
- package/dist/cjs/slack-data/index.js +4 -4
- package/dist/cjs/task-decision/task-decision-story-data.js +1 -1
- package/dist/cjs/task-decision/utils.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/json-data/emoji-all.json +3 -0
- package/dist/es2019/json-data/user-picker-data.json +9 -0
- package/dist/es2019/profilecard/get-mock-profilecard-client.js +56 -26
- package/dist/es2019/version.json +1 -1
- package/dist/esm/json-data/emoji-all.json +3 -0
- package/dist/esm/json-data/user-picker-data.json +9 -0
- package/dist/esm/profilecard/get-mock-profilecard-client.js +93 -24
- package/dist/esm/version.json +1 -1
- package/dist/types/json-data/emoji-all.json +3 -0
- package/dist/types/json-data/user-picker-data.json +9 -0
- package/dist/types/profilecard/get-mock-profilecard-client.d.ts +2 -4
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/util-data-test
|
|
2
2
|
|
|
3
|
+
## 17.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1d343f094cc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1d343f094cc) - created new mock profile client function with types
|
|
8
|
+
|
|
9
|
+
## 17.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`a5c73ccaa58`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5c73ccaa58) - Added manager and direct reports section to profile hover card"
|
|
14
|
+
|
|
15
|
+
## 17.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`c55c736ecea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c55c736ecea) - Patch VULN AFP-3486 AFP-3487 AFP-3488 AFP-3489
|
|
20
|
+
|
|
21
|
+
## 17.0.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 17.0.0
|
|
4
28
|
|
|
5
29
|
### Major Changes
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.isUsageClearEmojiRepository = exports.EmojiRepositoryUsageClear = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.selectedToneStorageKey = exports.mediaEmojiImagePath = exports.mediaEmojiAlternateImagePath = exports.mediaBaseUrl = exports.customType = exports.customCategory = void 0;
|
|
7
7
|
// Copy of constants from @atlaskit/emoji
|
|
8
8
|
// NOTE: if this is changed in the original package, this must also be modified
|
|
9
9
|
var customType = 'SITE';
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.thumbsupEmoji = exports.thumbsdownEmoji = exports.standardBoomEmoji = exports.smileyEmoji = exports.openMouthEmoji = exports.grinEmoji = exports.evilburnsEmoji = exports.congoFlagEmoji = exports.blackFlagEmoji = exports.atlassianBoomEmoji = void 0;
|
|
9
9
|
|
|
10
10
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.mediaEmojiId = exports.mediaEmoji = void 0;
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
@@ -54311,6 +54311,9 @@
|
|
|
54311
54311
|
"height": 64,
|
|
54312
54312
|
"width": 64
|
|
54313
54313
|
},
|
|
54314
|
+
"ascii": [
|
|
54315
|
+
"(#)"
|
|
54316
|
+
],
|
|
54314
54317
|
"searchable": true,
|
|
54315
54318
|
"shortName": ":note:"
|
|
54316
54319
|
},
|
|
@@ -338,5 +338,14 @@
|
|
|
338
338
|
"type": "user",
|
|
339
339
|
"isExternal": true,
|
|
340
340
|
"sources": ["github"]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"id": "external-5",
|
|
344
|
+
"name": "Dorian",
|
|
345
|
+
"email": "Dorian@email.com",
|
|
346
|
+
"avatarUrl": "https://ptc-directory-sited-static.us-east-1.staging.public.atl-paas.net/teams/avatars/4.svg",
|
|
347
|
+
"type": "user",
|
|
348
|
+
"isExternal": true,
|
|
349
|
+
"sources": []
|
|
341
350
|
}
|
|
342
351
|
]
|
package/dist/cjs/logger.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = debug;
|
|
6
7
|
exports.enableLogger = enableLogger;
|
|
7
8
|
exports.enableStacktraces = enableStacktraces;
|
|
8
9
|
exports.logStacktrace = logStacktrace;
|
|
9
|
-
exports.default = debug;
|
|
10
10
|
// Duplicate or utils/logger.ts from elements packages
|
|
11
11
|
var debugEnabled = false;
|
|
12
12
|
var stacktracesEnabled = false;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.mentions = exports.mentionSlowResourceProvider = exports.mentionSampleAvatarUrl = exports.mentionResourceProviderWithTeamMentionHighlight = exports.mentionResourceProviderWithResolver2 = exports.mentionResourceProviderWithResolver = exports.mentionResourceProviderWithInviteFromMentionExperiment = exports.mentionResourceProviderWithInfoHints = exports.mentionResourceProvider = void 0;
|
|
7
7
|
|
|
8
8
|
var _mockMentionResource = require("./mock-mention-resource");
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.mentionTestResult = exports.mentionTestDataSize = exports.mentionTestData = void 0;
|
|
7
7
|
|
|
8
8
|
var mentionTestData = require('../json-data/mention-data.json'); // MentionsResult
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.validPresenceData = exports.invalidPresenceData = void 0;
|
|
7
7
|
|
|
8
8
|
var validPresenceData = require('../json-data/presence-valid-info.json');
|
|
9
9
|
|
|
@@ -6,7 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.getMockProfilecardClient = getMockProfilecardClient;
|
|
9
|
-
exports.simpleMockProfilecardClient =
|
|
9
|
+
exports.simpleMockProfilecardClient = simpleMockProfilecardClient;
|
|
10
|
+
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
14
|
|
|
11
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
16
|
|
|
@@ -20,6 +24,8 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
20
24
|
|
|
21
25
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
22
26
|
|
|
27
|
+
var _profilecard = require("@atlaskit/profilecard");
|
|
28
|
+
|
|
23
29
|
var _profilecardData = require("./profilecard-data");
|
|
24
30
|
|
|
25
31
|
var _util = require("./util");
|
|
@@ -82,41 +88,105 @@ function getMockProfilecardClient(BaseProfileClient, modifyResponse) {
|
|
|
82
88
|
}(BaseProfileClient);
|
|
83
89
|
}
|
|
84
90
|
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var matchError = userId.match(/^error:([0-9a-zA-Z\-]+)$/);
|
|
89
|
-
var error = matchError && matchError[1];
|
|
91
|
+
var getMockProfile = function getMockProfile(userId) {
|
|
92
|
+
var matchError = userId.match(/^error:([0-9a-zA-Z\-]+)$/);
|
|
93
|
+
var error = matchError && matchError[1];
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
if (error) {
|
|
96
|
+
return Promise.reject({
|
|
97
|
+
reason: 'error'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
var profile = _profilecardData.profilecardData[parseInt(userId, 10)];
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
if (!profile) {
|
|
104
|
+
return Promise.reject({
|
|
105
|
+
reason: 'default'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var weekday = (0, _util.getWeekday)();
|
|
110
|
+
|
|
111
|
+
var data = _objectSpread({}, profile);
|
|
104
112
|
|
|
105
|
-
|
|
113
|
+
data.remoteTimeString = (0, _util.getTimeString)();
|
|
114
|
+
data.remoteWeekdayIndex = weekday.index;
|
|
115
|
+
data.remoteWeekdayString = weekday.string;
|
|
116
|
+
return Promise.resolve(data);
|
|
117
|
+
}; // TODO: This function will replace getMockProfilecardClient() on line 13 once the latest `master` branch containing this code has been merged to `develop`
|
|
106
118
|
|
|
107
|
-
var data = _objectSpread({}, profile);
|
|
108
119
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return
|
|
120
|
+
function simpleMockProfilecardClient() {
|
|
121
|
+
return {
|
|
122
|
+
flushCache: function flushCache() {
|
|
123
|
+
return undefined;
|
|
113
124
|
},
|
|
114
|
-
|
|
125
|
+
getProfile: function () {
|
|
126
|
+
var _getProfile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_cloudId, userId) {
|
|
127
|
+
var timeout;
|
|
128
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
129
|
+
while (1) {
|
|
130
|
+
switch (_context2.prev = _context2.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
timeout = (0, _util.random)(1500) + 500;
|
|
133
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
134
|
+
window.setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
135
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
136
|
+
while (1) {
|
|
137
|
+
switch (_context.prev = _context.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
getMockProfile(userId).then(function (data) {
|
|
140
|
+
return resolve((0, _profilecard.modifyResponse)(data));
|
|
141
|
+
}).catch(function (error) {
|
|
142
|
+
return reject(error);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
case 1:
|
|
146
|
+
case "end":
|
|
147
|
+
return _context.stop();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, _callee);
|
|
151
|
+
})), timeout);
|
|
152
|
+
}));
|
|
153
|
+
|
|
154
|
+
case 2:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context2.stop();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, _callee2);
|
|
160
|
+
}));
|
|
161
|
+
|
|
162
|
+
function getProfile(_x, _x2) {
|
|
163
|
+
return _getProfile.apply(this, arguments);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return getProfile;
|
|
167
|
+
}(),
|
|
168
|
+
getTeamProfile: function getTeamProfile(_teamId, _orgId, _analytics) {
|
|
115
169
|
return Promise.reject({
|
|
116
170
|
reason: 'not built yet'
|
|
117
171
|
});
|
|
172
|
+
},
|
|
173
|
+
getReportingLines: function getReportingLines(_userId) {
|
|
174
|
+
var reportingLinesUsers = _profilecardData.profilecardData.map(function (user, index) {
|
|
175
|
+
return {
|
|
176
|
+
accountIdentifier: '123456:12345-67890-' + index,
|
|
177
|
+
identifierType: 'ATLASSIAN_ID',
|
|
178
|
+
pii: {
|
|
179
|
+
name: user.User.fullName,
|
|
180
|
+
picture: user.User.avatarUrl
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
var halfCount = Math.ceil(reportingLinesUsers.length / 2);
|
|
186
|
+
return Promise.resolve({
|
|
187
|
+
managers: reportingLinesUsers.slice(0, halfCount),
|
|
188
|
+
reports: reportingLinesUsers.slice(-halfCount)
|
|
189
|
+
});
|
|
118
190
|
}
|
|
119
191
|
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
exports.simpleMockProfilecardClient = simpleMockProfilecardClient;
|
|
192
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.random = exports.getWeekday = exports.getTimeString = void 0;
|
|
7
7
|
|
|
8
8
|
// String.prototype.padStart is the thing which should be used here
|
|
9
9
|
// unfortunately we're using too old TS compiler which doesn't have "es2017.string" lib
|
|
@@ -5,16 +5,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
Object.defineProperty(exports, "
|
|
8
|
+
Object.defineProperty(exports, "slackConversationsData", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
11
|
-
return
|
|
11
|
+
return _slackConversationsData.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "slackWorkspacesData", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function get() {
|
|
17
|
-
return
|
|
17
|
+
return _slackWorkspacesData.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.participants = exports.getServiceTasksResponse = exports.getParticipants = exports.getMockTaskDecisionResource = exports.document = void 0;
|
|
7
7
|
|
|
8
8
|
var _mockTaskDecisionResource = require("./mock-task-decision-resource");
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.toggleTaskState = exports.objectKeyToString = exports.findIndex = void 0;
|
|
7
7
|
|
|
8
8
|
// Copy of helper functions from @atlaskit/task-decision
|
|
9
9
|
// NOTE: if this is changed in the original package, this must also be modified
|
package/dist/cjs/version.json
CHANGED
|
@@ -54311,6 +54311,9 @@
|
|
|
54311
54311
|
"height": 64,
|
|
54312
54312
|
"width": 64
|
|
54313
54313
|
},
|
|
54314
|
+
"ascii": [
|
|
54315
|
+
"(#)"
|
|
54316
|
+
],
|
|
54314
54317
|
"searchable": true,
|
|
54315
54318
|
"shortName": ":note:"
|
|
54316
54319
|
},
|
|
@@ -338,5 +338,14 @@
|
|
|
338
338
|
"type": "user",
|
|
339
339
|
"isExternal": true,
|
|
340
340
|
"sources": ["github"]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"id": "external-5",
|
|
344
|
+
"name": "Dorian",
|
|
345
|
+
"email": "Dorian@email.com",
|
|
346
|
+
"avatarUrl": "https://ptc-directory-sited-static.us-east-1.staging.public.atl-paas.net/teams/avatars/4.svg",
|
|
347
|
+
"type": "user",
|
|
348
|
+
"isExternal": true,
|
|
349
|
+
"sources": []
|
|
341
350
|
}
|
|
342
351
|
]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { modifyResponse } from '@atlaskit/profilecard';
|
|
1
2
|
import { profilecardData } from './profilecard-data';
|
|
2
3
|
import { random, getWeekday, getTimeString } from './util';
|
|
3
4
|
export function getMockProfilecardClient(BaseProfileClient, modifyResponse) {
|
|
@@ -36,36 +37,65 @@ export function getMockProfilecardClient(BaseProfileClient, modifyResponse) {
|
|
|
36
37
|
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
|
-
export const simpleMockProfilecardClient = modifyResponse => ({
|
|
40
|
-
getProfile: (cloudId, userId) => {
|
|
41
|
-
const matchError = userId.match(/^error:([0-9a-zA-Z\-]+)$/);
|
|
42
|
-
const error = matchError && matchError[1];
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
}
|
|
41
|
+
const getMockProfile = userId => {
|
|
42
|
+
const matchError = userId.match(/^error:([0-9a-zA-Z\-]+)$/);
|
|
43
|
+
const error = matchError && matchError[1];
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
if (error) {
|
|
46
|
+
return Promise.reject({
|
|
47
|
+
reason: 'error'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
return Promise.reject({
|
|
54
|
-
reason: 'default'
|
|
55
|
-
});
|
|
56
|
-
}
|
|
51
|
+
const profile = profilecardData[parseInt(userId, 10)];
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
const data = { ...profile
|
|
60
|
-
};
|
|
61
|
-
data.remoteTimeString = getTimeString();
|
|
62
|
-
data.remoteWeekdayIndex = weekday.index;
|
|
63
|
-
data.remoteWeekdayString = weekday.string;
|
|
64
|
-
return Promise.resolve(modifyResponse(data));
|
|
65
|
-
},
|
|
66
|
-
getTeamProfile: (orgId, teamId, analytics) => {
|
|
53
|
+
if (!profile) {
|
|
67
54
|
return Promise.reject({
|
|
68
|
-
reason: '
|
|
55
|
+
reason: 'default'
|
|
69
56
|
});
|
|
70
57
|
}
|
|
71
|
-
|
|
58
|
+
|
|
59
|
+
const weekday = getWeekday();
|
|
60
|
+
const data = { ...profile
|
|
61
|
+
};
|
|
62
|
+
data.remoteTimeString = getTimeString();
|
|
63
|
+
data.remoteWeekdayIndex = weekday.index;
|
|
64
|
+
data.remoteWeekdayString = weekday.string;
|
|
65
|
+
return Promise.resolve(data);
|
|
66
|
+
}; // TODO: This function will replace getMockProfilecardClient() on line 13 once the latest `master` branch containing this code has been merged to `develop`
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export function simpleMockProfilecardClient() {
|
|
70
|
+
return {
|
|
71
|
+
flushCache: () => undefined,
|
|
72
|
+
getProfile: async (_cloudId, userId) => {
|
|
73
|
+
const timeout = random(1500) + 500;
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
window.setTimeout(async () => {
|
|
76
|
+
getMockProfile(userId).then(data => resolve(modifyResponse(data))).catch(error => reject(error));
|
|
77
|
+
}, timeout);
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
getTeamProfile: (_teamId, _orgId, _analytics) => {
|
|
81
|
+
return Promise.reject({
|
|
82
|
+
reason: 'not built yet'
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
getReportingLines: _userId => {
|
|
86
|
+
const reportingLinesUsers = profilecardData.map((user, index) => ({
|
|
87
|
+
accountIdentifier: '123456:12345-67890-' + index,
|
|
88
|
+
identifierType: 'ATLASSIAN_ID',
|
|
89
|
+
pii: {
|
|
90
|
+
name: user.User.fullName,
|
|
91
|
+
picture: user.User.avatarUrl
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
const halfCount = Math.ceil(reportingLinesUsers.length / 2);
|
|
95
|
+
return Promise.resolve({
|
|
96
|
+
managers: reportingLinesUsers.slice(0, halfCount),
|
|
97
|
+
reports: reportingLinesUsers.slice(-halfCount)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -54311,6 +54311,9 @@
|
|
|
54311
54311
|
"height": 64,
|
|
54312
54312
|
"width": 64
|
|
54313
54313
|
},
|
|
54314
|
+
"ascii": [
|
|
54315
|
+
"(#)"
|
|
54316
|
+
],
|
|
54314
54317
|
"searchable": true,
|
|
54315
54318
|
"shortName": ":note:"
|
|
54316
54319
|
},
|
|
@@ -338,5 +338,14 @@
|
|
|
338
338
|
"type": "user",
|
|
339
339
|
"isExternal": true,
|
|
340
340
|
"sources": ["github"]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"id": "external-5",
|
|
344
|
+
"name": "Dorian",
|
|
345
|
+
"email": "Dorian@email.com",
|
|
346
|
+
"avatarUrl": "https://ptc-directory-sited-static.us-east-1.staging.public.atl-paas.net/teams/avatars/4.svg",
|
|
347
|
+
"type": "user",
|
|
348
|
+
"isExternal": true,
|
|
349
|
+
"sources": []
|
|
341
350
|
}
|
|
342
351
|
]
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
1
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -13,6 +15,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
13
15
|
|
|
14
16
|
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; } }
|
|
15
17
|
|
|
18
|
+
import { modifyResponse } from '@atlaskit/profilecard';
|
|
16
19
|
import { profilecardData } from './profilecard-data';
|
|
17
20
|
import { random, getWeekday, getTimeString } from './util';
|
|
18
21
|
export function getMockProfilecardClient(BaseProfileClient, modifyResponse) {
|
|
@@ -66,39 +69,105 @@ export function getMockProfilecardClient(BaseProfileClient, modifyResponse) {
|
|
|
66
69
|
return MockProfileClient;
|
|
67
70
|
}(BaseProfileClient);
|
|
68
71
|
}
|
|
69
|
-
export var simpleMockProfilecardClient = function simpleMockProfilecardClient(modifyResponse) {
|
|
70
|
-
return {
|
|
71
|
-
getProfile: function getProfile(cloudId, userId) {
|
|
72
|
-
var matchError = userId.match(/^error:([0-9a-zA-Z\-]+)$/);
|
|
73
|
-
var error = matchError && matchError[1];
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
}
|
|
73
|
+
var getMockProfile = function getMockProfile(userId) {
|
|
74
|
+
var matchError = userId.match(/^error:([0-9a-zA-Z\-]+)$/);
|
|
75
|
+
var error = matchError && matchError[1];
|
|
80
76
|
|
|
81
|
-
|
|
77
|
+
if (error) {
|
|
78
|
+
return Promise.reject({
|
|
79
|
+
reason: 'error'
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
var profile = profilecardData[parseInt(userId, 10)];
|
|
84
|
+
|
|
85
|
+
if (!profile) {
|
|
86
|
+
return Promise.reject({
|
|
87
|
+
reason: 'default'
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var weekday = getWeekday();
|
|
92
|
+
|
|
93
|
+
var data = _objectSpread({}, profile);
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
data.remoteTimeString = getTimeString();
|
|
96
|
+
data.remoteWeekdayIndex = weekday.index;
|
|
97
|
+
data.remoteWeekdayString = weekday.string;
|
|
98
|
+
return Promise.resolve(data);
|
|
99
|
+
}; // TODO: This function will replace getMockProfilecardClient() on line 13 once the latest `master` branch containing this code has been merged to `develop`
|
|
90
100
|
|
|
91
|
-
var data = _objectSpread({}, profile);
|
|
92
101
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return
|
|
102
|
+
export function simpleMockProfilecardClient() {
|
|
103
|
+
return {
|
|
104
|
+
flushCache: function flushCache() {
|
|
105
|
+
return undefined;
|
|
97
106
|
},
|
|
98
|
-
|
|
107
|
+
getProfile: function () {
|
|
108
|
+
var _getProfile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_cloudId, userId) {
|
|
109
|
+
var timeout;
|
|
110
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
111
|
+
while (1) {
|
|
112
|
+
switch (_context2.prev = _context2.next) {
|
|
113
|
+
case 0:
|
|
114
|
+
timeout = random(1500) + 500;
|
|
115
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
116
|
+
window.setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
117
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
118
|
+
while (1) {
|
|
119
|
+
switch (_context.prev = _context.next) {
|
|
120
|
+
case 0:
|
|
121
|
+
getMockProfile(userId).then(function (data) {
|
|
122
|
+
return resolve(modifyResponse(data));
|
|
123
|
+
}).catch(function (error) {
|
|
124
|
+
return reject(error);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
case 1:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context.stop();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, _callee);
|
|
133
|
+
})), timeout);
|
|
134
|
+
}));
|
|
135
|
+
|
|
136
|
+
case 2:
|
|
137
|
+
case "end":
|
|
138
|
+
return _context2.stop();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, _callee2);
|
|
142
|
+
}));
|
|
143
|
+
|
|
144
|
+
function getProfile(_x, _x2) {
|
|
145
|
+
return _getProfile.apply(this, arguments);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return getProfile;
|
|
149
|
+
}(),
|
|
150
|
+
getTeamProfile: function getTeamProfile(_teamId, _orgId, _analytics) {
|
|
99
151
|
return Promise.reject({
|
|
100
152
|
reason: 'not built yet'
|
|
101
153
|
});
|
|
154
|
+
},
|
|
155
|
+
getReportingLines: function getReportingLines(_userId) {
|
|
156
|
+
var reportingLinesUsers = profilecardData.map(function (user, index) {
|
|
157
|
+
return {
|
|
158
|
+
accountIdentifier: '123456:12345-67890-' + index,
|
|
159
|
+
identifierType: 'ATLASSIAN_ID',
|
|
160
|
+
pii: {
|
|
161
|
+
name: user.User.fullName,
|
|
162
|
+
picture: user.User.avatarUrl
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
var halfCount = Math.ceil(reportingLinesUsers.length / 2);
|
|
167
|
+
return Promise.resolve({
|
|
168
|
+
managers: reportingLinesUsers.slice(0, halfCount),
|
|
169
|
+
reports: reportingLinesUsers.slice(-halfCount)
|
|
170
|
+
});
|
|
102
171
|
}
|
|
103
172
|
};
|
|
104
|
-
}
|
|
173
|
+
}
|
package/dist/esm/version.json
CHANGED
|
@@ -54311,6 +54311,9 @@
|
|
|
54311
54311
|
"height": 64,
|
|
54312
54312
|
"width": 64
|
|
54313
54313
|
},
|
|
54314
|
+
"ascii": [
|
|
54315
|
+
"(#)"
|
|
54316
|
+
],
|
|
54314
54317
|
"searchable": true,
|
|
54315
54318
|
"shortName": ":note:"
|
|
54316
54319
|
},
|
|
@@ -338,5 +338,14 @@
|
|
|
338
338
|
"type": "user",
|
|
339
339
|
"isExternal": true,
|
|
340
340
|
"sources": ["github"]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"id": "external-5",
|
|
344
|
+
"name": "Dorian",
|
|
345
|
+
"email": "Dorian@email.com",
|
|
346
|
+
"avatarUrl": "https://ptc-directory-sited-static.us-east-1.staging.public.atl-paas.net/teams/avatars/4.svg",
|
|
347
|
+
"type": "user",
|
|
348
|
+
"isExternal": true,
|
|
349
|
+
"sources": []
|
|
341
350
|
}
|
|
342
351
|
]
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
+
import { ProfileClient } from '@atlaskit/profilecard/types';
|
|
1
2
|
export declare function getMockProfilecardClient(BaseProfileClient: any, modifyResponse: any): any;
|
|
2
|
-
export declare
|
|
3
|
-
getProfile: (cloudId: string, userId: string) => Promise<any>;
|
|
4
|
-
getTeamProfile: (orgId: string, teamId: string, analytics: any) => Promise<never>;
|
|
5
|
-
};
|
|
3
|
+
export declare function simpleMockProfilecardClient(): ProfileClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/util-data-test",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.1.1",
|
|
4
4
|
"description": "Shared test and story data",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -66,12 +66,13 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@atlaskit/analytics-next": "^8.0.0",
|
|
69
|
-
"@atlaskit/emoji": "^
|
|
69
|
+
"@atlaskit/emoji": "^64.0.0",
|
|
70
70
|
"@atlaskit/mention": "^19.1.0",
|
|
71
|
+
"@atlaskit/profilecard": "^16.2.0",
|
|
71
72
|
"@atlaskit/task-decision": "^17.0.0",
|
|
72
73
|
"@atlaskit/util-service-support": "^6.0.0",
|
|
73
74
|
"@babel/runtime": "^7.0.0",
|
|
74
|
-
"lodash": "^4.17.
|
|
75
|
+
"lodash": "^4.17.21",
|
|
75
76
|
"memoize-one": "^6.0.0",
|
|
76
77
|
"uuid": "^3.1.0"
|
|
77
78
|
},
|