@atlaskit/task-decision 17.5.7 → 17.5.9

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/index.js +0 -2
  3. package/dist/cjs/api/TaskDecisionResource.js +11 -71
  4. package/dist/cjs/api/TaskDecisionUtils.js +6 -19
  5. package/dist/cjs/components/DecisionItem.js +7 -15
  6. package/dist/cjs/components/DecisionList.js +4 -24
  7. package/dist/cjs/components/Item.js +11 -38
  8. package/dist/cjs/components/ResourcedTaskItem.js +20 -52
  9. package/dist/cjs/components/TaskItem.js +14 -36
  10. package/dist/cjs/components/TaskList.js +6 -28
  11. package/dist/cjs/components/listStyle.js +0 -2
  12. package/dist/cjs/index.js +0 -8
  13. package/dist/cjs/type-helpers.js +2 -12
  14. package/dist/cjs/types.js +0 -4
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/api/TaskDecisionResource.js +15 -75
  17. package/dist/es2019/api/TaskDecisionUtils.js +0 -1
  18. package/dist/es2019/components/DecisionItem.js +2 -3
  19. package/dist/es2019/components/DecisionList.js +4 -5
  20. package/dist/es2019/components/Item.js +1 -12
  21. package/dist/es2019/components/ResourcedTaskItem.js +7 -22
  22. package/dist/es2019/components/TaskItem.js +3 -8
  23. package/dist/es2019/components/TaskList.js +3 -5
  24. package/dist/es2019/types.js +1 -1
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/api/TaskDecisionResource.js +11 -74
  27. package/dist/esm/api/TaskDecisionUtils.js +6 -12
  28. package/dist/esm/components/DecisionItem.js +7 -8
  29. package/dist/esm/components/DecisionList.js +5 -15
  30. package/dist/esm/components/Item.js +12 -28
  31. package/dist/esm/components/ResourcedTaskItem.js +20 -46
  32. package/dist/esm/components/TaskItem.js +14 -21
  33. package/dist/esm/components/TaskList.js +6 -17
  34. package/dist/esm/type-helpers.js +2 -2
  35. package/dist/esm/types.js +1 -1
  36. package/dist/esm/version.json +1 -1
  37. package/package.json +6 -6
  38. package/report.api.md +15 -0
@@ -18,9 +18,7 @@ export const ACTION_DECISION_FPS_EVENTS = 'avi:task-decision-service:*:*';
18
18
  export class RecentUpdates {
19
19
  constructor(pubSubClient) {
20
20
  _defineProperty(this, "idsByContainer", new Map());
21
-
22
21
  _defineProperty(this, "listenersById", new Map());
23
-
24
22
  _defineProperty(this, "onPubSubEvent", (_event, payload) => {
25
23
  const {
26
24
  objectAri
@@ -29,55 +27,45 @@ export class RecentUpdates {
29
27
  objectAri
30
28
  });
31
29
  });
32
-
33
30
  this.pubSubClient = pubSubClient;
34
31
  this.subscribeToPubSubEvents();
35
32
  }
36
-
37
33
  subscribe(objectAri, recentUpdatesListener) {
38
34
  const id = uuid();
39
35
  let containerIds = this.idsByContainer.get(objectAri);
40
-
41
36
  if (!containerIds) {
42
37
  containerIds = [];
43
38
  this.idsByContainer.set(objectAri, containerIds);
44
39
  }
45
-
46
40
  containerIds.push(id);
47
41
  this.listenersById.set(id, {
48
42
  listener: recentUpdatesListener,
49
43
  objectAri
50
- }); // Notify of id
51
-
44
+ });
45
+ // Notify of id
52
46
  recentUpdatesListener.id(id);
53
47
  }
54
-
55
48
  unsubscribe(unsubscribeId) {
56
49
  const listenerDetail = this.listenersById.get(unsubscribeId);
57
-
58
50
  if (listenerDetail) {
59
51
  this.listenersById.delete(unsubscribeId);
60
52
  const {
61
53
  objectAri
62
54
  } = listenerDetail;
63
55
  const idsToFilter = this.idsByContainer.get(objectAri);
64
-
65
56
  if (idsToFilter) {
66
57
  this.idsByContainer.set(objectAri, idsToFilter.filter(id => id !== unsubscribeId));
67
58
  }
68
59
  }
69
60
  }
70
-
71
61
  notify(recentUpdateContext) {
72
62
  const {
73
63
  objectAri
74
64
  } = recentUpdateContext;
75
65
  const subscriberIds = this.idsByContainer.get(objectAri);
76
-
77
66
  if (subscriberIds) {
78
67
  subscriberIds.forEach(subscriberId => {
79
68
  const listenerDetail = this.listenersById.get(subscriberId);
80
-
81
69
  if (listenerDetail) {
82
70
  const {
83
71
  listener
@@ -87,38 +75,28 @@ export class RecentUpdates {
87
75
  });
88
76
  }
89
77
  }
90
-
91
78
  destroy() {
92
79
  this.unsubscribeFromPubSubEvents();
93
80
  }
94
-
95
81
  subscribeToPubSubEvents() {
96
82
  if (this.pubSubClient) {
97
83
  this.pubSubClient.on(ACTION_DECISION_FPS_EVENTS, this.onPubSubEvent);
98
84
  }
99
85
  }
100
-
101
86
  unsubscribeFromPubSubEvents() {
102
87
  if (this.pubSubClient) {
103
88
  this.pubSubClient.off(ACTION_DECISION_FPS_EVENTS, this.onPubSubEvent);
104
89
  }
105
90
  }
106
-
107
91
  }
108
92
  export class ItemStateManager {
109
93
  constructor(serviceConfig) {
110
94
  _defineProperty(this, "debouncedTaskStateQuery", null);
111
-
112
95
  _defineProperty(this, "debouncedTaskToggle", new Map());
113
-
114
96
  _defineProperty(this, "subscribers", new Map());
115
-
116
97
  _defineProperty(this, "trackedObjectKeys", new Map());
117
-
118
98
  _defineProperty(this, "cachedItems", new Map());
119
-
120
99
  _defineProperty(this, "batchedKeys", new Map());
121
-
122
100
  _defineProperty(this, "onTaskUpdatedEvent", (_event, payload) => {
123
101
  const {
124
102
  objectAri,
@@ -129,56 +107,49 @@ export class ItemStateManager {
129
107
  localId
130
108
  };
131
109
  const cached = this.getCached(objectKey);
132
-
133
110
  if (!cached) {
134
111
  // ignore unknown task
135
112
  return;
136
113
  }
137
-
138
114
  const lastUpdateDate = new Date(payload.lastUpdateDate);
139
-
140
115
  if (lastUpdateDate > cached.lastUpdateDate) {
141
116
  this.updateCache(convertServiceTaskStateToBaseItem(payload));
142
117
  this.notifyUpdated(objectKey, payload.state);
143
118
  return;
144
119
  }
145
120
  });
146
-
147
121
  _defineProperty(this, "onReconnect", () => {
148
122
  this.refreshAllTasks();
149
123
  });
150
-
151
124
  this.serviceConfig = serviceConfig;
152
125
  this.subscribeToPubSubEvents();
153
126
  }
154
-
155
127
  destroy() {
156
128
  if (this.debouncedTaskStateQuery) {
157
129
  clearTimeout(this.debouncedTaskStateQuery);
158
130
  }
159
-
160
131
  this.debouncedTaskToggle.forEach(timeout => {
161
132
  clearTimeout(timeout);
162
133
  });
163
134
  this.unsubscribeFromPubSubEvents();
164
135
  }
165
-
166
136
  toggleTask(objectKey, state) {
167
137
  const stringKey = objectKeyToString(objectKey);
168
138
  const timeout = this.debouncedTaskToggle.get(stringKey);
169
-
170
139
  if (timeout) {
171
140
  clearTimeout(timeout);
172
141
  this.debouncedTaskToggle.delete(stringKey);
173
- } // Update cache optimistically
174
-
142
+ }
175
143
 
176
- this.updateCache({ ...objectKey,
144
+ // Update cache optimistically
145
+ this.updateCache({
146
+ ...objectKey,
177
147
  lastUpdateDate: new Date(),
178
148
  type: 'TASK',
179
149
  state: state
180
- }); // Optimistically notify subscribers that the task have been updated so that they can re-render accordingly
150
+ });
181
151
 
152
+ // Optimistically notify subscribers that the task have been updated so that they can re-render accordingly
182
153
  this.notifyUpdated(objectKey, state);
183
154
  return new Promise((resolve, reject) => {
184
155
  this.debouncedTaskToggle.set(stringKey, window.setTimeout(() => {
@@ -189,20 +160,22 @@ export class ItemStateManager {
189
160
  headers: {
190
161
  'Content-Type': 'application/json; charset=UTF-8'
191
162
  },
192
- body: JSON.stringify({ ...objectKey,
163
+ body: JSON.stringify({
164
+ ...objectKey,
193
165
  state
194
166
  })
195
167
  }
196
168
  };
197
169
  utils.requestService(this.serviceConfig, options).then(convertServiceTaskToTask).then(task => {
198
170
  this.updateCache(task);
199
- resolve(state); // Notify subscribers that the task have been updated so that they can re-render accordingly
200
-
171
+ resolve(state);
172
+ // Notify subscribers that the task have been updated so that they can re-render accordingly
201
173
  this.notifyUpdated(objectKey, state);
202
174
  }).catch(() => {
203
175
  // Undo optimistic change
204
176
  const previousState = toggleTaskState(state);
205
- this.updateCache({ ...objectKey,
177
+ this.updateCache({
178
+ ...objectKey,
206
179
  lastUpdateDate: new Date(),
207
180
  type: 'TASK',
208
181
  state: previousState
@@ -213,12 +186,10 @@ export class ItemStateManager {
213
186
  }, 500));
214
187
  });
215
188
  }
216
-
217
189
  refreshAllTasks() {
218
190
  this.queueAllItems();
219
191
  this.scheduleGetTaskState();
220
192
  }
221
-
222
193
  subscribe(objectKey, handler, item) {
223
194
  const key = objectKeyToString(objectKey);
224
195
  const handlers = this.subscribers.get(key) || [];
@@ -226,35 +197,27 @@ export class ItemStateManager {
226
197
  this.subscribers.set(key, handlers);
227
198
  this.trackedObjectKeys.set(key, objectKey);
228
199
  const cached = this.getCached(objectKey);
229
-
230
200
  if (cached) {
231
201
  this.notifyUpdated(objectKey, cached.state);
232
202
  return;
233
203
  }
234
-
235
204
  if (this.serviceConfig.disableServiceHydration && item) {
236
205
  this.updateCache(item);
237
206
  return;
238
207
  }
239
-
240
208
  this.queueItem(objectKey);
241
209
  this.scheduleGetTaskState();
242
210
  }
243
-
244
211
  unsubscribe(objectKey, handler) {
245
212
  const key = objectKeyToString(objectKey);
246
213
  const handlers = this.subscribers.get(key);
247
-
248
214
  if (!handlers) {
249
215
  return;
250
216
  }
251
-
252
217
  const index = findIndex(handlers, h => h === handler);
253
-
254
218
  if (index !== -1) {
255
219
  handlers.splice(index, 1);
256
220
  }
257
-
258
221
  if (handlers.length === 0) {
259
222
  this.subscribers.delete(key);
260
223
  this.trackedObjectKeys.delete(key);
@@ -262,7 +225,6 @@ export class ItemStateManager {
262
225
  this.subscribers.set(key, handlers);
263
226
  }
264
227
  }
265
-
266
228
  getTaskState(keys) {
267
229
  const options = {
268
230
  path: 'tasks/state',
@@ -278,67 +240,53 @@ export class ItemStateManager {
278
240
  };
279
241
  return utils.requestService(this.serviceConfig, options);
280
242
  }
281
-
282
243
  notifyUpdated(objectKey, state) {
283
244
  const key = objectKeyToString(objectKey);
284
245
  const handlers = this.subscribers.get(key);
285
-
286
246
  if (!handlers) {
287
247
  return;
288
248
  }
289
-
290
249
  handlers.forEach(handler => {
291
250
  handler(state);
292
251
  });
293
252
  }
294
-
295
253
  updateCache(item) {
296
254
  const stringKey = objectKeyToString(toObjectKey(item));
297
255
  this.cachedItems.set(stringKey, item);
298
256
  }
299
-
300
257
  getCached(objectKey) {
301
258
  return this.cachedItems.get(objectKeyToString(objectKey));
302
259
  }
303
-
304
260
  subscribeToPubSubEvents() {
305
261
  if (this.serviceConfig.pubSubClient) {
306
262
  this.serviceConfig.pubSubClient.on(ACTION_STATE_CHANGED_FPS_EVENT, this.onTaskUpdatedEvent);
307
263
  this.serviceConfig.pubSubClient.on(PubSubSpecialEventType.RECONNECT, this.onReconnect);
308
264
  }
309
265
  }
310
-
311
266
  unsubscribeFromPubSubEvents() {
312
267
  if (this.serviceConfig.pubSubClient) {
313
268
  this.serviceConfig.pubSubClient.off(ACTION_STATE_CHANGED_FPS_EVENT, this.onTaskUpdatedEvent);
314
269
  this.serviceConfig.pubSubClient.off(PubSubSpecialEventType.RECONNECT, this.onReconnect);
315
270
  }
316
271
  }
317
-
318
272
  queueAllItems() {
319
273
  this.batchedKeys = new Map(this.trackedObjectKeys);
320
274
  }
321
-
322
275
  queueItem(objectKey) {
323
276
  const key = objectKeyToString(objectKey);
324
-
325
277
  if (this.batchedKeys.get(key)) {
326
278
  return;
327
279
  }
328
-
329
280
  this.batchedKeys.set(key, objectKey);
330
281
  }
331
-
332
282
  dequeueItem(objectKey) {
333
283
  const key = objectKeyToString(objectKey);
334
284
  this.batchedKeys.delete(key);
335
285
  }
336
-
337
286
  scheduleGetTaskState() {
338
287
  if (this.debouncedTaskStateQuery) {
339
288
  clearTimeout(this.debouncedTaskStateQuery);
340
289
  }
341
-
342
290
  this.debouncedTaskStateQuery = window.setTimeout(() => {
343
291
  this.getTaskState(Array.from(this.batchedKeys.values())).then(tasks => {
344
292
  tasks.forEach(task => {
@@ -357,43 +305,35 @@ export class ItemStateManager {
357
305
  });
358
306
  }, 1);
359
307
  }
360
-
361
308
  }
362
309
  export default class TaskDecisionResource {
363
310
  constructor(serviceConfig) {
364
311
  this.recentUpdates = new RecentUpdates(serviceConfig.pubSubClient);
365
312
  this.itemStateManager = new ItemStateManager(serviceConfig);
366
313
  }
367
-
368
314
  unsubscribeRecentUpdates(id) {
369
315
  this.recentUpdates.unsubscribe(id);
370
316
  }
371
-
372
317
  notifyRecentUpdates(recentUpdateContext) {
373
318
  this.recentUpdates.notify(recentUpdateContext);
374
319
  this.itemStateManager.refreshAllTasks();
375
320
  }
376
-
377
321
  toggleTask(objectKey, state) {
378
322
  return this.itemStateManager.toggleTask(objectKey, state);
379
323
  }
380
-
381
324
  subscribe(objectKey, handler, item) {
382
325
  this.itemStateManager.subscribe(objectKey, handler, item);
383
326
  }
384
-
385
327
  unsubscribe(objectKey, handler) {
386
328
  this.itemStateManager.unsubscribe(objectKey, handler);
387
329
  }
330
+
388
331
  /**
389
332
  * Usually only needed for testing to ensure no outstanding requests
390
333
  * are sent to a server (typically mocked).
391
334
  */
392
-
393
-
394
335
  destroy() {
395
336
  this.recentUpdates.destroy();
396
337
  this.itemStateManager.destroy();
397
338
  }
398
-
399
339
  }
@@ -32,7 +32,6 @@ export const findIndex = (array, predicate) => {
32
32
  index = i;
33
33
  return true;
34
34
  }
35
-
36
35
  return false;
37
36
  });
38
37
  return index;
@@ -1,11 +1,11 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
4
5
  import Item from './Item';
5
6
  import { G200, G400, N100 } from '@atlaskit/theme/colors';
6
7
  import { themed, useGlobalTheme } from '@atlaskit/theme/components';
7
8
  import { gridSize } from '@atlaskit/theme/constants';
8
-
9
9
  const iconStyles = showPlaceholder => theme => {
10
10
  return css({
11
11
  flex: '0 0 16px',
@@ -23,7 +23,6 @@ const iconStyles = showPlaceholder => theme => {
23
23
  }
24
24
  });
25
25
  };
26
-
27
26
  const DecisionItem = ({
28
27
  appearance,
29
28
  children,
@@ -34,6 +33,7 @@ const DecisionItem = ({
34
33
  }) => {
35
34
  const theme = useGlobalTheme();
36
35
  const icon = jsx("span", {
36
+ contentEditable: false,
37
37
  css: iconStyles(showPlaceholder)(theme)
38
38
  }, jsx(DecisionIcon, {
39
39
  label: "Decision",
@@ -50,5 +50,4 @@ const DecisionItem = ({
50
50
  theme: theme
51
51
  }, children);
52
52
  };
53
-
54
53
  export default DecisionItem;
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import React from 'react';
3
4
  import { PureComponent } from 'react';
4
5
  import { jsx } from '@emotion/react';
@@ -8,17 +9,16 @@ export default class DecisionList extends PureComponent {
8
9
  const {
9
10
  children
10
11
  } = this.props;
11
-
12
12
  if (!children) {
13
13
  return null;
14
- } // Data attributes are required for copy and paste from rendered content
14
+ }
15
+
16
+ // Data attributes are required for copy and paste from rendered content
15
17
  // to the editor to preserve the decision.
16
18
  // This allows the editor to differentiate between numbered and ordered lists,
17
19
  // and action items, which all share the common `<li>` element.
18
20
  // The value of `data-decision-local-id` should be discarded upon paste, with a
19
21
  // a new uuid generated by the editor for the cloned content.
20
-
21
-
22
22
  return jsx("ol", {
23
23
  css: decisionListStyles,
24
24
  "data-decision-list-local-id": "",
@@ -34,5 +34,4 @@ export default class DecisionList extends PureComponent {
34
34
  }, child);
35
35
  }));
36
36
  }
37
-
38
37
  }
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  /** @jsx jsx */
4
+
5
5
  import { PureComponent } from 'react';
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { themed } from '@atlaskit/theme/components';
@@ -19,7 +19,6 @@ const taskStyles = css({
19
19
  padding: '6px 3px',
20
20
  position: 'relative'
21
21
  });
22
-
23
22
  const decisionStyles = theme => css({
24
23
  display: 'flex',
25
24
  flexDirection: 'row',
@@ -38,7 +37,6 @@ const decisionStyles = theme => css({
38
37
  cursor: 'initial'
39
38
  }
40
39
  });
41
-
42
40
  const placeHolderStyles = offset => css({
43
41
  margin: `0 0 0 ${offset}px`,
44
42
  position: 'absolute',
@@ -49,7 +47,6 @@ const placeHolderStyles = offset => css({
49
47
  whiteSpace: 'nowrap',
50
48
  maxWidth: 'calc(100% - 50px)'
51
49
  });
52
-
53
50
  export default class Item extends PureComponent {
54
51
  renderPlaceholder() {
55
52
  const {
@@ -58,11 +55,9 @@ export default class Item extends PureComponent {
58
55
  showPlaceholder,
59
56
  itemType
60
57
  } = this.props;
61
-
62
58
  if (!showPlaceholder || !placeholder || children) {
63
59
  return null;
64
60
  }
65
-
66
61
  const offset = gridSize() * (itemType === 'TASK' ? 3 : 3.5);
67
62
  return jsx("span", {
68
63
  "data-component": "placeholder",
@@ -70,7 +65,6 @@ export default class Item extends PureComponent {
70
65
  contentEditable: false
71
66
  }, placeholder);
72
67
  }
73
-
74
68
  renderMessageAppearance() {
75
69
  const {
76
70
  contentRef,
@@ -81,7 +75,6 @@ export default class Item extends PureComponent {
81
75
  dataAttributes,
82
76
  theme
83
77
  } = this.props;
84
-
85
78
  if (itemType === 'TASK') {
86
79
  return jsx("div", {
87
80
  css: taskStyles,
@@ -101,16 +94,12 @@ export default class Item extends PureComponent {
101
94
  ref: contentRef
102
95
  }, dataAttributes), children));
103
96
  }
104
-
105
97
  return null;
106
98
  }
107
-
108
99
  render() {
109
100
  return this.renderMessageAppearance();
110
101
  }
111
-
112
102
  }
113
-
114
103
  _defineProperty(Item, "defaultProps", {
115
104
  appearance: 'inline'
116
105
  });
@@ -6,39 +6,35 @@ import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-c
6
6
  export default class ResourcedTaskItem extends PureComponent {
7
7
  constructor(props) {
8
8
  super(props);
9
-
10
9
  _defineProperty(this, "mounted", false);
11
-
12
10
  _defineProperty(this, "onUpdate", state => {
13
11
  this.setState({
14
12
  isDone: state === 'DONE'
15
13
  });
16
14
  });
17
-
18
15
  _defineProperty(this, "handleOnChange", (taskId, isDone) => {
19
16
  const {
20
17
  taskDecisionProvider,
21
18
  objectAri,
22
19
  onChange
23
- } = this.props; // Optimistically update the task
24
-
20
+ } = this.props;
21
+ // Optimistically update the task
25
22
  this.setState({
26
23
  isDone
27
24
  });
28
-
29
25
  if (taskDecisionProvider && objectAri) {
30
26
  // Call provider to update task
31
27
  taskDecisionProvider.then(provider => {
32
28
  if (!this.mounted) {
33
29
  return;
34
30
  }
35
-
36
31
  provider.toggleTask({
37
32
  localId: taskId,
38
33
  objectAri
39
- }, isDone ? 'DONE' : 'TODO'); // onChange could trigger a rerender, in order to get the correct state
40
- // we should only call onChange once the internal state have been modified
34
+ }, isDone ? 'DONE' : 'TODO');
41
35
 
36
+ // onChange could trigger a rerender, in order to get the correct state
37
+ // we should only call onChange once the internal state have been modified
42
38
  if (onChange) {
43
39
  onChange(taskId, isDone);
44
40
  }
@@ -50,17 +46,14 @@ export default class ResourcedTaskItem extends PureComponent {
50
46
  }
51
47
  }
52
48
  });
53
-
54
49
  this.state = {
55
50
  isDone: props.isDone
56
51
  };
57
52
  }
58
-
59
53
  componentDidMount() {
60
54
  this.mounted = true;
61
55
  this.subscribe(this.props.taskDecisionProvider, this.props.objectAri, this.props.isDone);
62
56
  }
63
-
64
57
  UNSAFE_componentWillReceiveProps(nextProps) {
65
58
  if (nextProps.isDone !== this.props.isDone) {
66
59
  // This only occurs for Actions (DONE vs TODO), since Decisions only support DECIDED.
@@ -68,25 +61,21 @@ export default class ResourcedTaskItem extends PureComponent {
68
61
  // source of truth from the revised data.
69
62
  this.onUpdate(nextProps.isDone ? 'DONE' : 'TODO');
70
63
  }
71
-
72
64
  if (nextProps.taskDecisionProvider !== this.props.taskDecisionProvider || nextProps.objectAri !== this.props.objectAri) {
73
65
  this.unsubscribe();
74
66
  this.subscribe(nextProps.taskDecisionProvider, nextProps.objectAri, nextProps.isDone);
75
67
  }
76
68
  }
77
-
78
69
  componentWillUnmount() {
79
70
  this.unsubscribe();
80
71
  this.mounted = false;
81
72
  }
82
-
83
73
  subscribe(taskDecisionProvider, objectAri, isDone) {
84
74
  if (taskDecisionProvider && objectAri) {
85
75
  taskDecisionProvider.then(provider => {
86
76
  if (!this.mounted) {
87
77
  return;
88
78
  }
89
-
90
79
  const {
91
80
  taskId
92
81
  } = this.props;
@@ -94,7 +83,8 @@ export default class ResourcedTaskItem extends PureComponent {
94
83
  localId: taskId,
95
84
  objectAri
96
85
  };
97
- const item = { ...objectKey,
86
+ const item = {
87
+ ...objectKey,
98
88
  state: isDone ? 'DONE' : 'TODO',
99
89
  lastUpdateDate: new Date(),
100
90
  type: 'TASK'
@@ -106,14 +96,12 @@ export default class ResourcedTaskItem extends PureComponent {
106
96
  });
107
97
  }
108
98
  }
109
-
110
99
  unsubscribe() {
111
100
  const {
112
101
  taskDecisionProvider,
113
102
  taskId,
114
103
  objectAri
115
104
  } = this.props;
116
-
117
105
  if (taskDecisionProvider && objectAri) {
118
106
  taskDecisionProvider.then(provider => {
119
107
  provider.unsubscribe({
@@ -123,7 +111,6 @@ export default class ResourcedTaskItem extends PureComponent {
123
111
  });
124
112
  }
125
113
  }
126
-
127
114
  render() {
128
115
  const {
129
116
  isDone
@@ -157,9 +144,7 @@ export default class ResourcedTaskItem extends PureComponent {
157
144
  dataAttributes: dataAttributes
158
145
  }, children));
159
146
  }
160
-
161
147
  }
162
-
163
148
  _defineProperty(ResourcedTaskItem, "defaultProps", {
164
149
  appearance: 'inline'
165
150
  });
@@ -8,9 +8,7 @@ import { gridSize } from '@atlaskit/theme/constants';
8
8
  import { themed, useGlobalTheme } from '@atlaskit/theme/components';
9
9
  import { B300, B75, DN100, DN200, N0, N30, N90 } from '@atlaskit/theme/colors';
10
10
  let taskCount = 0;
11
-
12
11
  const getCheckBoxId = localId => `${localId}-${taskCount++}`;
13
-
14
12
  const checkboxStyles = isRenderer => theme => css`
15
13
  flex: 0 0 16px;
16
14
  width: 16px;
@@ -107,7 +105,6 @@ const checkboxStyles = isRenderer => theme => css`
107
105
  }
108
106
  }
109
107
  `;
110
-
111
108
  const TaskItem = props => {
112
109
  const {
113
110
  appearance,
@@ -128,13 +125,10 @@ const TaskItem = props => {
128
125
  const handleOnChange = useMemo(() => {
129
126
  return _evt => {
130
127
  const newIsDone = !isDone;
131
-
132
128
  if (onChange) {
133
129
  onChange(taskId, newIsDone);
134
130
  }
135
-
136
131
  const action = newIsDone ? 'checked' : 'unchecked';
137
-
138
132
  if (createAnalyticsEvent) {
139
133
  createAndFireEventInElementsChannel({
140
134
  action,
@@ -177,8 +171,9 @@ const TaskItem = props => {
177
171
  checkBoxId: checkBoxId,
178
172
  theme: theme
179
173
  }, children);
180
- }; // This is to ensure that the "type" is exported, as it gets lost and not exported along with TaskItem after
181
- // going through the high order component.
174
+ };
182
175
 
176
+ // This is to ensure that the "type" is exported, as it gets lost and not exported along with TaskItem after
177
+ // going through the high order component.
183
178
 
184
179
  export default withAnalyticsEvents()(TaskItem);