@atlaskit/teams-public 0.23.2 → 0.23.3
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 +8 -0
- package/dist/cjs/controllers/hooks/use-team-containers/index.js +74 -20
- package/dist/es2019/controllers/hooks/use-team-containers/index.js +63 -10
- package/dist/esm/controllers/hooks/use-team-containers/index.js +74 -20
- package/dist/types/controllers/hooks/use-team-containers/index.d.ts +10 -3
- package/dist/types-ts4.5/controllers/hooks/use-team-containers/index.d.ts +10 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/teams-public
|
|
2
2
|
|
|
3
|
+
## 0.23.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#133520](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/133520)
|
|
8
|
+
[`3e1cbce464584`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3e1cbce464584) -
|
|
9
|
+
Operational analytics
|
|
10
|
+
|
|
3
11
|
## 0.23.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -34,7 +34,7 @@ var initialState = {
|
|
|
34
34
|
connectedTeams: initialConnectedTeamsState
|
|
35
35
|
};
|
|
36
36
|
var actions = {
|
|
37
|
-
fetchTeamContainers: function fetchTeamContainers(teamId,
|
|
37
|
+
fetchTeamContainers: function fetchTeamContainers(teamId, fireAnalytics) {
|
|
38
38
|
return /*#__PURE__*/function () {
|
|
39
39
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
40
40
|
var setState, getState, _getState, currentTeamId, containers;
|
|
@@ -60,7 +60,7 @@ var actions = {
|
|
|
60
60
|
return _services.teamsClient.getTeamContainers(teamId);
|
|
61
61
|
case 8:
|
|
62
62
|
containers = _context.sent;
|
|
63
|
-
|
|
63
|
+
fireAnalytics(_analytics.AnalyticsAction.SUCCEEDED, 'fetchTeamContainers');
|
|
64
64
|
setState({
|
|
65
65
|
teamContainers: containers,
|
|
66
66
|
loading: false,
|
|
@@ -71,7 +71,7 @@ var actions = {
|
|
|
71
71
|
case 13:
|
|
72
72
|
_context.prev = 13;
|
|
73
73
|
_context.t0 = _context["catch"](5);
|
|
74
|
-
|
|
74
|
+
fireAnalytics(_analytics.AnalyticsAction.FAILED, 'fetchTeamContainers', _context.t0);
|
|
75
75
|
setState({
|
|
76
76
|
teamContainers: [],
|
|
77
77
|
error: _context.t0,
|
|
@@ -88,7 +88,7 @@ var actions = {
|
|
|
88
88
|
};
|
|
89
89
|
}();
|
|
90
90
|
},
|
|
91
|
-
fetchNumberOfConnectedTeams: function fetchNumberOfConnectedTeams(containerId) {
|
|
91
|
+
fetchNumberOfConnectedTeams: function fetchNumberOfConnectedTeams(containerId, fireAnalytics) {
|
|
92
92
|
return /*#__PURE__*/function () {
|
|
93
93
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref3) {
|
|
94
94
|
var setState, getState, _getState2, currentContainerId, numberOfTeams;
|
|
@@ -114,35 +114,48 @@ var actions = {
|
|
|
114
114
|
return _services.teamsClient.getNumberOfConnectedTeams(containerId);
|
|
115
115
|
case 8:
|
|
116
116
|
numberOfTeams = _context2.sent;
|
|
117
|
+
fireAnalytics({
|
|
118
|
+
action: _analytics.AnalyticsAction.SUCCEEDED,
|
|
119
|
+
actionSubject: 'fetchNumberOfConnectedTeams',
|
|
120
|
+
containerId: containerId,
|
|
121
|
+
numberOfTeams: numberOfTeams
|
|
122
|
+
});
|
|
117
123
|
setState({
|
|
118
124
|
connectedTeams: _objectSpread(_objectSpread({}, initialConnectedTeamsState), {}, {
|
|
119
125
|
containerId: containerId,
|
|
120
126
|
numberOfTeams: numberOfTeams
|
|
121
127
|
})
|
|
122
128
|
});
|
|
123
|
-
_context2.next =
|
|
129
|
+
_context2.next = 17;
|
|
124
130
|
break;
|
|
125
|
-
case
|
|
126
|
-
_context2.prev =
|
|
131
|
+
case 13:
|
|
132
|
+
_context2.prev = 13;
|
|
127
133
|
_context2.t0 = _context2["catch"](5);
|
|
134
|
+
fireAnalytics({
|
|
135
|
+
action: _analytics.AnalyticsAction.FAILED,
|
|
136
|
+
actionSubject: 'fetchNumberOfConnectedTeams',
|
|
137
|
+
containerId: containerId,
|
|
138
|
+
numberOfTeams: initialConnectedTeamsState.numberOfTeams,
|
|
139
|
+
error: _context2.t0
|
|
140
|
+
});
|
|
128
141
|
setState({
|
|
129
142
|
connectedTeams: _objectSpread(_objectSpread({}, initialConnectedTeamsState), {}, {
|
|
130
143
|
containerId: containerId,
|
|
131
144
|
error: _context2.t0
|
|
132
145
|
})
|
|
133
146
|
});
|
|
134
|
-
case
|
|
147
|
+
case 17:
|
|
135
148
|
case "end":
|
|
136
149
|
return _context2.stop();
|
|
137
150
|
}
|
|
138
|
-
}, _callee2, null, [[5,
|
|
151
|
+
}, _callee2, null, [[5, 13]]);
|
|
139
152
|
}));
|
|
140
153
|
return function (_x2) {
|
|
141
154
|
return _ref4.apply(this, arguments);
|
|
142
155
|
};
|
|
143
156
|
}();
|
|
144
157
|
},
|
|
145
|
-
fetchConnectedTeams: function fetchConnectedTeams(containerId) {
|
|
158
|
+
fetchConnectedTeams: function fetchConnectedTeams(containerId, fireAnalytics) {
|
|
146
159
|
return /*#__PURE__*/function () {
|
|
147
160
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref5) {
|
|
148
161
|
var setState, getState, _getState3, _getState3$connectedT, currentContainerId, numberOfTeams, hasLoaded, teams;
|
|
@@ -172,6 +185,12 @@ var actions = {
|
|
|
172
185
|
return _services.teamsClient.getConnectedTeams(containerId);
|
|
173
186
|
case 8:
|
|
174
187
|
teams = _context3.sent;
|
|
188
|
+
fireAnalytics({
|
|
189
|
+
action: _analytics.AnalyticsAction.SUCCEEDED,
|
|
190
|
+
actionSubject: 'fetchConnectedTeams',
|
|
191
|
+
containerId: containerId,
|
|
192
|
+
numberOfTeams: numberOfTeams
|
|
193
|
+
});
|
|
175
194
|
setState({
|
|
176
195
|
connectedTeams: {
|
|
177
196
|
containerId: containerId,
|
|
@@ -182,11 +201,18 @@ var actions = {
|
|
|
182
201
|
numberOfTeams: numberOfTeams
|
|
183
202
|
}
|
|
184
203
|
});
|
|
185
|
-
_context3.next =
|
|
204
|
+
_context3.next = 17;
|
|
186
205
|
break;
|
|
187
|
-
case
|
|
188
|
-
_context3.prev =
|
|
206
|
+
case 13:
|
|
207
|
+
_context3.prev = 13;
|
|
189
208
|
_context3.t0 = _context3["catch"](5);
|
|
209
|
+
fireAnalytics({
|
|
210
|
+
action: _analytics.AnalyticsAction.FAILED,
|
|
211
|
+
actionSubject: 'fetchConnectedTeams',
|
|
212
|
+
containerId: containerId,
|
|
213
|
+
numberOfTeams: numberOfTeams,
|
|
214
|
+
error: _context3.t0
|
|
215
|
+
});
|
|
190
216
|
setState({
|
|
191
217
|
connectedTeams: {
|
|
192
218
|
containerId: containerId,
|
|
@@ -197,11 +223,11 @@ var actions = {
|
|
|
197
223
|
numberOfTeams: numberOfTeams
|
|
198
224
|
}
|
|
199
225
|
});
|
|
200
|
-
case
|
|
226
|
+
case 17:
|
|
201
227
|
case "end":
|
|
202
228
|
return _context3.stop();
|
|
203
229
|
}
|
|
204
|
-
}, _callee3, null, [[5,
|
|
230
|
+
}, _callee3, null, [[5, 13]]);
|
|
205
231
|
}));
|
|
206
232
|
return function (_x3) {
|
|
207
233
|
return _ref6.apply(this, arguments);
|
|
@@ -320,12 +346,16 @@ var useTeamContainers = exports.useTeamContainers = function useTeamContainers(t
|
|
|
320
346
|
fireOperationalEvent = _usePeopleAndTeamAnal.fireOperationalEvent;
|
|
321
347
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
322
348
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
323
|
-
var fireOperationalAnalytics = (0, _react.useCallback)(function (action, actionSubject) {
|
|
349
|
+
var fireOperationalAnalytics = (0, _react.useCallback)(function (action, actionSubject, error) {
|
|
324
350
|
fireOperationalEvent(createAnalyticsEvent, {
|
|
325
351
|
action: action,
|
|
326
|
-
actionSubject: actionSubject
|
|
352
|
+
actionSubject: actionSubject,
|
|
353
|
+
attributes: {
|
|
354
|
+
teamId: teamId,
|
|
355
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
356
|
+
}
|
|
327
357
|
});
|
|
328
|
-
}, [fireOperationalEvent, createAnalyticsEvent]);
|
|
358
|
+
}, [fireOperationalEvent, createAnalyticsEvent, teamId]);
|
|
329
359
|
(0, _react.useEffect)(function () {
|
|
330
360
|
if (enable) {
|
|
331
361
|
actions.fetchTeamContainers(teamId, fireOperationalAnalytics);
|
|
@@ -340,8 +370,32 @@ var useConnectedTeams = exports.useConnectedTeams = function useConnectedTeams()
|
|
|
340
370
|
_useTeamContainersHoo4 = (0, _slicedToArray2.default)(_useTeamContainersHoo3, 2),
|
|
341
371
|
state = _useTeamContainersHoo4[0],
|
|
342
372
|
actions = _useTeamContainersHoo4[1];
|
|
373
|
+
var _usePeopleAndTeamAnal2 = (0, _analytics.usePeopleAndTeamAnalytics)(),
|
|
374
|
+
fireOperationalEvent = _usePeopleAndTeamAnal2.fireOperationalEvent;
|
|
375
|
+
var _useAnalyticsEvents2 = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
376
|
+
createAnalyticsEvent = _useAnalyticsEvents2.createAnalyticsEvent;
|
|
377
|
+
var fireOperationalAnalytics = (0, _react.useCallback)(function (_ref11) {
|
|
378
|
+
var action = _ref11.action,
|
|
379
|
+
actionSubject = _ref11.actionSubject,
|
|
380
|
+
containerId = _ref11.containerId,
|
|
381
|
+
numberOfTeams = _ref11.numberOfTeams,
|
|
382
|
+
error = _ref11.error;
|
|
383
|
+
fireOperationalEvent(createAnalyticsEvent, {
|
|
384
|
+
action: action,
|
|
385
|
+
actionSubject: actionSubject,
|
|
386
|
+
attributes: {
|
|
387
|
+
containerId: containerId,
|
|
388
|
+
numberOfTeams: numberOfTeams,
|
|
389
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
}, [fireOperationalEvent, createAnalyticsEvent]);
|
|
343
393
|
return _objectSpread(_objectSpread({}, state.connectedTeams), {}, {
|
|
344
|
-
fetchNumberOfConnectedTeams:
|
|
345
|
-
|
|
394
|
+
fetchNumberOfConnectedTeams: function fetchNumberOfConnectedTeams(containerId) {
|
|
395
|
+
return actions.fetchNumberOfConnectedTeams(containerId, fireOperationalAnalytics);
|
|
396
|
+
},
|
|
397
|
+
fetchConnectedTeams: function fetchConnectedTeams(containerId) {
|
|
398
|
+
return actions.fetchConnectedTeams(containerId, fireOperationalAnalytics);
|
|
399
|
+
}
|
|
346
400
|
});
|
|
347
401
|
};
|
|
@@ -20,7 +20,7 @@ const initialState = {
|
|
|
20
20
|
connectedTeams: initialConnectedTeamsState
|
|
21
21
|
};
|
|
22
22
|
const actions = {
|
|
23
|
-
fetchTeamContainers: (teamId,
|
|
23
|
+
fetchTeamContainers: (teamId, fireAnalytics) => async ({
|
|
24
24
|
setState,
|
|
25
25
|
getState
|
|
26
26
|
}) => {
|
|
@@ -38,14 +38,14 @@ const actions = {
|
|
|
38
38
|
});
|
|
39
39
|
try {
|
|
40
40
|
const containers = await teamsClient.getTeamContainers(teamId);
|
|
41
|
-
|
|
41
|
+
fireAnalytics(AnalyticsAction.SUCCEEDED, 'fetchTeamContainers');
|
|
42
42
|
setState({
|
|
43
43
|
teamContainers: containers,
|
|
44
44
|
loading: false,
|
|
45
45
|
error: null
|
|
46
46
|
});
|
|
47
47
|
} catch (err) {
|
|
48
|
-
|
|
48
|
+
fireAnalytics(AnalyticsAction.FAILED, 'fetchTeamContainers', err);
|
|
49
49
|
setState({
|
|
50
50
|
teamContainers: [],
|
|
51
51
|
error: err,
|
|
@@ -53,7 +53,7 @@ const actions = {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
fetchNumberOfConnectedTeams: containerId => async ({
|
|
56
|
+
fetchNumberOfConnectedTeams: (containerId, fireAnalytics) => async ({
|
|
57
57
|
setState,
|
|
58
58
|
getState
|
|
59
59
|
}) => {
|
|
@@ -74,6 +74,12 @@ const actions = {
|
|
|
74
74
|
});
|
|
75
75
|
try {
|
|
76
76
|
const numberOfTeams = await teamsClient.getNumberOfConnectedTeams(containerId);
|
|
77
|
+
fireAnalytics({
|
|
78
|
+
action: AnalyticsAction.SUCCEEDED,
|
|
79
|
+
actionSubject: 'fetchNumberOfConnectedTeams',
|
|
80
|
+
containerId,
|
|
81
|
+
numberOfTeams
|
|
82
|
+
});
|
|
77
83
|
setState({
|
|
78
84
|
connectedTeams: {
|
|
79
85
|
...initialConnectedTeamsState,
|
|
@@ -82,6 +88,13 @@ const actions = {
|
|
|
82
88
|
}
|
|
83
89
|
});
|
|
84
90
|
} catch (e) {
|
|
91
|
+
fireAnalytics({
|
|
92
|
+
action: AnalyticsAction.FAILED,
|
|
93
|
+
actionSubject: 'fetchNumberOfConnectedTeams',
|
|
94
|
+
containerId,
|
|
95
|
+
numberOfTeams: initialConnectedTeamsState.numberOfTeams,
|
|
96
|
+
error: e
|
|
97
|
+
});
|
|
85
98
|
setState({
|
|
86
99
|
connectedTeams: {
|
|
87
100
|
...initialConnectedTeamsState,
|
|
@@ -91,7 +104,7 @@ const actions = {
|
|
|
91
104
|
});
|
|
92
105
|
}
|
|
93
106
|
},
|
|
94
|
-
fetchConnectedTeams: containerId => async ({
|
|
107
|
+
fetchConnectedTeams: (containerId, fireAnalytics) => async ({
|
|
95
108
|
setState,
|
|
96
109
|
getState
|
|
97
110
|
}) => {
|
|
@@ -117,6 +130,12 @@ const actions = {
|
|
|
117
130
|
});
|
|
118
131
|
try {
|
|
119
132
|
const teams = await teamsClient.getConnectedTeams(containerId);
|
|
133
|
+
fireAnalytics({
|
|
134
|
+
action: AnalyticsAction.SUCCEEDED,
|
|
135
|
+
actionSubject: 'fetchConnectedTeams',
|
|
136
|
+
containerId,
|
|
137
|
+
numberOfTeams
|
|
138
|
+
});
|
|
120
139
|
setState({
|
|
121
140
|
connectedTeams: {
|
|
122
141
|
containerId,
|
|
@@ -128,6 +147,13 @@ const actions = {
|
|
|
128
147
|
}
|
|
129
148
|
});
|
|
130
149
|
} catch (e) {
|
|
150
|
+
fireAnalytics({
|
|
151
|
+
action: AnalyticsAction.FAILED,
|
|
152
|
+
actionSubject: 'fetchConnectedTeams',
|
|
153
|
+
containerId,
|
|
154
|
+
numberOfTeams,
|
|
155
|
+
error: e
|
|
156
|
+
});
|
|
131
157
|
setState({
|
|
132
158
|
connectedTeams: {
|
|
133
159
|
containerId,
|
|
@@ -215,12 +241,16 @@ export const useTeamContainers = (teamId, enable = true) => {
|
|
|
215
241
|
const {
|
|
216
242
|
createAnalyticsEvent
|
|
217
243
|
} = useAnalyticsEvents();
|
|
218
|
-
const fireOperationalAnalytics = useCallback((action, actionSubject) => {
|
|
244
|
+
const fireOperationalAnalytics = useCallback((action, actionSubject, error) => {
|
|
219
245
|
fireOperationalEvent(createAnalyticsEvent, {
|
|
220
246
|
action: action,
|
|
221
|
-
actionSubject: actionSubject
|
|
247
|
+
actionSubject: actionSubject,
|
|
248
|
+
attributes: {
|
|
249
|
+
teamId,
|
|
250
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
251
|
+
}
|
|
222
252
|
});
|
|
223
|
-
}, [fireOperationalEvent, createAnalyticsEvent]);
|
|
253
|
+
}, [fireOperationalEvent, createAnalyticsEvent, teamId]);
|
|
224
254
|
useEffect(() => {
|
|
225
255
|
if (enable) {
|
|
226
256
|
actions.fetchTeamContainers(teamId, fireOperationalAnalytics);
|
|
@@ -233,9 +263,32 @@ export const useTeamContainers = (teamId, enable = true) => {
|
|
|
233
263
|
};
|
|
234
264
|
export const useConnectedTeams = () => {
|
|
235
265
|
const [state, actions] = useTeamContainersHook();
|
|
266
|
+
const {
|
|
267
|
+
fireOperationalEvent
|
|
268
|
+
} = usePeopleAndTeamAnalytics();
|
|
269
|
+
const {
|
|
270
|
+
createAnalyticsEvent
|
|
271
|
+
} = useAnalyticsEvents();
|
|
272
|
+
const fireOperationalAnalytics = useCallback(({
|
|
273
|
+
action,
|
|
274
|
+
actionSubject,
|
|
275
|
+
containerId,
|
|
276
|
+
numberOfTeams,
|
|
277
|
+
error
|
|
278
|
+
}) => {
|
|
279
|
+
fireOperationalEvent(createAnalyticsEvent, {
|
|
280
|
+
action: action,
|
|
281
|
+
actionSubject: actionSubject,
|
|
282
|
+
attributes: {
|
|
283
|
+
containerId,
|
|
284
|
+
numberOfTeams,
|
|
285
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}, [fireOperationalEvent, createAnalyticsEvent]);
|
|
236
289
|
return {
|
|
237
290
|
...state.connectedTeams,
|
|
238
|
-
fetchNumberOfConnectedTeams: actions.fetchNumberOfConnectedTeams,
|
|
239
|
-
fetchConnectedTeams: actions.fetchConnectedTeams
|
|
291
|
+
fetchNumberOfConnectedTeams: containerId => actions.fetchNumberOfConnectedTeams(containerId, fireOperationalAnalytics),
|
|
292
|
+
fetchConnectedTeams: containerId => actions.fetchConnectedTeams(containerId, fireOperationalAnalytics)
|
|
240
293
|
};
|
|
241
294
|
};
|
|
@@ -27,7 +27,7 @@ var initialState = {
|
|
|
27
27
|
connectedTeams: initialConnectedTeamsState
|
|
28
28
|
};
|
|
29
29
|
var actions = {
|
|
30
|
-
fetchTeamContainers: function fetchTeamContainers(teamId,
|
|
30
|
+
fetchTeamContainers: function fetchTeamContainers(teamId, fireAnalytics) {
|
|
31
31
|
return /*#__PURE__*/function () {
|
|
32
32
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
33
33
|
var setState, getState, _getState, currentTeamId, containers;
|
|
@@ -53,7 +53,7 @@ var actions = {
|
|
|
53
53
|
return teamsClient.getTeamContainers(teamId);
|
|
54
54
|
case 8:
|
|
55
55
|
containers = _context.sent;
|
|
56
|
-
|
|
56
|
+
fireAnalytics(AnalyticsAction.SUCCEEDED, 'fetchTeamContainers');
|
|
57
57
|
setState({
|
|
58
58
|
teamContainers: containers,
|
|
59
59
|
loading: false,
|
|
@@ -64,7 +64,7 @@ var actions = {
|
|
|
64
64
|
case 13:
|
|
65
65
|
_context.prev = 13;
|
|
66
66
|
_context.t0 = _context["catch"](5);
|
|
67
|
-
|
|
67
|
+
fireAnalytics(AnalyticsAction.FAILED, 'fetchTeamContainers', _context.t0);
|
|
68
68
|
setState({
|
|
69
69
|
teamContainers: [],
|
|
70
70
|
error: _context.t0,
|
|
@@ -81,7 +81,7 @@ var actions = {
|
|
|
81
81
|
};
|
|
82
82
|
}();
|
|
83
83
|
},
|
|
84
|
-
fetchNumberOfConnectedTeams: function fetchNumberOfConnectedTeams(containerId) {
|
|
84
|
+
fetchNumberOfConnectedTeams: function fetchNumberOfConnectedTeams(containerId, fireAnalytics) {
|
|
85
85
|
return /*#__PURE__*/function () {
|
|
86
86
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
87
87
|
var setState, getState, _getState2, currentContainerId, numberOfTeams;
|
|
@@ -107,35 +107,48 @@ var actions = {
|
|
|
107
107
|
return teamsClient.getNumberOfConnectedTeams(containerId);
|
|
108
108
|
case 8:
|
|
109
109
|
numberOfTeams = _context2.sent;
|
|
110
|
+
fireAnalytics({
|
|
111
|
+
action: AnalyticsAction.SUCCEEDED,
|
|
112
|
+
actionSubject: 'fetchNumberOfConnectedTeams',
|
|
113
|
+
containerId: containerId,
|
|
114
|
+
numberOfTeams: numberOfTeams
|
|
115
|
+
});
|
|
110
116
|
setState({
|
|
111
117
|
connectedTeams: _objectSpread(_objectSpread({}, initialConnectedTeamsState), {}, {
|
|
112
118
|
containerId: containerId,
|
|
113
119
|
numberOfTeams: numberOfTeams
|
|
114
120
|
})
|
|
115
121
|
});
|
|
116
|
-
_context2.next =
|
|
122
|
+
_context2.next = 17;
|
|
117
123
|
break;
|
|
118
|
-
case
|
|
119
|
-
_context2.prev =
|
|
124
|
+
case 13:
|
|
125
|
+
_context2.prev = 13;
|
|
120
126
|
_context2.t0 = _context2["catch"](5);
|
|
127
|
+
fireAnalytics({
|
|
128
|
+
action: AnalyticsAction.FAILED,
|
|
129
|
+
actionSubject: 'fetchNumberOfConnectedTeams',
|
|
130
|
+
containerId: containerId,
|
|
131
|
+
numberOfTeams: initialConnectedTeamsState.numberOfTeams,
|
|
132
|
+
error: _context2.t0
|
|
133
|
+
});
|
|
121
134
|
setState({
|
|
122
135
|
connectedTeams: _objectSpread(_objectSpread({}, initialConnectedTeamsState), {}, {
|
|
123
136
|
containerId: containerId,
|
|
124
137
|
error: _context2.t0
|
|
125
138
|
})
|
|
126
139
|
});
|
|
127
|
-
case
|
|
140
|
+
case 17:
|
|
128
141
|
case "end":
|
|
129
142
|
return _context2.stop();
|
|
130
143
|
}
|
|
131
|
-
}, _callee2, null, [[5,
|
|
144
|
+
}, _callee2, null, [[5, 13]]);
|
|
132
145
|
}));
|
|
133
146
|
return function (_x2) {
|
|
134
147
|
return _ref4.apply(this, arguments);
|
|
135
148
|
};
|
|
136
149
|
}();
|
|
137
150
|
},
|
|
138
|
-
fetchConnectedTeams: function fetchConnectedTeams(containerId) {
|
|
151
|
+
fetchConnectedTeams: function fetchConnectedTeams(containerId, fireAnalytics) {
|
|
139
152
|
return /*#__PURE__*/function () {
|
|
140
153
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
|
|
141
154
|
var setState, getState, _getState3, _getState3$connectedT, currentContainerId, numberOfTeams, hasLoaded, teams;
|
|
@@ -165,6 +178,12 @@ var actions = {
|
|
|
165
178
|
return teamsClient.getConnectedTeams(containerId);
|
|
166
179
|
case 8:
|
|
167
180
|
teams = _context3.sent;
|
|
181
|
+
fireAnalytics({
|
|
182
|
+
action: AnalyticsAction.SUCCEEDED,
|
|
183
|
+
actionSubject: 'fetchConnectedTeams',
|
|
184
|
+
containerId: containerId,
|
|
185
|
+
numberOfTeams: numberOfTeams
|
|
186
|
+
});
|
|
168
187
|
setState({
|
|
169
188
|
connectedTeams: {
|
|
170
189
|
containerId: containerId,
|
|
@@ -175,11 +194,18 @@ var actions = {
|
|
|
175
194
|
numberOfTeams: numberOfTeams
|
|
176
195
|
}
|
|
177
196
|
});
|
|
178
|
-
_context3.next =
|
|
197
|
+
_context3.next = 17;
|
|
179
198
|
break;
|
|
180
|
-
case
|
|
181
|
-
_context3.prev =
|
|
199
|
+
case 13:
|
|
200
|
+
_context3.prev = 13;
|
|
182
201
|
_context3.t0 = _context3["catch"](5);
|
|
202
|
+
fireAnalytics({
|
|
203
|
+
action: AnalyticsAction.FAILED,
|
|
204
|
+
actionSubject: 'fetchConnectedTeams',
|
|
205
|
+
containerId: containerId,
|
|
206
|
+
numberOfTeams: numberOfTeams,
|
|
207
|
+
error: _context3.t0
|
|
208
|
+
});
|
|
183
209
|
setState({
|
|
184
210
|
connectedTeams: {
|
|
185
211
|
containerId: containerId,
|
|
@@ -190,11 +216,11 @@ var actions = {
|
|
|
190
216
|
numberOfTeams: numberOfTeams
|
|
191
217
|
}
|
|
192
218
|
});
|
|
193
|
-
case
|
|
219
|
+
case 17:
|
|
194
220
|
case "end":
|
|
195
221
|
return _context3.stop();
|
|
196
222
|
}
|
|
197
|
-
}, _callee3, null, [[5,
|
|
223
|
+
}, _callee3, null, [[5, 13]]);
|
|
198
224
|
}));
|
|
199
225
|
return function (_x3) {
|
|
200
226
|
return _ref6.apply(this, arguments);
|
|
@@ -313,12 +339,16 @@ export var useTeamContainers = function useTeamContainers(teamId) {
|
|
|
313
339
|
fireOperationalEvent = _usePeopleAndTeamAnal.fireOperationalEvent;
|
|
314
340
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
315
341
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
316
|
-
var fireOperationalAnalytics = useCallback(function (action, actionSubject) {
|
|
342
|
+
var fireOperationalAnalytics = useCallback(function (action, actionSubject, error) {
|
|
317
343
|
fireOperationalEvent(createAnalyticsEvent, {
|
|
318
344
|
action: action,
|
|
319
|
-
actionSubject: actionSubject
|
|
345
|
+
actionSubject: actionSubject,
|
|
346
|
+
attributes: {
|
|
347
|
+
teamId: teamId,
|
|
348
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
349
|
+
}
|
|
320
350
|
});
|
|
321
|
-
}, [fireOperationalEvent, createAnalyticsEvent]);
|
|
351
|
+
}, [fireOperationalEvent, createAnalyticsEvent, teamId]);
|
|
322
352
|
useEffect(function () {
|
|
323
353
|
if (enable) {
|
|
324
354
|
actions.fetchTeamContainers(teamId, fireOperationalAnalytics);
|
|
@@ -333,8 +363,32 @@ export var useConnectedTeams = function useConnectedTeams() {
|
|
|
333
363
|
_useTeamContainersHoo4 = _slicedToArray(_useTeamContainersHoo3, 2),
|
|
334
364
|
state = _useTeamContainersHoo4[0],
|
|
335
365
|
actions = _useTeamContainersHoo4[1];
|
|
366
|
+
var _usePeopleAndTeamAnal2 = usePeopleAndTeamAnalytics(),
|
|
367
|
+
fireOperationalEvent = _usePeopleAndTeamAnal2.fireOperationalEvent;
|
|
368
|
+
var _useAnalyticsEvents2 = useAnalyticsEvents(),
|
|
369
|
+
createAnalyticsEvent = _useAnalyticsEvents2.createAnalyticsEvent;
|
|
370
|
+
var fireOperationalAnalytics = useCallback(function (_ref11) {
|
|
371
|
+
var action = _ref11.action,
|
|
372
|
+
actionSubject = _ref11.actionSubject,
|
|
373
|
+
containerId = _ref11.containerId,
|
|
374
|
+
numberOfTeams = _ref11.numberOfTeams,
|
|
375
|
+
error = _ref11.error;
|
|
376
|
+
fireOperationalEvent(createAnalyticsEvent, {
|
|
377
|
+
action: action,
|
|
378
|
+
actionSubject: actionSubject,
|
|
379
|
+
attributes: {
|
|
380
|
+
containerId: containerId,
|
|
381
|
+
numberOfTeams: numberOfTeams,
|
|
382
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}, [fireOperationalEvent, createAnalyticsEvent]);
|
|
336
386
|
return _objectSpread(_objectSpread({}, state.connectedTeams), {}, {
|
|
337
|
-
fetchNumberOfConnectedTeams:
|
|
338
|
-
|
|
387
|
+
fetchNumberOfConnectedTeams: function fetchNumberOfConnectedTeams(containerId) {
|
|
388
|
+
return actions.fetchNumberOfConnectedTeams(containerId, fireOperationalAnalytics);
|
|
389
|
+
},
|
|
390
|
+
fetchConnectedTeams: function fetchConnectedTeams(containerId) {
|
|
391
|
+
return actions.fetchConnectedTeams(containerId, fireOperationalAnalytics);
|
|
392
|
+
}
|
|
339
393
|
});
|
|
340
394
|
};
|
|
@@ -17,10 +17,17 @@ type State = {
|
|
|
17
17
|
teamId: string | null;
|
|
18
18
|
connectedTeams: ConnectedTeams;
|
|
19
19
|
};
|
|
20
|
+
type FireAnalyticsProps = {
|
|
21
|
+
action: string;
|
|
22
|
+
actionSubject: string;
|
|
23
|
+
containerId: string;
|
|
24
|
+
numberOfTeams?: number;
|
|
25
|
+
error?: Error;
|
|
26
|
+
};
|
|
20
27
|
export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
|
|
21
|
-
fetchTeamContainers: (teamId: string,
|
|
22
|
-
fetchNumberOfConnectedTeams: (containerId: string) => Action<State>;
|
|
23
|
-
fetchConnectedTeams: (containerId: string) => Action<State>;
|
|
28
|
+
fetchTeamContainers: (teamId: string, fireAnalytics: (action: string, actionSubject: string, error?: Error) => void) => Action<State>;
|
|
29
|
+
fetchNumberOfConnectedTeams: (containerId: string, fireAnalytics: (props: FireAnalyticsProps) => void) => Action<State>;
|
|
30
|
+
fetchConnectedTeams: (containerId: string, fireAnalytics: (props: FireAnalyticsProps) => void) => Action<State>;
|
|
24
31
|
unlinkTeamContainers: (teamId: string, containerId: string) => Action<State>;
|
|
25
32
|
addTeamContainer: (teamContainer: TeamContainer) => Action<State>;
|
|
26
33
|
}>, void>;
|
|
@@ -17,10 +17,17 @@ type State = {
|
|
|
17
17
|
teamId: string | null;
|
|
18
18
|
connectedTeams: ConnectedTeams;
|
|
19
19
|
};
|
|
20
|
+
type FireAnalyticsProps = {
|
|
21
|
+
action: string;
|
|
22
|
+
actionSubject: string;
|
|
23
|
+
containerId: string;
|
|
24
|
+
numberOfTeams?: number;
|
|
25
|
+
error?: Error;
|
|
26
|
+
};
|
|
20
27
|
export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
|
|
21
|
-
fetchTeamContainers: (teamId: string,
|
|
22
|
-
fetchNumberOfConnectedTeams: (containerId: string) => Action<State>;
|
|
23
|
-
fetchConnectedTeams: (containerId: string) => Action<State>;
|
|
28
|
+
fetchTeamContainers: (teamId: string, fireAnalytics: (action: string, actionSubject: string, error?: Error) => void) => Action<State>;
|
|
29
|
+
fetchNumberOfConnectedTeams: (containerId: string, fireAnalytics: (props: FireAnalyticsProps) => void) => Action<State>;
|
|
30
|
+
fetchConnectedTeams: (containerId: string, fireAnalytics: (props: FireAnalyticsProps) => void) => Action<State>;
|
|
24
31
|
unlinkTeamContainers: (teamId: string, containerId: string) => Action<State>;
|
|
25
32
|
addTeamContainer: (teamContainer: TeamContainer) => Action<State>;
|
|
26
33
|
}>, void>;
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/button": "^22.0.0",
|
|
35
35
|
"@atlaskit/css": "^0.10.0",
|
|
36
36
|
"@atlaskit/heading": "^5.1.0",
|
|
37
|
-
"@atlaskit/icon": "^25.
|
|
37
|
+
"@atlaskit/icon": "^25.3.0",
|
|
38
38
|
"@atlaskit/image": "^3.0.0",
|
|
39
39
|
"@atlaskit/link": "^3.1.0",
|
|
40
40
|
"@atlaskit/logo": "^16.0.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
"name": "@atlaskit/teams-public",
|
|
109
|
-
"version": "0.23.
|
|
109
|
+
"version": "0.23.3",
|
|
110
110
|
"description": "Public components related to teams",
|
|
111
111
|
"author": "Atlassian Pty Ltd",
|
|
112
112
|
"license": "Apache-2.0",
|