@atlaskit/link-datasource 1.15.1 → 1.15.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 1.15.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#42661](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42661) [`c6abc68904d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c6abc68904d) - [ux] Fix date showing incorrectly and also update test data to check for the format it was failing for
8
+
9
+ ## 1.15.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#42738](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42738) [`95e6223ddb8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/95e6223ddb8) - Add macro inserted analytics event for jlol smart link insertions
14
+
3
15
  ## 1.15.1
4
16
 
5
17
  ### Patch Changes
@@ -7,5 +7,5 @@ exports.packageMetaData = exports.EVENT_CHANNEL = void 0;
7
7
  var EVENT_CHANNEL = exports.EVENT_CHANNEL = 'media';
8
8
  var packageMetaData = exports.packageMetaData = {
9
9
  packageName: "@atlaskit/link-datasource",
10
- packageVersion: "1.15.1"
10
+ packageVersion: "1.15.3"
11
11
  };
@@ -32,8 +32,14 @@ var DateTimeRenderType = function DateTimeRenderType(_ref) {
32
32
  testId = _ref$testId === void 0 ? DATETIME_TYPE_TEST_ID : _ref$testId,
33
33
  _ref$display = _ref.display,
34
34
  display = _ref$display === void 0 ? 'datetime' : _ref$display;
35
- var date = new Date(value);
36
35
  var intl = (0, _reactIntlNext.useIntl)();
36
+ /* In some cases we get a value of `2023-12-20` which when parsed by JS assumes meantime timezone, causing the date
37
+ to be one day off in some timezones. We want it to display the date without converting timezones and a solution
38
+ is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
39
+ See https://stackoverflow.com/a/31732581
40
+ */
41
+ var dateValue = /^\d{4}-\d{2}-\d{2}$/.exec(value) ? value.replace(/-/g, '/') : value;
42
+ var date = new Date(dateValue);
37
43
  if (!value || isNaN(date.getTime())) {
38
44
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
39
45
  }
@@ -350,10 +350,28 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
350
350
  }),
351
351
  eventType: 'ui'
352
352
  });
353
+
354
+ // additional event for tracking in confluence against JIM
355
+ var macroInsertedEvent = analyticsEvent.clone();
356
+ macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.update({
357
+ eventType: 'track',
358
+ action: 'inserted',
359
+ actionSubject: 'macro',
360
+ actionSubjectId: 'jlol',
361
+ attributes: _objectSpread(_objectSpread({}, analyticsPayload), {}, {
362
+ totalItemCount: totalCount || 0,
363
+ displayedColumnCount: visibleColumnCount.current,
364
+ display: getDisplayValue(currentViewMode, totalCount || 0),
365
+ searchCount: searchCount.current,
366
+ searchMethod: (0, _utils.mapSearchMethod)(searchMethodSearchedWith.current),
367
+ actions: Array.from(userInteractionActions.current)
368
+ })
369
+ });
353
370
  var consumerEvent = (_insertButtonClickedE = insertButtonClickedEvent.clone()) !== null && _insertButtonClickedE !== void 0 ? _insertButtonClickedE : undefined;
354
371
  insertButtonClickedEvent.fire(_analytics.EVENT_CHANNEL);
355
372
  var firstIssueUrl = retrieveUrlForSmartCardRender();
356
373
  if (currentViewMode === 'count') {
374
+ macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(_analytics.EVENT_CHANNEL);
357
375
  onInsert({
358
376
  type: 'inlineCard',
359
377
  attrs: {
@@ -361,6 +379,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
361
379
  }
362
380
  }, consumerEvent);
363
381
  } else if (responseItems.length === 1 && firstIssueUrl) {
382
+ macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(_analytics.EVENT_CHANNEL);
364
383
  onInsert({
365
384
  type: 'inlineCard',
366
385
  attrs: {
@@ -1,5 +1,5 @@
1
1
  export const EVENT_CHANNEL = 'media';
2
2
  export const packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.15.1"
4
+ packageVersion: "1.15.3"
5
5
  };
@@ -21,8 +21,14 @@ const DateTimeRenderType = ({
21
21
  testId = DATETIME_TYPE_TEST_ID,
22
22
  display = 'datetime'
23
23
  }) => {
24
- const date = new Date(value);
25
24
  const intl = useIntl();
25
+ /* In some cases we get a value of `2023-12-20` which when parsed by JS assumes meantime timezone, causing the date
26
+ to be one day off in some timezones. We want it to display the date without converting timezones and a solution
27
+ is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
28
+ See https://stackoverflow.com/a/31732581
29
+ */
30
+ const dateValue = /^\d{4}-\d{2}-\d{2}$/.exec(value) ? value.replace(/-/g, '/') : value;
31
+ const date = new Date(dateValue);
26
32
  if (!value || isNaN(date.getTime())) {
27
33
  return /*#__PURE__*/React.createElement(React.Fragment, null);
28
34
  }
@@ -299,10 +299,29 @@ export const PlainJiraIssuesConfigModal = props => {
299
299
  },
300
300
  eventType: 'ui'
301
301
  });
302
+
303
+ // additional event for tracking in confluence against JIM
304
+ const macroInsertedEvent = analyticsEvent.clone();
305
+ macroInsertedEvent === null || macroInsertedEvent === void 0 ? void 0 : macroInsertedEvent.update({
306
+ eventType: 'track',
307
+ action: 'inserted',
308
+ actionSubject: 'macro',
309
+ actionSubjectId: 'jlol',
310
+ attributes: {
311
+ ...analyticsPayload,
312
+ totalItemCount: totalCount || 0,
313
+ displayedColumnCount: visibleColumnCount.current,
314
+ display: getDisplayValue(currentViewMode, totalCount || 0),
315
+ searchCount: searchCount.current,
316
+ searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
317
+ actions: Array.from(userInteractionActions.current)
318
+ }
319
+ });
302
320
  const consumerEvent = (_insertButtonClickedE = insertButtonClickedEvent.clone()) !== null && _insertButtonClickedE !== void 0 ? _insertButtonClickedE : undefined;
303
321
  insertButtonClickedEvent.fire(EVENT_CHANNEL);
304
322
  const firstIssueUrl = retrieveUrlForSmartCardRender();
305
323
  if (currentViewMode === 'count') {
324
+ macroInsertedEvent === null || macroInsertedEvent === void 0 ? void 0 : macroInsertedEvent.fire(EVENT_CHANNEL);
306
325
  onInsert({
307
326
  type: 'inlineCard',
308
327
  attrs: {
@@ -310,6 +329,7 @@ export const PlainJiraIssuesConfigModal = props => {
310
329
  }
311
330
  }, consumerEvent);
312
331
  } else if (responseItems.length === 1 && firstIssueUrl) {
332
+ macroInsertedEvent === null || macroInsertedEvent === void 0 ? void 0 : macroInsertedEvent.fire(EVENT_CHANNEL);
313
333
  onInsert({
314
334
  type: 'inlineCard',
315
335
  attrs: {
@@ -1,5 +1,5 @@
1
1
  export var EVENT_CHANNEL = 'media';
2
2
  export var packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.15.1"
4
+ packageVersion: "1.15.3"
5
5
  };
@@ -25,8 +25,14 @@ var DateTimeRenderType = function DateTimeRenderType(_ref) {
25
25
  testId = _ref$testId === void 0 ? DATETIME_TYPE_TEST_ID : _ref$testId,
26
26
  _ref$display = _ref.display,
27
27
  display = _ref$display === void 0 ? 'datetime' : _ref$display;
28
- var date = new Date(value);
29
28
  var intl = useIntl();
29
+ /* In some cases we get a value of `2023-12-20` which when parsed by JS assumes meantime timezone, causing the date
30
+ to be one day off in some timezones. We want it to display the date without converting timezones and a solution
31
+ is to replace the hyphens with slashes. So it should be 20th Dec regardless of the timezone in this case.
32
+ See https://stackoverflow.com/a/31732581
33
+ */
34
+ var dateValue = /^\d{4}-\d{2}-\d{2}$/.exec(value) ? value.replace(/-/g, '/') : value;
35
+ var date = new Date(dateValue);
30
36
  if (!value || isNaN(date.getTime())) {
31
37
  return /*#__PURE__*/React.createElement(React.Fragment, null);
32
38
  }
@@ -341,10 +341,28 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
341
341
  }),
342
342
  eventType: 'ui'
343
343
  });
344
+
345
+ // additional event for tracking in confluence against JIM
346
+ var macroInsertedEvent = analyticsEvent.clone();
347
+ macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.update({
348
+ eventType: 'track',
349
+ action: 'inserted',
350
+ actionSubject: 'macro',
351
+ actionSubjectId: 'jlol',
352
+ attributes: _objectSpread(_objectSpread({}, analyticsPayload), {}, {
353
+ totalItemCount: totalCount || 0,
354
+ displayedColumnCount: visibleColumnCount.current,
355
+ display: getDisplayValue(currentViewMode, totalCount || 0),
356
+ searchCount: searchCount.current,
357
+ searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
358
+ actions: Array.from(userInteractionActions.current)
359
+ })
360
+ });
344
361
  var consumerEvent = (_insertButtonClickedE = insertButtonClickedEvent.clone()) !== null && _insertButtonClickedE !== void 0 ? _insertButtonClickedE : undefined;
345
362
  insertButtonClickedEvent.fire(EVENT_CHANNEL);
346
363
  var firstIssueUrl = retrieveUrlForSmartCardRender();
347
364
  if (currentViewMode === 'count') {
365
+ macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(EVENT_CHANNEL);
348
366
  onInsert({
349
367
  type: 'inlineCard',
350
368
  attrs: {
@@ -352,6 +370,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
352
370
  }
353
371
  }, consumerEvent);
354
372
  } else if (responseItems.length === 1 && firstIssueUrl) {
373
+ macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(EVENT_CHANNEL);
355
374
  onInsert({
356
375
  type: 'inlineCard',
357
376
  attrs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"