@atlaskit/smart-card 32.3.0 → 32.5.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/analytics.spec.yaml +100 -0
  3. package/dist/cjs/state/actions/index.js +35 -11
  4. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +5 -1
  5. package/dist/cjs/utils/analytics/analytics.js +21 -1
  6. package/dist/cjs/utils/analytics/index.js +3 -0
  7. package/dist/cjs/view/CardWithUrl/component.js +33 -10
  8. package/dist/cjs/view/CardWithUrl/loader.js +19 -6
  9. package/dist/cjs/view/EmbedCard/index.js +33 -4
  10. package/dist/cjs/view/LinkUrl/index.js +1 -1
  11. package/dist/es2019/state/actions/index.js +35 -11
  12. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +5 -1
  13. package/dist/es2019/utils/analytics/analytics.js +21 -1
  14. package/dist/es2019/utils/analytics/index.js +4 -0
  15. package/dist/es2019/view/CardWithUrl/component.js +33 -10
  16. package/dist/es2019/view/CardWithUrl/loader.js +20 -6
  17. package/dist/es2019/view/EmbedCard/index.js +35 -5
  18. package/dist/es2019/view/LinkUrl/index.js +1 -1
  19. package/dist/esm/state/actions/index.js +35 -11
  20. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +5 -1
  21. package/dist/esm/utils/analytics/analytics.js +21 -1
  22. package/dist/esm/utils/analytics/index.js +4 -0
  23. package/dist/esm/view/CardWithUrl/component.js +33 -10
  24. package/dist/esm/view/CardWithUrl/loader.js +19 -6
  25. package/dist/esm/view/EmbedCard/index.js +33 -4
  26. package/dist/esm/view/LinkUrl/index.js +1 -1
  27. package/dist/types/common/analytics/generated/analytics.types.d.ts +38 -1
  28. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +5 -1
  29. package/dist/types/utils/analytics/analytics.d.ts +15 -0
  30. package/dist/types/utils/analytics/index.d.ts +3 -0
  31. package/dist/types/utils/analytics/types.d.ts +12 -0
  32. package/dist/types/view/EmbedCard/types.d.ts +2 -0
  33. package/dist/types/view/FlexibleCard/components/blocks/ai-footer-block/icons/info/index.d.ts +2 -2
  34. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +38 -1
  35. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +5 -1
  36. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +15 -0
  37. package/dist/types-ts4.5/utils/analytics/index.d.ts +3 -0
  38. package/dist/types-ts4.5/utils/analytics/types.d.ts +12 -0
  39. package/dist/types-ts4.5/view/EmbedCard/types.d.ts +2 -0
  40. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-footer-block/icons/info/index.d.ts +2 -2
  41. package/package.json +13 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 32.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#168911](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168911)
8
+ [`bc902797bc22b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bc902797bc22b) -
9
+ Migrate operational analytics event
10
+
11
+ ### Patch Changes
12
+
13
+ - [#171994](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171994)
14
+ [`be58e4bb2e387`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be58e4bb2e387) -
15
+ Migrating usages of UNSAFE types and entrypoints that have been renamed in `@atlaskit/icon` and
16
+ `@atlaskit/icon-lab`.
17
+ - Updated dependencies
18
+
19
+ ## 32.4.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [#170865](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/170865)
24
+ [`774efa325781c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/774efa325781c) -
25
+ [ux] Removes the legacy block card views from the embed card for the resolving and fallback states
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
3
31
  ## 32.3.0
4
32
 
5
33
  ### Minor Changes
@@ -344,3 +344,103 @@ events:
344
344
  required: false
345
345
  type: string
346
346
  description: The definitionId of the Smart Link resolver invoked.
347
+ - smartLink connectSucceeded:
348
+ type: operational
349
+ description:
350
+ fires an event that represents an account successfully being connected via a Smart Link.
351
+ attributes:
352
+ <<: [*PackageMetaDataContext, *CommonContext]
353
+ definitionId:
354
+ required: false
355
+ type: string
356
+ description: The definitionId of the Smart Link resolver invoked.
357
+ - smartLink connectFailed:
358
+ type: operational
359
+ description: fires an event that represents an account unsuccessfully being connected.
360
+ attributes:
361
+ <<: [*PackageMetaDataContext, *CommonContext]
362
+ reason:
363
+ required: false
364
+ description: The reason why the Smart Link connect account failed.
365
+ type: string
366
+ definitionId:
367
+ required: false
368
+ type: string
369
+ description: The definitionId of the Smart Link resolver invoked.
370
+ - smartLink resolved:
371
+ type: operational
372
+ description: fires an event which represents a Smart Link request succeeding.
373
+ attributes:
374
+ <<: [*PackageMetaDataContext, *CommonContext]
375
+ status:
376
+ type:
377
+ [
378
+ 'pending',
379
+ 'resolving',
380
+ 'resolved',
381
+ 'errored',
382
+ 'fallback',
383
+ 'unauthorized',
384
+ 'forbidden',
385
+ 'not_found',
386
+ ]
387
+ description: The status of the link resolution at the time of the event.
388
+ required: false
389
+ definitionId:
390
+ required: false
391
+ type: string
392
+ description: The definitionId of the Smart Link resolver invoked.
393
+ duration:
394
+ required: false
395
+ type: number
396
+ - smartLink unresolved:
397
+ type: operational
398
+ description: fires an event which represents a Smart Link request failing.
399
+ attributes:
400
+ <<: [*PackageMetaDataContext, *CommonContext]
401
+ status:
402
+ type:
403
+ [
404
+ 'pending',
405
+ 'resolving',
406
+ 'resolved',
407
+ 'errored',
408
+ 'fallback',
409
+ 'unauthorized',
410
+ 'forbidden',
411
+ 'not_found',
412
+ ]
413
+ description: The status of the link resolution at the time of the event.
414
+ required: false
415
+ definitionId:
416
+ required: false
417
+ type: string
418
+ description: The definitionId of the Smart Link resolver invoked.
419
+ error:
420
+ required: false
421
+ description: The reason why the Smart Link connect account failed.
422
+ type: object
423
+ reason:
424
+ required: true
425
+ type: string
426
+ - smartLink chunkLoadFailed:
427
+ type: operational
428
+ description: fires an event that represents when a Smart Link renders unsuccessfully.
429
+ attributes:
430
+ <<: [*PackageMetaDataContext, *CommonContext]
431
+ display:
432
+ required: true
433
+ type: ['inline', 'block', 'embed', 'embedPreview', 'flexible', 'hoverCardPreview']
434
+ description: Whether the card was an Inline, Block, Embed or Flexible UI.
435
+ definitionId:
436
+ required: false
437
+ type: string
438
+ description: The definitionId of the Smart Link resolver invoked.
439
+ error:
440
+ required: true
441
+ description: An error representing why the Smart Link render failed.
442
+ type: object
443
+ errorInfo:
444
+ required: true
445
+ description: Additional details about the error including the stack trace.
446
+ type: object
@@ -11,8 +11,10 @@ var _react = require("react");
11
11
  var _linkProvider = require("@atlaskit/link-provider");
12
12
  var _linkingCommon = require("@atlaskit/linking-common");
13
13
  var _outboundAuthFlowClient = require("@atlaskit/outbound-auth-flow-client");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
15
16
  var _constants = require("../../constants");
17
+ var _analytics = require("../analytics");
16
18
  var _helpers = require("../helpers");
17
19
  var _useInvokeClientAction = _interopRequireDefault(require("../hooks/use-invoke-client-action"));
18
20
  var _useResolve = _interopRequireDefault(require("../hooks/use-resolve"));
@@ -126,19 +128,41 @@ var useSmartCardActions = exports.useSmartCardActions = function useSmartCardAct
126
128
  fireEvent('track.applicationAccount.connected', {
127
129
  definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
128
130
  });
129
- analytics.operational.connectSucceededEvent({
130
- id: id,
131
- definitionId: definitionId,
132
- extensionKey: extensionKey
133
- });
131
+ if ((0, _platformFeatureFlags.fg)('platform_smart-card-migrate-operational-analytics')) {
132
+ (0, _analytics.startUfoExperience)('smart-link-authenticated', id, {
133
+ extensionKey: extensionKey,
134
+ status: 'success'
135
+ });
136
+ fireEvent('operational.smartLink.connectSucceeded', {
137
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
138
+ });
139
+ } else {
140
+ analytics.operational.connectSucceededEvent({
141
+ id: id,
142
+ definitionId: definitionId,
143
+ extensionKey: extensionKey
144
+ });
145
+ }
134
146
  reload();
135
147
  }, function (err) {
136
- analytics.operational.connectFailedEvent({
137
- id: id,
138
- definitionId: definitionId,
139
- extensionKey: extensionKey,
140
- reason: err.type
141
- });
148
+ if ((0, _platformFeatureFlags.fg)('platform_smart-card-migrate-operational-analytics')) {
149
+ var _err$type;
150
+ (0, _analytics.startUfoExperience)('smart-link-authenticated', id, {
151
+ extensionKey: extensionKey,
152
+ status: err.type
153
+ });
154
+ fireEvent('operational.smartLink.connectFailed', {
155
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
156
+ reason: (_err$type = err.type) !== null && _err$type !== void 0 ? _err$type : null
157
+ });
158
+ } else {
159
+ analytics.operational.connectFailedEvent({
160
+ id: id,
161
+ definitionId: definitionId,
162
+ extensionKey: extensionKey,
163
+ reason: err.type
164
+ });
165
+ }
142
166
  if (err.type === 'auth_window_closed') {
143
167
  analytics.ui.closedAuthEvent({
144
168
  display: appearance,
@@ -518,6 +518,7 @@ var useSmartLinkAnalytics = exports.useSmartLinkAnalytics = function useSmartLin
518
518
  * @param id The unique ID for this Smart Link.
519
519
  * @param definitionId The definitionId of the Smart Link resolver invoked.
520
520
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
521
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
521
522
  */
522
523
  connectSucceededEvent: function connectSucceededEvent(_ref13) {
523
524
  var id = _ref13.id,
@@ -548,6 +549,7 @@ var useSmartLinkAnalytics = exports.useSmartLinkAnalytics = function useSmartLin
548
549
  * @param definitionId The definitionId of the Smart Link resolver invoked.
549
550
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
550
551
  * @param reason The reason why the Smart Link connect account failed.
552
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
551
553
  */
552
554
  connectFailedEvent: function connectFailedEvent(_ref14) {
553
555
  var id = _ref14.id,
@@ -582,6 +584,7 @@ var useSmartLinkAnalytics = exports.useSmartLinkAnalytics = function useSmartLin
582
584
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
583
585
  * @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
584
586
  * @param error An error representing why the Smart Link request failed.
587
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
585
588
  */
586
589
  instrument: function instrument(_ref15) {
587
590
  var id = _ref15.id,
@@ -609,11 +612,12 @@ var useSmartLinkAnalytics = exports.useSmartLinkAnalytics = function useSmartLin
609
612
  }
610
613
  },
611
614
  /**
612
- * This fires an event that represents when a Smart Link renders unsuccessfuly.
615
+ * This fires an event that represents when a Smart Link renders unsuccessfully.
613
616
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
614
617
  * @param id The unique ID for this Smart Link.
615
618
  * @param error: An error representing why the Smart Link render failed.
616
619
  * @param errorInfo: Additional details about the error including the stack trace.
620
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
617
621
  */
618
622
  chunkloadFailedEvent: function chunkloadFailedEvent(_ref16) {
619
623
  var display = _ref16.display,
@@ -17,7 +17,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
17
17
  var context = exports.context = {
18
18
  componentName: 'smart-cards',
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "32.3.0"
20
+ packageVersion: "32.5.0"
21
21
  };
22
22
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
23
23
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -64,6 +64,10 @@ var fireSmartLinkEvent = exports.fireSmartLinkEvent = function fireSmartLinkEven
64
64
  createAnalyticsEvent(payload).fire(ANALYTICS_CHANNEL);
65
65
  }
66
66
  };
67
+
68
+ /**
69
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
70
+ */
67
71
  var resolvedEvent = exports.resolvedEvent = function resolvedEvent(props) {
68
72
  return {
69
73
  action: 'resolved',
@@ -72,6 +76,10 @@ var resolvedEvent = exports.resolvedEvent = function resolvedEvent(props) {
72
76
  attributes: _objectSpread(_objectSpread({}, props), context)
73
77
  };
74
78
  };
79
+
80
+ /**
81
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
82
+ */
75
83
  var unresolvedEvent = exports.unresolvedEvent = function unresolvedEvent(_ref) {
76
84
  var id = _ref.id,
77
85
  definitionId = _ref.definitionId,
@@ -166,6 +174,10 @@ var invokeFailedEvent = exports.invokeFailedEvent = function invokeFailedEvent(_
166
174
  })
167
175
  };
168
176
  };
177
+
178
+ /**
179
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
180
+ */
169
181
  var connectSucceededEvent = exports.connectSucceededEvent = function connectSucceededEvent(_ref4) {
170
182
  var definitionId = _ref4.definitionId,
171
183
  extensionKey = _ref4.extensionKey,
@@ -185,6 +197,10 @@ var connectSucceededEvent = exports.connectSucceededEvent = function connectSucc
185
197
  })
186
198
  };
187
199
  };
200
+
201
+ /**
202
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
203
+ */
188
204
  var connectFailedEvent = exports.connectFailedEvent = function connectFailedEvent(_ref5) {
189
205
  var definitionId = _ref5.definitionId,
190
206
  extensionKey = _ref5.extensionKey,
@@ -468,6 +484,10 @@ var uiLearnMoreLinkClickedEvent = exports.uiLearnMoreLinkClickedEvent = function
468
484
  attributes: _objectSpread({}, context)
469
485
  };
470
486
  };
487
+
488
+ /**
489
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
490
+ */
471
491
  var chunkloadFailedEvent = exports.chunkloadFailedEvent = function chunkloadFailedEvent(_ref16) {
472
492
  var display = _ref16.display,
473
493
  error = _ref16.error,
@@ -154,6 +154,9 @@ var _performance = require("../performance");
154
154
  var _analytics = require("./analytics");
155
155
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
156
156
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
157
+ /**
158
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
159
+ */
157
160
  var instrumentEvent = exports.instrumentEvent = function instrumentEvent(_ref) {
158
161
  var id = _ref.id,
159
162
  status = _ref.status,
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.CardWithUrlContent = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _analyticsNext = require("@atlaskit/analytics-next");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
12
13
  var _constants = require("../../constants");
13
14
  var _state = require("../../state");
@@ -128,18 +129,39 @@ function Component(_ref) {
128
129
  (0, _react.useEffect)(function () {
129
130
  measure.mark(id, state.status);
130
131
  if (state.status !== 'pending' && state.status !== 'resolving') {
131
- var _state$error;
132
132
  measure.create(id, state.status);
133
- analytics.operational.instrument({
134
- id: id,
135
- status: state.status,
136
- definitionId: definitionId,
137
- extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : (_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.extensionKey,
138
- resourceType: resourceType,
139
- error: state.error
140
- });
133
+ if ((0, _platformFeatureFlags.fg)('platform_smart-card-migrate-operational-analytics')) {
134
+ var _state$error;
135
+ if (state.status === 'resolved') {
136
+ var _measure$getMeasure$d, _measure$getMeasure;
137
+ fireEvent('operational.smartLink.resolved', {
138
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
139
+ duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(id, state.status)) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null
140
+ });
141
+ } else if (((_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.type) !== 'ResolveUnsupportedError') {
142
+ fireEvent('operational.smartLink.unresolved', {
143
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
144
+ reason: state.status,
145
+ error: state.error === undefined ? null : {
146
+ name: state.error.name,
147
+ kind: state.error.kind,
148
+ type: state.error.type
149
+ }
150
+ });
151
+ }
152
+ } else {
153
+ var _state$error2;
154
+ analytics.operational.instrument({
155
+ id: id,
156
+ status: state.status,
157
+ definitionId: definitionId,
158
+ extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : (_state$error2 = state.error) === null || _state$error2 === void 0 ? void 0 : _state$error2.extensionKey,
159
+ resourceType: resourceType,
160
+ error: state.error
161
+ });
162
+ }
141
163
  }
142
- }, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, analytics.operational]);
164
+ }, [id, appearance, state.status, state.error, definitionId, extensionKey, resourceType, analytics.operational, fireEvent]);
143
165
 
144
166
  // NB: once the smart-card has rendered into an end state, we capture
145
167
  // this as a successful render. These can be one of:
@@ -255,6 +277,7 @@ function Component(_ref) {
255
277
  return /*#__PURE__*/_react.default.createElement(_EmbedCard.EmbedCard, {
256
278
  id: id,
257
279
  url: url,
280
+ renderers: renderers,
258
281
  cardState: state,
259
282
  iframeUrlType: embedIframeUrlType,
260
283
  handleAuthorize: services.length && handleAuthorize || undefined,
@@ -12,6 +12,8 @@ var _react = _interopRequireWildcard(require("react"));
12
12
  var _reactErrorBoundary = require("react-error-boundary");
13
13
  var _reactMagneticDi = require("react-magnetic-di");
14
14
  var _uuid = _interopRequireDefault(require("uuid"));
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
+ var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
15
17
  var _analytics = require("../../state/analytics");
16
18
  var _utils = require("../../utils");
17
19
  var _flexible = require("../../utils/flexible");
@@ -32,6 +34,8 @@ function CardWithURLRenderer(props) {
32
34
  }),
33
35
  _useState2 = (0, _slicedToArray2.default)(_useState, 1),
34
36
  id = _useState2[0];
37
+ var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
38
+ fireEvent = _useAnalyticsEvents.fireEvent;
35
39
  (0, _react.useEffect)(function () {
36
40
  // ComponentWillUnmount
37
41
  return function () {
@@ -78,11 +82,20 @@ function CardWithURLRenderer(props) {
78
82
  // to the reliability of the smart-card front-end components.
79
83
  // Likewise, chunk loading errors are not caused by a failure of smart-card rendering.
80
84
  if (error.name === 'ChunkLoadError') {
81
- analytics.operational.chunkloadFailedEvent({
82
- display: appearance,
83
- error: error,
84
- errorInfo: errorInfo
85
- });
85
+ if ((0, _platformFeatureFlags.fg)('platform_smart-card-migrate-operational-analytics')) {
86
+ fireEvent('operational.smartLink.chunkLoadFailed', {
87
+ display: appearance,
88
+ error: error,
89
+ errorInfo: errorInfo,
90
+ definitionId: null
91
+ });
92
+ } else {
93
+ analytics.operational.chunkloadFailedEvent({
94
+ display: appearance,
95
+ error: error,
96
+ errorInfo: errorInfo
97
+ });
98
+ }
86
99
  } else if (error.name !== 'APIError') {
87
100
  analytics.ui.renderFailedEvent({
88
101
  display: isFlexibleUi ? 'flexible' : appearance,
@@ -96,7 +109,7 @@ function CardWithURLRenderer(props) {
96
109
  url: url !== null && url !== void 0 ? url : '',
97
110
  err: error
98
111
  });
99
- }, [analytics.operational, analytics.ui, appearance, id, onError, url, isFlexibleUi]);
112
+ }, [analytics.operational, analytics.ui, appearance, id, onError, url, isFlexibleUi, fireEvent]);
100
113
  if (!url) {
101
114
  throw new Error('@atlaskit/smart-card: url property is missing.');
102
115
  }
@@ -8,6 +8,7 @@ exports.EmbedCard = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _analyticsNext = require("@atlaskit/analytics-next");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _block = require("../../extractors/block");
12
13
  var _extractAccessContext = require("../../extractors/common/context/extractAccessContext");
13
14
  var _embed = require("../../extractors/embed");
@@ -15,6 +16,7 @@ var _inline = require("../../extractors/inline");
15
16
  var _helpers = require("../../state/helpers");
16
17
  var _jsonld = require("../../utils/jsonld");
17
18
  var _BlockCard = require("../BlockCard");
19
+ var _FlexibleResolvedView = _interopRequireDefault(require("../BlockCard/views/flexible/FlexibleResolvedView"));
18
20
  var _ResolvedView = require("../InlineCard/ResolvedView");
19
21
  var _ErroredView = require("./views/ErroredView");
20
22
  var _forbiddenView = _interopRequireDefault(require("./views/forbidden-view"));
@@ -24,9 +26,7 @@ var _unauthorizedView = _interopRequireDefault(require("./views/unauthorized-vie
24
26
  var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(function (_ref, iframeRef) {
25
27
  var _details$meta, _forbiddenViewProps$c, _forbiddenViewProps$c2, _notFoundViewProps$co, _notFoundViewProps$co2;
26
28
  var url = _ref.url,
27
- _ref$cardState = _ref.cardState,
28
- status = _ref$cardState.status,
29
- details = _ref$cardState.details,
29
+ cardState = _ref.cardState,
30
30
  handleAuthorize = _ref.handleAuthorize,
31
31
  handleErrorRetry = _ref.handleErrorRetry,
32
32
  handleFrameClick = _ref.handleFrameClick,
@@ -42,9 +42,12 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
42
42
  onIframeDwell = _ref.onIframeDwell,
43
43
  onIframeFocus = _ref.onIframeFocus,
44
44
  iframeUrlType = _ref.iframeUrlType,
45
- actionOptions = _ref.actionOptions;
45
+ actionOptions = _ref.actionOptions,
46
+ renderers = _ref.renderers;
46
47
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
47
48
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
49
+ var status = cardState.status,
50
+ details = cardState.details;
48
51
  var data = details && details.data || (0, _jsonld.getEmptyJsonLd)();
49
52
  var meta = details && details.meta;
50
53
  var extensionKey = (0, _helpers.getExtensionKey)(details);
@@ -52,6 +55,19 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
52
55
  switch (status) {
53
56
  case 'pending':
54
57
  case 'resolving':
58
+ if ((0, _platformFeatureFlags.fg)('smart-card-remove-block-card-from-embed')) {
59
+ return /*#__PURE__*/_react.default.createElement(_FlexibleResolvedView.default, {
60
+ url: url,
61
+ cardState: cardState,
62
+ onClick: handleFrameClick,
63
+ onError: onError,
64
+ onResolve: onResolve,
65
+ renderers: renderers,
66
+ actionOptions: actionOptions,
67
+ analytics: analytics,
68
+ testId: testId
69
+ });
70
+ }
55
71
  return /*#__PURE__*/_react.default.createElement(_BlockCard.BlockCardResolvingView, {
56
72
  testId: "embed-card-resolving-view",
57
73
  inheritDimensions: inheritDimensions,
@@ -87,6 +103,19 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
87
103
  onClick: handleFrameClick
88
104
  }));
89
105
  }
106
+ if ((0, _platformFeatureFlags.fg)('smart-card-remove-block-card-from-embed')) {
107
+ return /*#__PURE__*/_react.default.createElement(_FlexibleResolvedView.default, {
108
+ url: url,
109
+ cardState: cardState,
110
+ onClick: handleFrameClick,
111
+ onError: onError,
112
+ onResolve: onResolve,
113
+ renderers: renderers,
114
+ actionOptions: actionOptions,
115
+ analytics: analytics,
116
+ testId: testId
117
+ });
118
+ }
90
119
  var resolvedBlockViewProps = (0, _block.extractBlockProps)(data, meta, {
91
120
  analytics: analytics,
92
121
  origin: 'smartLinkEmbed',
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
17
17
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
18
18
  var PACKAGE_DATA = {
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "32.3.0",
20
+ packageVersion: "32.5.0",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -2,8 +2,10 @@ import { useCallback, useMemo } from 'react';
2
2
  import { useSmartLinkContext } from '@atlaskit/link-provider';
3
3
  import { ACTION_RESOLVING, ACTION_UPDATE_METADATA_STATUS, cardAction } from '@atlaskit/linking-common';
4
4
  import { auth } from '@atlaskit/outbound-auth-flow-client';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
6
7
  import { SmartLinkStatus } from '../../constants';
8
+ import { startUfoExperience } from '../analytics';
7
9
  import { getByDefinitionId, getDefinitionId, getExtensionKey, getServices } from '../helpers';
8
10
  import useInvokeClientAction from '../hooks/use-invoke-client-action';
9
11
  import useResolve from '../hooks/use-resolve';
@@ -107,19 +109,41 @@ export const useSmartCardActions = (id, url, analytics) => {
107
109
  fireEvent('track.applicationAccount.connected', {
108
110
  definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
109
111
  });
110
- analytics.operational.connectSucceededEvent({
111
- id,
112
- definitionId,
113
- extensionKey
114
- });
112
+ if (fg('platform_smart-card-migrate-operational-analytics')) {
113
+ startUfoExperience('smart-link-authenticated', id, {
114
+ extensionKey,
115
+ status: 'success'
116
+ });
117
+ fireEvent('operational.smartLink.connectSucceeded', {
118
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
119
+ });
120
+ } else {
121
+ analytics.operational.connectSucceededEvent({
122
+ id,
123
+ definitionId,
124
+ extensionKey
125
+ });
126
+ }
115
127
  reload();
116
128
  }, err => {
117
- analytics.operational.connectFailedEvent({
118
- id,
119
- definitionId,
120
- extensionKey,
121
- reason: err.type
122
- });
129
+ if (fg('platform_smart-card-migrate-operational-analytics')) {
130
+ var _err$type;
131
+ startUfoExperience('smart-link-authenticated', id, {
132
+ extensionKey,
133
+ status: err.type
134
+ });
135
+ fireEvent('operational.smartLink.connectFailed', {
136
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
137
+ reason: (_err$type = err.type) !== null && _err$type !== void 0 ? _err$type : null
138
+ });
139
+ } else {
140
+ analytics.operational.connectFailedEvent({
141
+ id,
142
+ definitionId,
143
+ extensionKey,
144
+ reason: err.type
145
+ });
146
+ }
123
147
  if (err.type === 'auth_window_closed') {
124
148
  analytics.ui.closedAuthEvent({
125
149
  display: appearance,
@@ -492,6 +492,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
492
492
  * @param id The unique ID for this Smart Link.
493
493
  * @param definitionId The definitionId of the Smart Link resolver invoked.
494
494
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
495
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
495
496
  */
496
497
  connectSucceededEvent: ({
497
498
  id,
@@ -524,6 +525,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
524
525
  * @param definitionId The definitionId of the Smart Link resolver invoked.
525
526
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
526
527
  * @param reason The reason why the Smart Link connect account failed.
528
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
527
529
  */
528
530
  connectFailedEvent: ({
529
531
  id,
@@ -560,6 +562,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
560
562
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
561
563
  * @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
562
564
  * @param error An error representing why the Smart Link request failed.
565
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
563
566
  */
564
567
  instrument: ({
565
568
  id,
@@ -589,11 +592,12 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
589
592
  }
590
593
  },
591
594
  /**
592
- * This fires an event that represents when a Smart Link renders unsuccessfuly.
595
+ * This fires an event that represents when a Smart Link renders unsuccessfully.
593
596
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
594
597
  * @param id The unique ID for this Smart Link.
595
598
  * @param error: An error representing why the Smart Link render failed.
596
599
  * @param errorInfo: Additional details about the error including the stack trace.
600
+ * @deprecated remove with platform_smart-card-migrate-operational-analytics clean up
597
601
  */
598
602
  chunkloadFailedEvent: ({
599
603
  display,