@atlaskit/link-picker 1.8.0 → 1.8.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`afd2368145a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/afd2368145a) - Added link picker mount/unmount analytic events
8
+
3
9
  ## 1.8.0
4
10
 
5
11
  ### Minor Changes
@@ -10,16 +10,16 @@ exports.default = void 0;
10
10
  *
11
11
  * Generates analytics utilities from the package analytics spec yaml
12
12
  *
13
- * @codegen <<SignedSource::0cc1b4d9c22b31491ded3e581114ab2c>>
13
+ * @codegen <<SignedSource::ffa7ec78cc793f941d06cdb25b07dc8a>>
14
14
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
15
15
  */
16
16
  function createEventPayload(eventKey, attributes) {
17
17
  var event = eventKey.split('.');
18
18
  return {
19
- eventType: 'ui',
20
- actionSubject: event[0],
21
- action: event[1],
22
- actionSubjectId: event[2],
19
+ eventType: event[0],
20
+ actionSubject: event[1],
21
+ action: event[2],
22
+ actionSubjectId: event[3],
23
23
  attributes: attributes
24
24
  };
25
25
  }
@@ -154,6 +154,16 @@ function LinkPicker(_ref) {
154
154
  var isEditing = !!initUrl;
155
155
  var selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
156
156
  var isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
157
+ (0, _react.useEffect)(function () {
158
+ // Anything in here is fired on component mount.
159
+ var event = createAnalyticsEvent((0, _analytics.default)('ui.inlineDialog.viewed.linkPicker', {}));
160
+ event.fire(_constants.ANALYTICS_CHANNEL);
161
+ return function () {
162
+ // Anything in here is fired on component unmount.
163
+ var event = createAnalyticsEvent((0, _analytics.default)('ui.inlineDialog.closed.linkPicker', {}));
164
+ event.fire(_constants.ANALYTICS_CHANNEL);
165
+ };
166
+ }, [createAnalyticsEvent]);
157
167
  (0, _react.useLayoutEffect)(function () {
158
168
  if (onContentResize) {
159
169
  onContentResize();
@@ -226,7 +236,7 @@ function LinkPicker(_ref) {
226
236
  }
227
237
  }, [activeIndex, items]);
228
238
  var handleInsert = (0, _react.useCallback)(function (url, title, inputType) {
229
- var event = createAnalyticsEvent((0, _analytics.default)('form.submitted.linkPicker', {}));
239
+ var event = createAnalyticsEvent((0, _analytics.default)('ui.form.submitted.linkPicker', {}));
230
240
  event.fire(_constants.ANALYTICS_CHANNEL);
231
241
  onSubmit(_objectSpread({
232
242
  url: url,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "sideEffects": false
5
5
  }
@@ -3,16 +3,16 @@
3
3
  *
4
4
  * Generates analytics utilities from the package analytics spec yaml
5
5
  *
6
- * @codegen <<SignedSource::0cc1b4d9c22b31491ded3e581114ab2c>>
6
+ * @codegen <<SignedSource::ffa7ec78cc793f941d06cdb25b07dc8a>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  function createEventPayload(eventKey, attributes) {
10
10
  const event = eventKey.split('.');
11
11
  return {
12
- eventType: 'ui',
13
- actionSubject: event[0],
14
- action: event[1],
15
- actionSubjectId: event[2],
12
+ eventType: event[0],
13
+ actionSubject: event[1],
14
+ action: event[2],
15
+ actionSubjectId: event[3],
16
16
  attributes: attributes
17
17
  };
18
18
  }
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { Fragment, useCallback, useLayoutEffect, useReducer } from 'react';
4
+ import { Fragment, useCallback, useEffect, useLayoutEffect, useReducer } from 'react';
5
5
  import { jsx } from '@emotion/react';
6
6
  import { useIntl, FormattedMessage } from 'react-intl-next';
7
7
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
@@ -106,6 +106,16 @@ function LinkPicker({
106
106
  const isEditing = !!initUrl;
107
107
  const selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
108
108
  const isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
109
+ useEffect(() => {
110
+ // Anything in here is fired on component mount.
111
+ const event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.viewed.linkPicker', {}));
112
+ event.fire(ANALYTICS_CHANNEL);
113
+ return () => {
114
+ // Anything in here is fired on component unmount.
115
+ const event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.closed.linkPicker', {}));
116
+ event.fire(ANALYTICS_CHANNEL);
117
+ };
118
+ }, [createAnalyticsEvent]);
109
119
  useLayoutEffect(() => {
110
120
  if (onContentResize) {
111
121
  onContentResize();
@@ -178,7 +188,7 @@ function LinkPicker({
178
188
  }
179
189
  }, [activeIndex, items]);
180
190
  const handleInsert = useCallback((url, title, inputType) => {
181
- const event = createAnalyticsEvent(createEventPayload('form.submitted.linkPicker', {}));
191
+ const event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {}));
182
192
  event.fire(ANALYTICS_CHANNEL);
183
193
  onSubmit({
184
194
  url,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "sideEffects": false
5
5
  }
@@ -3,16 +3,16 @@
3
3
  *
4
4
  * Generates analytics utilities from the package analytics spec yaml
5
5
  *
6
- * @codegen <<SignedSource::0cc1b4d9c22b31491ded3e581114ab2c>>
6
+ * @codegen <<SignedSource::ffa7ec78cc793f941d06cdb25b07dc8a>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  function createEventPayload(eventKey, attributes) {
10
10
  var event = eventKey.split('.');
11
11
  return {
12
- eventType: 'ui',
13
- actionSubject: event[0],
14
- action: event[1],
15
- actionSubjectId: event[2],
12
+ eventType: event[0],
13
+ actionSubject: event[1],
14
+ action: event[2],
15
+ actionSubjectId: event[3],
16
16
  attributes: attributes
17
17
  };
18
18
  }
@@ -7,7 +7,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
7
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
8
 
9
9
  /** @jsx jsx */
10
- import { Fragment, useCallback, useLayoutEffect, useReducer } from 'react';
10
+ import { Fragment, useCallback, useEffect, useLayoutEffect, useReducer } from 'react';
11
11
  import { jsx } from '@emotion/react';
12
12
  import { useIntl, FormattedMessage } from 'react-intl-next';
13
13
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
@@ -112,6 +112,16 @@ function LinkPicker(_ref) {
112
112
  var isEditing = !!initUrl;
113
113
  var selectedItem = items === null || items === void 0 ? void 0 : items[selectedIndex];
114
114
  var isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.url) === url;
115
+ useEffect(function () {
116
+ // Anything in here is fired on component mount.
117
+ var event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.viewed.linkPicker', {}));
118
+ event.fire(ANALYTICS_CHANNEL);
119
+ return function () {
120
+ // Anything in here is fired on component unmount.
121
+ var event = createAnalyticsEvent(createEventPayload('ui.inlineDialog.closed.linkPicker', {}));
122
+ event.fire(ANALYTICS_CHANNEL);
123
+ };
124
+ }, [createAnalyticsEvent]);
115
125
  useLayoutEffect(function () {
116
126
  if (onContentResize) {
117
127
  onContentResize();
@@ -184,7 +194,7 @@ function LinkPicker(_ref) {
184
194
  }
185
195
  }, [activeIndex, items]);
186
196
  var handleInsert = useCallback(function (url, title, inputType) {
187
- var event = createAnalyticsEvent(createEventPayload('form.submitted.linkPicker', {}));
197
+ var event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {}));
188
198
  event.fire(ANALYTICS_CHANNEL);
189
199
  onSubmit(_objectSpread({
190
200
  url: url,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "sideEffects": false
5
5
  }
@@ -3,12 +3,16 @@
3
3
  *
4
4
  * Generates analytics utilities from the package analytics spec yaml
5
5
  *
6
- * @codegen <<SignedSource::0cc1b4d9c22b31491ded3e581114ab2c>>
6
+ * @codegen <<SignedSource::ffa7ec78cc793f941d06cdb25b07dc8a>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-picker run codegen-analytics
8
8
  */
9
9
  declare type FormSubmittedLinkPickerAttributesType = {};
10
+ declare type InlineDialogViewedLinkPickerAttributesType = {};
11
+ declare type InlineDialogClosedLinkPickerAttributesType = {};
10
12
  declare type AnalyticsEventAttributes = {
11
- 'form.submitted.linkPicker': FormSubmittedLinkPickerAttributesType;
13
+ 'ui.form.submitted.linkPicker': FormSubmittedLinkPickerAttributesType;
14
+ 'ui.inlineDialog.viewed.linkPicker': InlineDialogViewedLinkPickerAttributesType;
15
+ 'ui.inlineDialog.closed.linkPicker': InlineDialogClosedLinkPickerAttributesType;
12
16
  };
13
17
  declare function createEventPayload<K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]): {
14
18
  eventType: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/webdriver-runner": "*",
65
65
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
66
66
  "@atlassian/link-picker-atlassian-plugin": "^18.0.0",
67
- "@atlassian/link-picker-plugins": "^5.0.0",
67
+ "@atlassian/link-picker-plugins": "^5.1.0",
68
68
  "@atlassian/recent-work-client": "^1.5.0",
69
69
  "@atlassian/search-provider": "^2.3.0",
70
70
  "@testing-library/dom": "^7.7.3",
@@ -76,6 +76,7 @@
76
76
  "enzyme": "^3.10.0",
77
77
  "fetch-mock": "^8.0.0",
78
78
  "js-yaml": "^3.13.1",
79
+ "lodash": "^4.17.21",
79
80
  "mockdate": "^3.0.2",
80
81
  "prettier": "^2.1.1",
81
82
  "react-dom": "^16.8.0",