@atlaskit/teams-public 0.23.1 → 0.23.2

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,13 @@
1
1
  # @atlaskit/teams-public
2
2
 
3
+ ## 0.23.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#133042](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/133042)
8
+ [`5168674830838`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5168674830838) -
9
+ make the connection item clickable
10
+
3
11
  ## 0.23.1
4
12
 
5
13
  ### Patch Changes
@@ -12,6 +12,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
  var _react = require("react");
14
14
  var _reactSweetState = require("react-sweet-state");
15
+ var _analyticsNext = require("@atlaskit/analytics-next");
16
+ var _analytics = require("../../../common/utils/analytics");
15
17
  var _services = require("../../../services");
16
18
  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; }
17
19
  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) { (0, _defineProperty2.default)(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; }
@@ -32,7 +34,7 @@ var initialState = {
32
34
  connectedTeams: initialConnectedTeamsState
33
35
  };
34
36
  var actions = {
35
- fetchTeamContainers: function fetchTeamContainers(teamId) {
37
+ fetchTeamContainers: function fetchTeamContainers(teamId, fireOperationalAnalytics) {
36
38
  return /*#__PURE__*/function () {
37
39
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
38
40
  var setState, getState, _getState, currentTeamId, containers;
@@ -58,26 +60,28 @@ var actions = {
58
60
  return _services.teamsClient.getTeamContainers(teamId);
59
61
  case 8:
60
62
  containers = _context.sent;
63
+ fireOperationalAnalytics(_analytics.AnalyticsAction.SUCCEEDED, 'fetchTeamContainers');
61
64
  setState({
62
65
  teamContainers: containers,
63
66
  loading: false,
64
67
  error: null
65
68
  });
66
- _context.next = 15;
69
+ _context.next = 17;
67
70
  break;
68
- case 12:
69
- _context.prev = 12;
71
+ case 13:
72
+ _context.prev = 13;
70
73
  _context.t0 = _context["catch"](5);
74
+ fireOperationalAnalytics(_analytics.AnalyticsAction.FAILED, 'fetchTeamContainers');
71
75
  setState({
72
76
  teamContainers: [],
73
77
  error: _context.t0,
74
78
  loading: false
75
79
  });
76
- case 15:
80
+ case 17:
77
81
  case "end":
78
82
  return _context.stop();
79
83
  }
80
- }, _callee, null, [[5, 12]]);
84
+ }, _callee, null, [[5, 13]]);
81
85
  }));
82
86
  return function (_x) {
83
87
  return _ref2.apply(this, arguments);
@@ -312,11 +316,21 @@ var useTeamContainers = exports.useTeamContainers = function useTeamContainers(t
312
316
  _useTeamContainersHoo2 = (0, _slicedToArray2.default)(_useTeamContainersHoo, 2),
313
317
  state = _useTeamContainersHoo2[0],
314
318
  actions = _useTeamContainersHoo2[1];
319
+ var _usePeopleAndTeamAnal = (0, _analytics.usePeopleAndTeamAnalytics)(),
320
+ fireOperationalEvent = _usePeopleAndTeamAnal.fireOperationalEvent;
321
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
322
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
323
+ var fireOperationalAnalytics = (0, _react.useCallback)(function (action, actionSubject) {
324
+ fireOperationalEvent(createAnalyticsEvent, {
325
+ action: action,
326
+ actionSubject: actionSubject
327
+ });
328
+ }, [fireOperationalEvent, createAnalyticsEvent]);
315
329
  (0, _react.useEffect)(function () {
316
330
  if (enable) {
317
- actions.fetchTeamContainers(teamId);
331
+ actions.fetchTeamContainers(teamId, fireOperationalAnalytics);
318
332
  }
319
- }, [teamId, actions, enable]);
333
+ }, [teamId, actions, enable, fireOperationalAnalytics]);
320
334
  return _objectSpread(_objectSpread({}, state), {}, {
321
335
  addTeamContainer: actions.addTeamContainer
322
336
  });
@@ -174,7 +174,7 @@ var TeamContainers = exports.TeamContainers = function TeamContainers(_ref) {
174
174
  space: "space.200"
175
175
  }, /*#__PURE__*/_react.default.createElement(_primitives.Grid, {
176
176
  templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
177
- gap: "space.100"
177
+ gap: isDisplayedOnProfileCard ? 'space.0' : 'space.100'
178
178
  }, filteredTeamContainers.slice(0, MAX_NUMBER_OF_CONTAINERS_TO_SHOW).map(function (container) {
179
179
  return /*#__PURE__*/_react.default.createElement(LinkedContainerCardComponent, {
180
180
  key: container.id,
@@ -1,5 +1,7 @@
1
- import { useEffect } from 'react';
1
+ import { useCallback, useEffect } from 'react';
2
2
  import { createHook, createStore } from 'react-sweet-state';
3
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import { AnalyticsAction, usePeopleAndTeamAnalytics } from '../../../common/utils/analytics';
3
5
  import { teamsClient } from '../../../services';
4
6
  const initialConnectedTeamsState = {
5
7
  containerId: undefined,
@@ -18,7 +20,7 @@ const initialState = {
18
20
  connectedTeams: initialConnectedTeamsState
19
21
  };
20
22
  const actions = {
21
- fetchTeamContainers: teamId => async ({
23
+ fetchTeamContainers: (teamId, fireOperationalAnalytics) => async ({
22
24
  setState,
23
25
  getState
24
26
  }) => {
@@ -36,12 +38,14 @@ const actions = {
36
38
  });
37
39
  try {
38
40
  const containers = await teamsClient.getTeamContainers(teamId);
41
+ fireOperationalAnalytics(AnalyticsAction.SUCCEEDED, 'fetchTeamContainers');
39
42
  setState({
40
43
  teamContainers: containers,
41
44
  loading: false,
42
45
  error: null
43
46
  });
44
47
  } catch (err) {
48
+ fireOperationalAnalytics(AnalyticsAction.FAILED, 'fetchTeamContainers');
45
49
  setState({
46
50
  teamContainers: [],
47
51
  error: err,
@@ -205,11 +209,23 @@ const Store = createStore({
205
209
  export const useTeamContainersHook = createHook(Store);
206
210
  export const useTeamContainers = (teamId, enable = true) => {
207
211
  const [state, actions] = useTeamContainersHook();
212
+ const {
213
+ fireOperationalEvent
214
+ } = usePeopleAndTeamAnalytics();
215
+ const {
216
+ createAnalyticsEvent
217
+ } = useAnalyticsEvents();
218
+ const fireOperationalAnalytics = useCallback((action, actionSubject) => {
219
+ fireOperationalEvent(createAnalyticsEvent, {
220
+ action: action,
221
+ actionSubject: actionSubject
222
+ });
223
+ }, [fireOperationalEvent, createAnalyticsEvent]);
208
224
  useEffect(() => {
209
225
  if (enable) {
210
- actions.fetchTeamContainers(teamId);
226
+ actions.fetchTeamContainers(teamId, fireOperationalAnalytics);
211
227
  }
212
- }, [teamId, actions, enable]);
228
+ }, [teamId, actions, enable, fireOperationalAnalytics]);
213
229
  return {
214
230
  ...state,
215
231
  addTeamContainer: actions.addTeamContainer
@@ -121,7 +121,7 @@ export const TeamContainers = ({
121
121
  space: "space.200"
122
122
  }, /*#__PURE__*/React.createElement(Grid, {
123
123
  templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
124
- gap: "space.100"
124
+ gap: isDisplayedOnProfileCard ? 'space.0' : 'space.100'
125
125
  }, filteredTeamContainers.slice(0, MAX_NUMBER_OF_CONTAINERS_TO_SHOW).map(container => {
126
126
  return /*#__PURE__*/React.createElement(LinkedContainerCardComponent, {
127
127
  key: container.id,
@@ -5,8 +5,10 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
5
  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; }
6
6
  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; }
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
- import { useEffect } from 'react';
8
+ import { useCallback, useEffect } from 'react';
9
9
  import { createHook, createStore } from 'react-sweet-state';
10
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
11
+ import { AnalyticsAction, usePeopleAndTeamAnalytics } from '../../../common/utils/analytics';
10
12
  import { teamsClient } from '../../../services';
11
13
  var initialConnectedTeamsState = {
12
14
  containerId: undefined,
@@ -25,7 +27,7 @@ var initialState = {
25
27
  connectedTeams: initialConnectedTeamsState
26
28
  };
27
29
  var actions = {
28
- fetchTeamContainers: function fetchTeamContainers(teamId) {
30
+ fetchTeamContainers: function fetchTeamContainers(teamId, fireOperationalAnalytics) {
29
31
  return /*#__PURE__*/function () {
30
32
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
31
33
  var setState, getState, _getState, currentTeamId, containers;
@@ -51,26 +53,28 @@ var actions = {
51
53
  return teamsClient.getTeamContainers(teamId);
52
54
  case 8:
53
55
  containers = _context.sent;
56
+ fireOperationalAnalytics(AnalyticsAction.SUCCEEDED, 'fetchTeamContainers');
54
57
  setState({
55
58
  teamContainers: containers,
56
59
  loading: false,
57
60
  error: null
58
61
  });
59
- _context.next = 15;
62
+ _context.next = 17;
60
63
  break;
61
- case 12:
62
- _context.prev = 12;
64
+ case 13:
65
+ _context.prev = 13;
63
66
  _context.t0 = _context["catch"](5);
67
+ fireOperationalAnalytics(AnalyticsAction.FAILED, 'fetchTeamContainers');
64
68
  setState({
65
69
  teamContainers: [],
66
70
  error: _context.t0,
67
71
  loading: false
68
72
  });
69
- case 15:
73
+ case 17:
70
74
  case "end":
71
75
  return _context.stop();
72
76
  }
73
- }, _callee, null, [[5, 12]]);
77
+ }, _callee, null, [[5, 13]]);
74
78
  }));
75
79
  return function (_x) {
76
80
  return _ref2.apply(this, arguments);
@@ -305,11 +309,21 @@ export var useTeamContainers = function useTeamContainers(teamId) {
305
309
  _useTeamContainersHoo2 = _slicedToArray(_useTeamContainersHoo, 2),
306
310
  state = _useTeamContainersHoo2[0],
307
311
  actions = _useTeamContainersHoo2[1];
312
+ var _usePeopleAndTeamAnal = usePeopleAndTeamAnalytics(),
313
+ fireOperationalEvent = _usePeopleAndTeamAnal.fireOperationalEvent;
314
+ var _useAnalyticsEvents = useAnalyticsEvents(),
315
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
316
+ var fireOperationalAnalytics = useCallback(function (action, actionSubject) {
317
+ fireOperationalEvent(createAnalyticsEvent, {
318
+ action: action,
319
+ actionSubject: actionSubject
320
+ });
321
+ }, [fireOperationalEvent, createAnalyticsEvent]);
308
322
  useEffect(function () {
309
323
  if (enable) {
310
- actions.fetchTeamContainers(teamId);
324
+ actions.fetchTeamContainers(teamId, fireOperationalAnalytics);
311
325
  }
312
- }, [teamId, actions, enable]);
326
+ }, [teamId, actions, enable, fireOperationalAnalytics]);
313
327
  return _objectSpread(_objectSpread({}, state), {}, {
314
328
  addTeamContainer: actions.addTeamContainer
315
329
  });
@@ -164,7 +164,7 @@ export var TeamContainers = function TeamContainers(_ref) {
164
164
  space: "space.200"
165
165
  }, /*#__PURE__*/React.createElement(Grid, {
166
166
  templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
167
- gap: "space.100"
167
+ gap: isDisplayedOnProfileCard ? 'space.0' : 'space.100'
168
168
  }, filteredTeamContainers.slice(0, MAX_NUMBER_OF_CONTAINERS_TO_SHOW).map(function (container) {
169
169
  return /*#__PURE__*/React.createElement(LinkedContainerCardComponent, {
170
170
  key: container.id,
@@ -18,7 +18,7 @@ type State = {
18
18
  connectedTeams: ConnectedTeams;
19
19
  };
20
20
  export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
21
- fetchTeamContainers: (teamId: string) => Action<State>;
21
+ fetchTeamContainers: (teamId: string, fireOperationalAnalytics: (action: string, actionSubject: string) => void) => Action<State>;
22
22
  fetchNumberOfConnectedTeams: (containerId: string) => Action<State>;
23
23
  fetchConnectedTeams: (containerId: string) => Action<State>;
24
24
  unlinkTeamContainers: (teamId: string, containerId: string) => Action<State>;
@@ -18,7 +18,7 @@ type State = {
18
18
  connectedTeams: ConnectedTeams;
19
19
  };
20
20
  export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
21
- fetchTeamContainers: (teamId: string) => Action<State>;
21
+ fetchTeamContainers: (teamId: string, fireOperationalAnalytics: (action: string, actionSubject: string) => void) => Action<State>;
22
22
  fetchNumberOfConnectedTeams: (containerId: string) => Action<State>;
23
23
  fetchConnectedTeams: (containerId: string) => Action<State>;
24
24
  unlinkTeamContainers: (teamId: string, containerId: string) => Action<State>;
package/package.json CHANGED
@@ -36,7 +36,7 @@
36
36
  "@atlaskit/heading": "^5.1.0",
37
37
  "@atlaskit/icon": "^25.2.0",
38
38
  "@atlaskit/image": "^3.0.0",
39
- "@atlaskit/link": "^3.0.0",
39
+ "@atlaskit/link": "^3.1.0",
40
40
  "@atlaskit/logo": "^16.0.0",
41
41
  "@atlaskit/modal-dialog": "^14.0.0",
42
42
  "@atlaskit/people-teams-ui-public": "^3.1.0",
@@ -106,7 +106,7 @@
106
106
  }
107
107
  },
108
108
  "name": "@atlaskit/teams-public",
109
- "version": "0.23.1",
109
+ "version": "0.23.2",
110
110
  "description": "Public components related to teams",
111
111
  "author": "Atlassian Pty Ltd",
112
112
  "license": "Apache-2.0",