@atlaskit/link-picker 1.8.5 → 1.9.0

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.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`26ca68a3993`](https://bitbucket.org/atlassian/atlassian-frontend/commits/26ca68a3993) - Add support for the onSubmit handler prop to receive a second argument, being a clone of the form submitted analytic event
8
+
3
9
  ## 1.8.5
4
10
 
5
11
  ### Patch Changes
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.ComposedLinkPicker = void 0;
8
+ exports.PACKAGE_DATA = exports.ComposedLinkPicker = void 0;
9
9
 
10
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
11
 
@@ -32,6 +32,7 @@ var PACKAGE_DATA = {
32
32
  packageVersion: _version.version,
33
33
  componentName: _constants.COMPONENT_NAME
34
34
  };
35
+ exports.PACKAGE_DATA = PACKAGE_DATA;
35
36
  var LazyLinkPicker = (0, _reactLooselyLazy.lazyForPaint)(function () {
36
37
  return Promise.resolve().then(function () {
37
38
  return _interopRequireWildcard(require('./link-picker'));
@@ -232,7 +232,11 @@ function LinkPicker(_ref) {
232
232
  }
233
233
  }, [activeIndex, items]);
234
234
  var handleInsert = (0, _react.useCallback)(function (url, title, inputType) {
235
- var event = createAnalyticsEvent((0, _analytics.default)('ui.form.submitted.linkPicker', {}));
235
+ var event = createAnalyticsEvent((0, _analytics.default)('ui.form.submitted.linkPicker', {})); // Clone the event so that it can be emitted for consumer usage
236
+ // This must happen BEFORE the original event is fired!
237
+
238
+ var consumerEvent = event.clone(); // Dispatch the original event to our channel
239
+
236
240
  event.fire(_constants.ANALYTICS_CHANNEL);
237
241
  onSubmit(_objectSpread({
238
242
  url: url,
@@ -243,7 +247,7 @@ function LinkPicker(_ref) {
243
247
  }
244
248
  }, inputType === 'manual' ? {
245
249
  rawUrl: state.url
246
- } : {}));
250
+ } : {}), consumerEvent);
247
251
  }, [displayText, onSubmit, state.url, createAnalyticsEvent]);
248
252
  var handleSelected = (0, _react.useCallback)(function (objectId) {
249
253
  var selectedItem = items === null || items === void 0 ? void 0 : items.find(function (item) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.5",
3
+ "version": "1.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -5,7 +5,7 @@ import { COMPONENT_NAME, ANALYTICS_CHANNEL } from '../common/constants';
5
5
  import { name as packageName, version as packageVersion } from '../version.json';
6
6
  import { ErrorBoundaryFallback } from './error-boundary-fallback';
7
7
  import { LoaderFallback } from './loader-fallback';
8
- const PACKAGE_DATA = {
8
+ export const PACKAGE_DATA = {
9
9
  packageName,
10
10
  packageVersion,
11
11
  componentName: COMPONENT_NAME
@@ -184,7 +184,11 @@ function LinkPicker({
184
184
  }
185
185
  }, [activeIndex, items]);
186
186
  const handleInsert = useCallback((url, title, inputType) => {
187
- const event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {}));
187
+ const event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {})); // Clone the event so that it can be emitted for consumer usage
188
+ // This must happen BEFORE the original event is fired!
189
+
190
+ const consumerEvent = event.clone(); // Dispatch the original event to our channel
191
+
188
192
  event.fire(ANALYTICS_CHANNEL);
189
193
  onSubmit({
190
194
  url,
@@ -196,7 +200,7 @@ function LinkPicker({
196
200
  ...(inputType === 'manual' ? {
197
201
  rawUrl: state.url
198
202
  } : {})
199
- });
203
+ }, consumerEvent);
200
204
  }, [displayText, onSubmit, state.url, createAnalyticsEvent]);
201
205
  const handleSelected = useCallback(objectId => {
202
206
  const selectedItem = items === null || items === void 0 ? void 0 : items.find(item => item.objectId === objectId);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.5",
3
+ "version": "1.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -5,7 +5,7 @@ import { COMPONENT_NAME, ANALYTICS_CHANNEL } from '../common/constants';
5
5
  import { name as packageName, version as packageVersion } from '../version.json';
6
6
  import { ErrorBoundaryFallback } from './error-boundary-fallback';
7
7
  import { LoaderFallback } from './loader-fallback';
8
- var PACKAGE_DATA = {
8
+ export var PACKAGE_DATA = {
9
9
  packageName: packageName,
10
10
  packageVersion: packageVersion,
11
11
  componentName: COMPONENT_NAME
@@ -188,7 +188,11 @@ function LinkPicker(_ref) {
188
188
  }
189
189
  }, [activeIndex, items]);
190
190
  var handleInsert = useCallback(function (url, title, inputType) {
191
- var event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {}));
191
+ var event = createAnalyticsEvent(createEventPayload('ui.form.submitted.linkPicker', {})); // Clone the event so that it can be emitted for consumer usage
192
+ // This must happen BEFORE the original event is fired!
193
+
194
+ var consumerEvent = event.clone(); // Dispatch the original event to our channel
195
+
192
196
  event.fire(ANALYTICS_CHANNEL);
193
197
  onSubmit(_objectSpread({
194
198
  url: url,
@@ -199,7 +203,7 @@ function LinkPicker(_ref) {
199
203
  }
200
204
  }, inputType === 'manual' ? {
201
205
  rawUrl: state.url
202
- } : {}));
206
+ } : {}), consumerEvent);
203
207
  }, [displayText, onSubmit, state.url, createAnalyticsEvent]);
204
208
  var handleSelected = useCallback(function (objectId) {
205
209
  var selectedItem = items === null || items === void 0 ? void 0 : items.find(function (item) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.5",
3
+ "version": "1.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,8 @@
1
1
  import React from 'react';
2
2
  import { LinkPickerProps } from './link-picker';
3
+ export declare const PACKAGE_DATA: {
4
+ packageName: any;
5
+ packageVersion: any;
6
+ componentName: string;
7
+ };
3
8
  export declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => JSX.Element>;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
3
  import { LinkInputType, LinkPickerPlugin } from '../types';
3
4
  export declare const RECENT_SEARCH_LIST_SIZE = 5;
4
5
  export declare const CONTACT_SUPPORT_LINK = "https://support.atlassian.com/contact/";
@@ -42,8 +43,10 @@ interface OnSubmitParameter {
42
43
  rawUrl?: string;
43
44
  }
44
45
  export interface LinkPickerProps {
45
- /** Callback to fire on form submission. */
46
- onSubmit: (arg: OnSubmitParameter) => void;
46
+ /**
47
+ * Callback to fire on form submission.
48
+ */
49
+ onSubmit: (arg: OnSubmitParameter, analytic?: UIAnalyticsEvent | null) => void;
47
50
  /** Callback to fire when the cancel button is clicked. */
48
51
  onCancel: () => void;
49
52
  /** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.8.5",
3
+ "version": "1.9.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -56,6 +56,7 @@
56
56
  "@af/codegen": "*",
57
57
  "@atlaskit/activity-provider": "^2.3.2",
58
58
  "@atlaskit/docs": "*",
59
+ "@atlaskit/link-analytics": "^1.0.0",
59
60
  "@atlaskit/link-test-helpers": "^1.4.0",
60
61
  "@atlaskit/popup": "^1.4.0",
61
62
  "@atlaskit/ssr": "*",
@@ -63,8 +64,8 @@
63
64
  "@atlaskit/visual-regression": "*",
64
65
  "@atlaskit/webdriver-runner": "*",
65
66
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
66
- "@atlassian/link-picker-atlassian-plugin": "^18.0.0",
67
- "@atlassian/link-picker-plugins": "^5.1.0",
67
+ "@atlassian/link-picker-atlassian-plugin": "^19.0.0",
68
+ "@atlassian/link-picker-plugins": "^6.0.0",
68
69
  "@atlassian/recent-work-client": "^1.6.0",
69
70
  "@atlassian/search-provider": "^2.3.0",
70
71
  "@testing-library/dom": "^8.17.1",
package/report.api.md CHANGED
@@ -10,6 +10,7 @@
10
10
  import { MessageDescriptor } from 'react-intl-next';
11
11
  import { default as React_2 } from 'react';
12
12
  import { ReactNode } from 'react';
13
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
13
14
 
14
15
  export declare type LinkInputType = 'manual' | 'typeAhead';
15
16
 
@@ -35,8 +36,13 @@ export declare type LinkPickerPluginErrorFallback = (
35
36
  ) => ReactNode;
36
37
 
37
38
  export declare interface LinkPickerProps {
38
- /** Callback to fire on form submission. */
39
- onSubmit: (arg: OnSubmitParameter) => void;
39
+ /**
40
+ * Callback to fire on form submission.
41
+ */
42
+ onSubmit: (
43
+ arg: OnSubmitParameter,
44
+ analytic?: UIAnalyticsEvent | null,
45
+ ) => void;
40
46
  /** Callback to fire when the cancel button is clicked. */
41
47
  onCancel: () => void;
42
48
  /** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */