@atlaskit/smart-card 25.0.5 → 25.0.6

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/smart-card
2
2
 
3
+ ## 25.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c85ee838eae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c85ee838eae) - [ux] Added analytics event 'appAccount authStarted' for inline smart card
8
+
3
9
  ## 25.0.5
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.0.5",
3
+ "version": "25.0.6",
4
4
  "sideEffects": false
5
5
  }
@@ -201,6 +201,7 @@ function CardWithUrlContent(_ref) {
201
201
  switch (appearance) {
202
202
  case 'inline':
203
203
  return /*#__PURE__*/_react.default.createElement(_InlineCard.InlineCard, {
204
+ analytics: analytics,
204
205
  id: id,
205
206
  url: url,
206
207
  renderers: renderers,
@@ -42,15 +42,23 @@ var InlineCardUnauthorizedView = /*#__PURE__*/function (_React$Component) {
42
42
  }
43
43
  _this = _super.call.apply(_super, [this].concat(args));
44
44
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleConnectAccount", function (event) {
45
- var onAuthorise = _this.props.onAuthorise;
45
+ var _this$props = _this.props,
46
+ analytics = _this$props.analytics,
47
+ extensionKey = _this$props.extensionKey,
48
+ onAuthorise = _this$props.onAuthorise;
46
49
  event.preventDefault();
47
50
  event.stopPropagation();
51
+ if (onAuthorise) {
52
+ analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
53
+ extensionKey: extensionKey
54
+ });
55
+ }
48
56
  return onAuthorise();
49
57
  });
50
58
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderRightSide", function () {
51
- var _this$props = _this.props,
52
- onAuthorise = _this$props.onAuthorise,
53
- context = _this$props.context;
59
+ var _this$props2 = _this.props,
60
+ onAuthorise = _this$props2.onAuthorise,
61
+ context = _this$props2.context;
54
62
  return onAuthorise ? /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
55
63
  spacing: "none",
56
64
  appearance: "subtle-link",
@@ -68,15 +76,15 @@ var InlineCardUnauthorizedView = /*#__PURE__*/function (_React$Component) {
68
76
  (0, _createClass2.default)(InlineCardUnauthorizedView, [{
69
77
  key: "render",
70
78
  value: function render() {
71
- var _this$props2 = this.props,
72
- url = _this$props2.url,
73
- icon = _this$props2.icon,
74
- onClick = _this$props2.onClick,
75
- isSelected = _this$props2.isSelected,
76
- _this$props2$testId = _this$props2.testId,
77
- testId = _this$props2$testId === void 0 ? 'inline-card-unauthorized-view' : _this$props2$testId,
78
- _this$props2$showAuth = _this$props2.showAuthTooltip,
79
- showAuthTooltip = _this$props2$showAuth === void 0 ? false : _this$props2$showAuth;
79
+ var _this$props3 = this.props,
80
+ url = _this$props3.url,
81
+ icon = _this$props3.icon,
82
+ onClick = _this$props3.onClick,
83
+ isSelected = _this$props3.isSelected,
84
+ _this$props3$testId = _this$props3.testId,
85
+ testId = _this$props3$testId === void 0 ? 'inline-card-unauthorized-view' : _this$props3$testId,
86
+ _this$props3$showAuth = _this$props3.showAuthTooltip,
87
+ showAuthTooltip = _this$props3$showAuth === void 0 ? false : _this$props3$showAuth;
80
88
  var inlineCardUnauthenticatedView = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
81
89
  testId: testId,
82
90
  isSelected: isSelected
@@ -48,9 +48,11 @@ var _ResolvingView = require("./ResolvingView");
48
48
  var _UnauthorisedView = require("./UnauthorisedView");
49
49
  var _extractors = require("@atlaskit/linking-common/extractors");
50
50
  var _linkProvider = require("@atlaskit/link-provider");
51
+ var _helpers = require("../../state/helpers");
51
52
  var InlineCard = function InlineCard(_ref) {
52
53
  var _details$meta;
53
- var id = _ref.id,
54
+ var analytics = _ref.analytics,
55
+ id = _ref.id,
54
56
  url = _ref.url,
55
57
  cardState = _ref.cardState,
56
58
  handleAuthorize = _ref.handleAuthorize,
@@ -66,6 +68,7 @@ var InlineCard = function InlineCard(_ref) {
66
68
  var status = cardState.status,
67
69
  details = cardState.details;
68
70
  var cardDetails = details && details.data || (0, _jsonld.getEmptyJsonLd)();
71
+ var extensionKey = (0, _helpers.getExtensionKey)(details);
69
72
  var testIdWithStatus = testId ? "".concat(testId, "-").concat(status, "-view") : undefined;
70
73
  var showHoverPreviewFlag = (0, _linkProvider.useFeatureFlag)('showHoverPreview');
71
74
  if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
@@ -114,7 +117,9 @@ var InlineCard = function InlineCard(_ref) {
114
117
  onAuthorise: handleAuthorize,
115
118
  testId: testIdWithStatus,
116
119
  showAuthTooltip: showAuthTooltip,
117
- id: id
120
+ id: id,
121
+ analytics: analytics,
122
+ extensionKey: extensionKey
118
123
  });
119
124
  case 'forbidden':
120
125
  if (onError) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.0.5",
3
+ "version": "25.0.6",
4
4
  "sideEffects": false
5
5
  }
@@ -188,6 +188,7 @@ export function CardWithUrlContent({
188
188
  switch (appearance) {
189
189
  case 'inline':
190
190
  return /*#__PURE__*/React.createElement(InlineCard, {
191
+ analytics: analytics,
191
192
  id: id,
192
193
  url: url,
193
194
  renderers: renderers,
@@ -21,10 +21,17 @@ export class InlineCardUnauthorizedView extends React.Component {
21
21
  super(...args);
22
22
  _defineProperty(this, "handleConnectAccount", event => {
23
23
  const {
24
+ analytics,
25
+ extensionKey,
24
26
  onAuthorise
25
27
  } = this.props;
26
28
  event.preventDefault();
27
29
  event.stopPropagation();
30
+ if (onAuthorise) {
31
+ analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
32
+ extensionKey
33
+ });
34
+ }
28
35
  return onAuthorise();
29
36
  });
30
37
  _defineProperty(this, "renderRightSide", () => {
@@ -11,8 +11,10 @@ import { InlineCardResolvingView } from './ResolvingView';
11
11
  import { InlineCardUnauthorizedView } from './UnauthorisedView';
12
12
  import { extractProvider } from '@atlaskit/linking-common/extractors';
13
13
  import { useFeatureFlag } from '@atlaskit/link-provider';
14
+ import { getExtensionKey } from '../../state/helpers';
14
15
  export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView };
15
16
  export const InlineCard = ({
17
+ analytics,
16
18
  id,
17
19
  url,
18
20
  cardState,
@@ -33,6 +35,7 @@ export const InlineCard = ({
33
35
  details
34
36
  } = cardState;
35
37
  const cardDetails = details && details.data || getEmptyJsonLd();
38
+ const extensionKey = getExtensionKey(details);
36
39
  const testIdWithStatus = testId ? `${testId}-${status}-view` : undefined;
37
40
  const showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
38
41
  if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
@@ -81,7 +84,9 @@ export const InlineCard = ({
81
84
  onAuthorise: handleAuthorize,
82
85
  testId: testIdWithStatus,
83
86
  showAuthTooltip: showAuthTooltip,
84
- id: id
87
+ id: id,
88
+ analytics: analytics,
89
+ extensionKey: extensionKey
85
90
  });
86
91
  case 'forbidden':
87
92
  if (onError) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.0.5",
3
+ "version": "25.0.6",
4
4
  "sideEffects": false
5
5
  }
@@ -191,6 +191,7 @@ export function CardWithUrlContent(_ref) {
191
191
  switch (appearance) {
192
192
  case 'inline':
193
193
  return /*#__PURE__*/React.createElement(InlineCard, {
194
+ analytics: analytics,
194
195
  id: id,
195
196
  url: url,
196
197
  renderers: renderers,
@@ -35,15 +35,23 @@ export var InlineCardUnauthorizedView = /*#__PURE__*/function (_React$Component)
35
35
  }
36
36
  _this = _super.call.apply(_super, [this].concat(args));
37
37
  _defineProperty(_assertThisInitialized(_this), "handleConnectAccount", function (event) {
38
- var onAuthorise = _this.props.onAuthorise;
38
+ var _this$props = _this.props,
39
+ analytics = _this$props.analytics,
40
+ extensionKey = _this$props.extensionKey,
41
+ onAuthorise = _this$props.onAuthorise;
39
42
  event.preventDefault();
40
43
  event.stopPropagation();
44
+ if (onAuthorise) {
45
+ analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
46
+ extensionKey: extensionKey
47
+ });
48
+ }
41
49
  return onAuthorise();
42
50
  });
43
51
  _defineProperty(_assertThisInitialized(_this), "renderRightSide", function () {
44
- var _this$props = _this.props,
45
- onAuthorise = _this$props.onAuthorise,
46
- context = _this$props.context;
52
+ var _this$props2 = _this.props,
53
+ onAuthorise = _this$props2.onAuthorise,
54
+ context = _this$props2.context;
47
55
  return onAuthorise ? /*#__PURE__*/React.createElement(Button, {
48
56
  spacing: "none",
49
57
  appearance: "subtle-link",
@@ -61,15 +69,15 @@ export var InlineCardUnauthorizedView = /*#__PURE__*/function (_React$Component)
61
69
  _createClass(InlineCardUnauthorizedView, [{
62
70
  key: "render",
63
71
  value: function render() {
64
- var _this$props2 = this.props,
65
- url = _this$props2.url,
66
- icon = _this$props2.icon,
67
- onClick = _this$props2.onClick,
68
- isSelected = _this$props2.isSelected,
69
- _this$props2$testId = _this$props2.testId,
70
- testId = _this$props2$testId === void 0 ? 'inline-card-unauthorized-view' : _this$props2$testId,
71
- _this$props2$showAuth = _this$props2.showAuthTooltip,
72
- showAuthTooltip = _this$props2$showAuth === void 0 ? false : _this$props2$showAuth;
72
+ var _this$props3 = this.props,
73
+ url = _this$props3.url,
74
+ icon = _this$props3.icon,
75
+ onClick = _this$props3.onClick,
76
+ isSelected = _this$props3.isSelected,
77
+ _this$props3$testId = _this$props3.testId,
78
+ testId = _this$props3$testId === void 0 ? 'inline-card-unauthorized-view' : _this$props3$testId,
79
+ _this$props3$showAuth = _this$props3.showAuthTooltip,
80
+ showAuthTooltip = _this$props3$showAuth === void 0 ? false : _this$props3$showAuth;
73
81
  var inlineCardUnauthenticatedView = /*#__PURE__*/React.createElement(Frame, {
74
82
  testId: testId,
75
83
  isSelected: isSelected
@@ -11,10 +11,12 @@ import { InlineCardResolvingView } from './ResolvingView';
11
11
  import { InlineCardUnauthorizedView } from './UnauthorisedView';
12
12
  import { extractProvider } from '@atlaskit/linking-common/extractors';
13
13
  import { useFeatureFlag } from '@atlaskit/link-provider';
14
+ import { getExtensionKey } from '../../state/helpers';
14
15
  export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView };
15
16
  export var InlineCard = function InlineCard(_ref) {
16
17
  var _details$meta;
17
- var id = _ref.id,
18
+ var analytics = _ref.analytics,
19
+ id = _ref.id,
18
20
  url = _ref.url,
19
21
  cardState = _ref.cardState,
20
22
  handleAuthorize = _ref.handleAuthorize,
@@ -30,6 +32,7 @@ export var InlineCard = function InlineCard(_ref) {
30
32
  var status = cardState.status,
31
33
  details = cardState.details;
32
34
  var cardDetails = details && details.data || getEmptyJsonLd();
35
+ var extensionKey = getExtensionKey(details);
33
36
  var testIdWithStatus = testId ? "".concat(testId, "-").concat(status, "-view") : undefined;
34
37
  var showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
35
38
  if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
@@ -78,7 +81,9 @@ export var InlineCard = function InlineCard(_ref) {
78
81
  onAuthorise: handleAuthorize,
79
82
  testId: testIdWithStatus,
80
83
  showAuthTooltip: showAuthTooltip,
81
- id: id
84
+ id: id,
85
+ analytics: analytics,
86
+ extensionKey: extensionKey
82
87
  });
83
88
  case 'forbidden':
84
89
  if (onError) {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { AnalyticsFacade } from '../../../state/analytics';
2
3
  export interface InlineCardUnauthorizedViewProps {
3
4
  /** The url to display */
4
5
  url: string;
@@ -18,6 +19,10 @@ export interface InlineCardUnauthorizedViewProps {
18
19
  showAuthTooltip?: boolean;
19
20
  /** A smart link id that may be used in analytics */
20
21
  id?: string;
22
+ /** An AnalyticsFacade object used for calling analytics. */
23
+ analytics: AnalyticsFacade;
24
+ /** An identifier of the provider which will be executing the action. */
25
+ extensionKey?: string;
21
26
  }
22
27
  export declare class InlineCardUnauthorizedView extends React.Component<InlineCardUnauthorizedViewProps> {
23
28
  handleConnectAccount: (event: React.MouseEvent<HTMLElement>) => void;
@@ -2,6 +2,7 @@ import { EventHandler, MouseEvent, KeyboardEvent } from 'react';
2
2
  import { CardProviderRenderers } from '@atlaskit/link-provider';
3
3
  import { CardState } from '../../state/types';
4
4
  import { InlinePreloaderStyle, OnErrorCallback } from '../types';
5
+ import { AnalyticsFacade } from '../../state/analytics';
5
6
  export declare type InlineCardProps = {
6
7
  id: string;
7
8
  url: string;
@@ -19,4 +20,5 @@ export declare type InlineCardProps = {
19
20
  renderers?: CardProviderRenderers;
20
21
  showHoverPreview?: boolean;
21
22
  showAuthTooltip?: boolean;
23
+ analytics: AnalyticsFacade;
22
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.0.5",
3
+ "version": "25.0.6",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"