@atlaskit/editor-plugin-card 0.14.6 → 0.14.8

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/editor-plugin-card
2
2
 
3
+ ## 0.14.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#58076](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58076) [`e22c68b4b316`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e22c68b4b316) - Fix an overlay causing wrapped inline card to jump
8
+
9
+ ## 0.14.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [#56898](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/56898) [`32d7fcd969d5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/32d7fcd969d5) - Analytics even 'pulse viewed' is added to inline card with awareness (behind a FF)
14
+
3
15
  ## 0.14.6
4
16
 
5
17
  ### Patch Changes
@@ -9,7 +9,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _localStorage = require("../local-storage");
11
11
  var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref) {
12
- var _cardContext$store, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
12
+ var _cardContext$store, _pluginInjectionApi$c;
13
13
  var url = _ref.url,
14
14
  linkPosition = _ref.linkPosition,
15
15
  cardContext = _ref.cardContext,
@@ -20,6 +20,9 @@ var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref)
20
20
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
21
21
  urlState = _useState2[0],
22
22
  setUrlState = _useState2[1];
23
+ var _ref2 = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.currentState()) || {},
24
+ overlayCandidatePosition = _ref2.overlayCandidatePosition,
25
+ inlineCardAwarenessCandidatePosition = _ref2.inlineCardAwarenessCandidatePosition;
23
26
  (0, _react.useEffect)(function () {
24
27
  var _cardContext$store2;
25
28
  var unsubscribe = cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.subscribe(function () {
@@ -38,13 +41,10 @@ var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref)
38
41
  return isResolved && !!(cardContext !== null && cardContext !== void 0 && (_cardContext$extracto = cardContext.extractors) !== null && _cardContext$extracto !== void 0 && _cardContext$extracto.getPreview(url, 'web'));
39
42
  }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
40
43
  var shouldShowLinkPulse = (0, _react.useMemo)(function () {
41
- var _pluginInjectionApi$c;
42
- var awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.inlineCardAwarenessCandidatePosition;
43
- return isPulseEnabled && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
44
- }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.sharedState]);
44
+ return isPulseEnabled && linkPosition === inlineCardAwarenessCandidatePosition && canBeUpgradedToEmbed;
45
+ }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, inlineCardAwarenessCandidatePosition]);
45
46
  var shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
46
- var overlayCandidatePos = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.sharedState) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.overlayCandidatePosition;
47
- var isLinkMostRecentlyInserted = overlayCandidatePos === linkPosition;
47
+ var isLinkMostRecentlyInserted = overlayCandidatePosition === linkPosition;
48
48
  var shouldShowToolbarPulse = (0, _react.useMemo)(function () {
49
49
  return isPulseEnabled && !(0, _localStorage.isLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR) && canBeUpgradedToEmbed;
50
50
  }, [canBeUpgradedToEmbed, isPulseEnabled]);
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.DiscoveryPulse = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
+ var _analyticsNext = require("@atlaskit/analytics-next");
9
10
  var _linkingCommon = require("@atlaskit/linking-common");
10
11
  var _localStorage = require("../local-storage");
11
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -18,6 +19,20 @@ var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
18
19
  _ref$discoveryMode = _ref.discoveryMode,
19
20
  discoveryMode = _ref$discoveryMode === void 0 ? 'iteration' : _ref$discoveryMode;
20
21
  var discovered = isDiscovered || (0, _localStorage.isLocalStorageKeyDiscovered)(localStorageKey);
22
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
23
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
24
+ (0, _react.useEffect)(function () {
25
+ if (!discovered) {
26
+ createAnalyticsEvent({
27
+ action: 'viewed',
28
+ actionSubject: 'pulse',
29
+ eventType: 'ui',
30
+ attributes: {
31
+ pulseIdentifier: localStorageKey
32
+ }
33
+ }).fire('media');
34
+ }
35
+ }, [createAnalyticsEvent, discovered, localStorageKey]);
21
36
  var onDiscovery = (0, _react.useCallback)(function () {
22
37
  if (!discovered) {
23
38
  (0, _localStorage.markLocalStorageKeyDiscovered)(localStorageKey, localStorageKeyExpirationInMs);
@@ -9,6 +9,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _react2 = require("@emotion/react");
11
11
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
12
+ var _analyticsNext = require("@atlaskit/analytics-next");
12
13
  var _ui = require("@atlaskit/editor-common/ui");
13
14
  var _smartCard = require("@atlaskit/smart-card");
14
15
  var _useLinkUpgradeDiscoverability = _interopRequireDefault(require("../common/hooks/useLinkUpgradeDiscoverability"));
@@ -16,6 +17,7 @@ var _localStorage = require("../common/local-storage");
16
17
  var _pulse = require("../common/pulse");
17
18
  var _actions = require("../pm-plugins/actions");
18
19
  var _InlineCardOverlay = _interopRequireDefault(require("../ui/InlineCardOverlay"));
20
+ var _utils = require("../utils");
19
21
  /** @jsx jsx */
20
22
 
21
23
  // editor adds a standard line-height that is bigger than an inline smart link
@@ -27,6 +29,7 @@ var loaderWrapperStyles = (0, _react2.css)({
27
29
  }
28
30
  });
29
31
  var InlineCard = function InlineCard(_ref) {
32
+ var _cardContext$value2;
30
33
  var node = _ref.node,
31
34
  cardContext = _ref.cardContext,
32
35
  showServerActions = _ref.showServerActions,
@@ -148,15 +151,20 @@ var InlineCard = function InlineCard(_ref) {
148
151
  }, innerCard) : innerCard;
149
152
  }, [innerCard, isHovered, isSelected, isInserted, shouldShowLinkOverlay, url]);
150
153
  var card = (0, _react.useMemo)(function () {
154
+ var _cardContext$value;
151
155
  return (0, _react2.jsx)("span", {
152
156
  css: shouldShowLinkPulse && loaderWrapperStyles,
153
157
  className: "card"
154
- }, shouldShowLinkPulse ? (0, _react2.jsx)(_pulse.DiscoveryPulse, {
158
+ }, shouldShowLinkPulse ? (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
159
+ data: {
160
+ attributes: (0, _utils.getResolvedAttributesFromStore)(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
161
+ }
162
+ }, (0, _react2.jsx)(_pulse.DiscoveryPulse, {
155
163
  localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
156
164
  localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
157
165
  discoveryMode: "start"
158
- }, cardWithOverlay) : cardWithOverlay);
159
- }, [shouldShowLinkPulse, cardWithOverlay]);
166
+ }, cardWithOverlay)) : cardWithOverlay);
167
+ }, [shouldShowLinkPulse, cardWithOverlay, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store]);
160
168
  // END: Awareness
161
169
 
162
170
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
@@ -107,7 +107,8 @@ var markerStyles = (0, _react2.css)({
107
107
  height: "var(--ds-space-0, 0)",
108
108
  width: "var(--ds-space-0, 0)",
109
109
  margin: "var(--ds-space-0, 0)",
110
- padding: "var(--ds-space-0, 0)"
110
+ padding: "var(--ds-space-0, 0)",
111
+ whiteSpace: 'nowrap'
111
112
  });
112
113
  var InlineCardOverlay = function InlineCardOverlay(_ref) {
113
114
  var children = _ref.children,
@@ -243,7 +244,7 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
243
244
  "aria-hidden": "true",
244
245
  className: OVERLAY_MARKER_CLASSNAME,
245
246
  css: markerStyles
246
- }), (0, _react2.jsx)("a", {
247
+ }, _utils.ZERO_WIDTH_JOINER), (0, _react2.jsx)("a", {
247
248
  className: OVERLAY_CLASSNAME,
248
249
  css: [overlayStyles, _utils.browser.safari && safariOverlayStyles],
249
250
  style: {
@@ -15,6 +15,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
  var _propTypes = _interopRequireDefault(require("prop-types"));
18
+ var _analyticsNext = require("@atlaskit/analytics-next");
18
19
  var _analytics = require("@atlaskit/editor-common/analytics");
19
20
  var _card = require("@atlaskit/editor-common/card");
20
21
  var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
@@ -23,6 +24,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
23
24
  var _localStorage = require("../common/local-storage");
24
25
  var _pulse = require("../common/pulse");
25
26
  var _toolbar = require("../toolbar");
27
+ var _utils2 = require("../utils");
26
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
29
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
28
30
  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; }
@@ -127,9 +129,14 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
127
129
  var status = url ? cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 || (_cardContext$store2 = _cardContext$store2.getState()[url]) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.status : '';
128
130
  var embedEnabled = embedOption ? !embedOption.disabled : false;
129
131
  if ((0, _toolbar.shouldRenderToolbarPulse)(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showUpgradeDiscoverability)) {
130
- return /*#__PURE__*/_react.default.createElement(_pulse.DiscoveryPulse, {
132
+ var resolvedAnalyticsAttributes = (0, _utils2.getResolvedAttributesFromStore)(url || '', currentAppearance || null, cardContext === null || cardContext === void 0 ? void 0 : cardContext.store);
133
+ return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
134
+ data: {
135
+ attributes: _objectSpread({}, resolvedAnalyticsAttributes)
136
+ }
137
+ }, /*#__PURE__*/_react.default.createElement(_pulse.DiscoveryPulse, {
131
138
  localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
132
- }, LinkToolbarButtons);
139
+ }, LinkToolbarButtons));
133
140
  }
134
141
  return LinkToolbarButtons;
135
142
  });
@@ -9,25 +9,13 @@ exports.ToolbarViewedEvent = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _analyticsNext = require("@atlaskit/analytics-next");
12
- var _resolvedAttributes = require("@atlaskit/link-analytics/resolved-attributes");
12
+ var _utils = require("../utils");
13
13
  var _CardContextProvider = require("./CardContextProvider");
14
14
  var _EditorAnalyticsContext = require("./EditorAnalyticsContext");
15
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  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; }
18
18
  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; }
19
- var getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store) {
20
- if (!store) {
21
- return {};
22
- }
23
- var urlState = store.getState()[url];
24
- var displayCategory = display === 'url' ? 'link' : undefined;
25
- return (0, _resolvedAttributes.getResolvedAttributes)({
26
- url: url,
27
- displayCategory: displayCategory
28
- }, urlState === null || urlState === void 0 ? void 0 : urlState.details);
29
- };
30
-
31
19
  /**
32
20
  * Handles firing the toolbar viewed event
33
21
  */
@@ -44,7 +32,7 @@ var ToolbarViewedEventBase = function ToolbarViewedEventBase(_ref) {
44
32
  actionSubject: 'inlineDialog',
45
33
  actionSubjectId: 'editLinkToolbar',
46
34
  eventType: 'ui',
47
- attributes: _objectSpread(_objectSpread({}, getResolvedAttributesFromStore(url, display, store)), {}, {
35
+ attributes: _objectSpread(_objectSpread({}, (0, _utils.getResolvedAttributesFromStore)(url, display, store)), {}, {
48
36
  display: display
49
37
  })
50
38
  }).fire('media');
package/dist/cjs/utils.js CHANGED
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.titleUrlPairFromNode = exports.selectedCardAppearance = exports.mergeCardInfo = exports.isEmbedSupportedAtPosition = exports.isBlockSupportedAtPosition = exports.findCardInfo = exports.displayInfoForCard = exports.appearanceForNodeType = void 0;
6
+ exports.titleUrlPairFromNode = exports.selectedCardAppearance = exports.mergeCardInfo = exports.isEmbedSupportedAtPosition = exports.isBlockSupportedAtPosition = exports.getResolvedAttributesFromStore = exports.findCardInfo = exports.displayInfoForCard = exports.appearanceForNodeType = void 0;
7
7
  var _model = require("@atlaskit/editor-prosemirror/model");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _resolvedAttributes = require("@atlaskit/link-analytics/resolved-attributes");
9
10
  var _pluginKey = require("./pm-plugins/plugin-key");
10
11
  var appearanceForNodeType = exports.appearanceForNodeType = function appearanceForNodeType(spec) {
11
12
  if (spec.name === 'inlineCard') {
@@ -63,4 +64,15 @@ var isEmbedSupportedAtPosition = exports.isEmbedSupportedAtPosition = function i
63
64
  };
64
65
  var isBlockSupportedAtPosition = exports.isBlockSupportedAtPosition = function isBlockSupportedAtPosition(currentNodePosition, editorState, currentAppearance) {
65
66
  return isAppearanceSupportedInParent(currentNodePosition, editorState, _model.Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
67
+ };
68
+ var getResolvedAttributesFromStore = exports.getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store) {
69
+ if (!store) {
70
+ return {};
71
+ }
72
+ var urlState = store === null || store === void 0 ? void 0 : store.getState()[url];
73
+ var displayCategory = display === 'url' ? 'link' : undefined;
74
+ return (0, _resolvedAttributes.getResolvedAttributes)({
75
+ url: url,
76
+ displayCategory: displayCategory
77
+ }, urlState === null || urlState === void 0 ? void 0 : urlState.details);
66
78
  };
@@ -8,8 +8,12 @@ const useLinkUpgradeDiscoverability = ({
8
8
  isPulseEnabled,
9
9
  isOverlayEnabled
10
10
  }) => {
11
- var _cardContext$store, _pluginInjectionApi$c4, _pluginInjectionApi$c5, _pluginInjectionApi$c6, _pluginInjectionApi$c7;
11
+ var _cardContext$store, _pluginInjectionApi$c, _pluginInjectionApi$c2;
12
12
  const [urlState, setUrlState] = useState(cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url]);
13
+ const {
14
+ overlayCandidatePosition,
15
+ inlineCardAwarenessCandidatePosition
16
+ } = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.currentState()) || {};
13
17
  useEffect(() => {
14
18
  var _cardContext$store2;
15
19
  const unsubscribe = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.subscribe(() => {
@@ -28,13 +32,10 @@ const useLinkUpgradeDiscoverability = ({
28
32
  return isResolved && !!(cardContext !== null && cardContext !== void 0 && (_cardContext$extracto = cardContext.extractors) !== null && _cardContext$extracto !== void 0 && _cardContext$extracto.getPreview(url, 'web'));
29
33
  }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
30
34
  const shouldShowLinkPulse = useMemo(() => {
31
- var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
32
- const awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.inlineCardAwarenessCandidatePosition;
33
- return isPulseEnabled && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
34
- }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.card) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.sharedState]);
35
+ return isPulseEnabled && linkPosition === inlineCardAwarenessCandidatePosition && canBeUpgradedToEmbed;
36
+ }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, inlineCardAwarenessCandidatePosition]);
35
37
  const shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
36
- const overlayCandidatePos = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.card) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : (_pluginInjectionApi$c6 = _pluginInjectionApi$c5.sharedState) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : (_pluginInjectionApi$c7 = _pluginInjectionApi$c6.currentState()) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : _pluginInjectionApi$c7.overlayCandidatePosition;
37
- const isLinkMostRecentlyInserted = overlayCandidatePos === linkPosition;
38
+ const isLinkMostRecentlyInserted = overlayCandidatePosition === linkPosition;
38
39
  const shouldShowToolbarPulse = useMemo(() => isPulseEnabled && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR) && canBeUpgradedToEmbed, [canBeUpgradedToEmbed, isPulseEnabled]);
39
40
  return {
40
41
  shouldShowToolbarPulse,
@@ -1,4 +1,5 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useEffect } from 'react';
2
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
2
3
  import { Pulse } from '@atlaskit/linking-common';
3
4
  import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../local-storage';
4
5
  export const DiscoveryPulse = ({
@@ -9,6 +10,21 @@ export const DiscoveryPulse = ({
9
10
  discoveryMode = 'iteration'
10
11
  }) => {
11
12
  const discovered = isDiscovered || isLocalStorageKeyDiscovered(localStorageKey);
13
+ const {
14
+ createAnalyticsEvent
15
+ } = useAnalyticsEvents();
16
+ useEffect(() => {
17
+ if (!discovered) {
18
+ createAnalyticsEvent({
19
+ action: 'viewed',
20
+ actionSubject: 'pulse',
21
+ eventType: 'ui',
22
+ attributes: {
23
+ pulseIdentifier: localStorageKey
24
+ }
25
+ }).fire('media');
26
+ }
27
+ }, [createAnalyticsEvent, discovered, localStorageKey]);
12
28
  const onDiscovery = useCallback(() => {
13
29
  if (!discovered) {
14
30
  markLocalStorageKeyDiscovered(localStorageKey, localStorageKeyExpirationInMs);
@@ -2,6 +2,7 @@
2
2
  import { memo, useCallback, useMemo, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import rafSchedule from 'raf-schd';
5
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
5
6
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
6
7
  import { Card as SmartCard } from '@atlaskit/smart-card';
7
8
  import useLinkUpgradeDiscoverability from '../common/hooks/useLinkUpgradeDiscoverability';
@@ -9,6 +10,7 @@ import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LO
9
10
  import { DiscoveryPulse } from '../common/pulse';
10
11
  import { registerCard, registerRemoveOverlay } from '../pm-plugins/actions';
11
12
  import InlineCardOverlay from '../ui/InlineCardOverlay';
13
+ import { getResolvedAttributesFromStore } from '../utils';
12
14
  // editor adds a standard line-height that is bigger than an inline smart link
13
15
  // due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
14
16
  const loaderWrapperStyles = css({
@@ -29,6 +31,7 @@ const InlineCard = ({
29
31
  pluginInjectionApi,
30
32
  isSelected = false
31
33
  }) => {
34
+ var _cardContext$value2;
32
35
  const {
33
36
  url,
34
37
  data
@@ -126,14 +129,21 @@ const InlineCard = ({
126
129
  onMouseLeave: () => setIsHovered(false),
127
130
  url: url
128
131
  }, innerCard) : innerCard, [innerCard, isHovered, isSelected, isInserted, shouldShowLinkOverlay, url]);
129
- const card = useMemo(() => jsx("span", {
130
- css: shouldShowLinkPulse && loaderWrapperStyles,
131
- className: "card"
132
- }, shouldShowLinkPulse ? jsx(DiscoveryPulse, {
133
- localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
134
- localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
135
- discoveryMode: "start"
136
- }, cardWithOverlay) : cardWithOverlay), [shouldShowLinkPulse, cardWithOverlay]);
132
+ const card = useMemo(() => {
133
+ var _cardContext$value;
134
+ return jsx("span", {
135
+ css: shouldShowLinkPulse && loaderWrapperStyles,
136
+ className: "card"
137
+ }, shouldShowLinkPulse ? jsx(AnalyticsContext, {
138
+ data: {
139
+ attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
140
+ }
141
+ }, jsx(DiscoveryPulse, {
142
+ localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
143
+ localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
144
+ discoveryMode: "start"
145
+ }, cardWithOverlay)) : cardWithOverlay);
146
+ }, [shouldShowLinkPulse, cardWithOverlay, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store]);
137
147
  // END: Awareness
138
148
 
139
149
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
@@ -5,7 +5,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSta
5
5
  import { css, jsx } from '@emotion/react';
6
6
  import debounce from 'lodash/debounce';
7
7
  import { useIntl } from 'react-intl-next';
8
- import { browser } from '@atlaskit/editor-common/utils';
8
+ import { browser, ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
9
9
  import HipchatChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
10
10
  import HipchatChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
11
11
  import { N20A, N800 } from '@atlaskit/theme/colors';
@@ -103,7 +103,8 @@ const markerStyles = css({
103
103
  height: "var(--ds-space-0, 0)",
104
104
  width: "var(--ds-space-0, 0)",
105
105
  margin: "var(--ds-space-0, 0)",
106
- padding: "var(--ds-space-0, 0)"
106
+ padding: "var(--ds-space-0, 0)",
107
+ whiteSpace: 'nowrap'
107
108
  });
108
109
  const InlineCardOverlay = ({
109
110
  children,
@@ -229,7 +230,7 @@ const InlineCardOverlay = ({
229
230
  "aria-hidden": "true",
230
231
  className: OVERLAY_MARKER_CLASSNAME,
231
232
  css: markerStyles
232
- }), jsx("a", {
233
+ }, ZERO_WIDTH_JOINER), jsx("a", {
233
234
  className: OVERLAY_CLASSNAME,
234
235
  css: [overlayStyles, browser.safari && safariOverlayStyles],
235
236
  style: {
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
4
5
  import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
6
  import { commandWithMetadata, getButtonGroupOption, LinkToolbarButtonGroup } from '@atlaskit/editor-common/card';
6
7
  import nodeNames, { cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -9,6 +10,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
9
10
  import { LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../common/local-storage';
10
11
  import { DiscoveryPulse } from '../common/pulse';
11
12
  import { shouldRenderToolbarPulse } from '../toolbar';
13
+ import { getResolvedAttributesFromStore } from '../utils';
12
14
  // eslint-disable-next-line @repo/internal/react/no-class-components
13
15
  export class LinkToolbarAppearance extends React.Component {
14
16
  constructor(...args) {
@@ -96,9 +98,16 @@ export class LinkToolbarAppearance extends React.Component {
96
98
  const status = url ? cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : (_cardContext$store2$g = _cardContext$store2.getState()[url]) === null || _cardContext$store2$g === void 0 ? void 0 : _cardContext$store2$g.status : '';
97
99
  const embedEnabled = embedOption ? !embedOption.disabled : false;
98
100
  if (shouldRenderToolbarPulse(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showUpgradeDiscoverability)) {
99
- return /*#__PURE__*/React.createElement(DiscoveryPulse, {
101
+ const resolvedAnalyticsAttributes = getResolvedAttributesFromStore(url || '', currentAppearance || null, cardContext === null || cardContext === void 0 ? void 0 : cardContext.store);
102
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
103
+ data: {
104
+ attributes: {
105
+ ...resolvedAnalyticsAttributes
106
+ }
107
+ }
108
+ }, /*#__PURE__*/React.createElement(DiscoveryPulse, {
100
109
  localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
101
- }, LinkToolbarButtons);
110
+ }, LinkToolbarButtons));
102
111
  }
103
112
  return LinkToolbarButtons;
104
113
  });
@@ -1,20 +1,8 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
3
- import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
3
+ import { getResolvedAttributesFromStore } from '../utils';
4
4
  import { CardContextProvider } from './CardContextProvider';
5
5
  import { EditorAnalyticsContext } from './EditorAnalyticsContext';
6
- const getResolvedAttributesFromStore = (url, display, store) => {
7
- if (!store) {
8
- return {};
9
- }
10
- const urlState = store.getState()[url];
11
- const displayCategory = display === 'url' ? 'link' : undefined;
12
- return getResolvedAttributes({
13
- url,
14
- displayCategory
15
- }, urlState === null || urlState === void 0 ? void 0 : urlState.details);
16
- };
17
-
18
6
  /**
19
7
  * Handles firing the toolbar viewed event
20
8
  */
@@ -1,5 +1,6 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
3
4
  import { pluginKey } from './pm-plugins/plugin-key';
4
5
  export const appearanceForNodeType = spec => {
5
6
  if (spec.name === 'inlineCard') {
@@ -51,4 +52,15 @@ const isAppearanceSupportedInParent = (currentNodePosition, editorState, fragmen
51
52
  return parent && parent.type.validContent(fragment);
52
53
  };
53
54
  export const isEmbedSupportedAtPosition = (currentNodePosition, editorState, currentAppearance) => isAppearanceSupportedInParent(currentNodePosition, editorState, Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance);
54
- export const isBlockSupportedAtPosition = (currentNodePosition, editorState, currentAppearance) => isAppearanceSupportedInParent(currentNodePosition, editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
55
+ export const isBlockSupportedAtPosition = (currentNodePosition, editorState, currentAppearance) => isAppearanceSupportedInParent(currentNodePosition, editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
56
+ export const getResolvedAttributesFromStore = (url, display, store) => {
57
+ if (!store) {
58
+ return {};
59
+ }
60
+ const urlState = store === null || store === void 0 ? void 0 : store.getState()[url];
61
+ const displayCategory = display === 'url' ? 'link' : undefined;
62
+ return getResolvedAttributes({
63
+ url,
64
+ displayCategory
65
+ }, urlState === null || urlState === void 0 ? void 0 : urlState.details);
66
+ };
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useEffect, useMemo, useState } from 'react';
3
3
  import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../local-storage';
4
4
  var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref) {
5
- var _cardContext$store, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
5
+ var _cardContext$store, _pluginInjectionApi$c;
6
6
  var url = _ref.url,
7
7
  linkPosition = _ref.linkPosition,
8
8
  cardContext = _ref.cardContext,
@@ -13,6 +13,9 @@ var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref)
13
13
  _useState2 = _slicedToArray(_useState, 2),
14
14
  urlState = _useState2[0],
15
15
  setUrlState = _useState2[1];
16
+ var _ref2 = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.currentState()) || {},
17
+ overlayCandidatePosition = _ref2.overlayCandidatePosition,
18
+ inlineCardAwarenessCandidatePosition = _ref2.inlineCardAwarenessCandidatePosition;
16
19
  useEffect(function () {
17
20
  var _cardContext$store2;
18
21
  var unsubscribe = cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.subscribe(function () {
@@ -31,13 +34,10 @@ var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref)
31
34
  return isResolved && !!(cardContext !== null && cardContext !== void 0 && (_cardContext$extracto = cardContext.extractors) !== null && _cardContext$extracto !== void 0 && _cardContext$extracto.getPreview(url, 'web'));
32
35
  }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
33
36
  var shouldShowLinkPulse = useMemo(function () {
34
- var _pluginInjectionApi$c;
35
- var awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.inlineCardAwarenessCandidatePosition;
36
- return isPulseEnabled && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
37
- }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.sharedState]);
37
+ return isPulseEnabled && linkPosition === inlineCardAwarenessCandidatePosition && canBeUpgradedToEmbed;
38
+ }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, inlineCardAwarenessCandidatePosition]);
38
39
  var shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
39
- var overlayCandidatePos = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.sharedState) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.overlayCandidatePosition;
40
- var isLinkMostRecentlyInserted = overlayCandidatePos === linkPosition;
40
+ var isLinkMostRecentlyInserted = overlayCandidatePosition === linkPosition;
41
41
  var shouldShowToolbarPulse = useMemo(function () {
42
42
  return isPulseEnabled && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR) && canBeUpgradedToEmbed;
43
43
  }, [canBeUpgradedToEmbed, isPulseEnabled]);
@@ -1,4 +1,5 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useEffect } from 'react';
2
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
2
3
  import { Pulse } from '@atlaskit/linking-common';
3
4
  import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../local-storage';
4
5
  export var DiscoveryPulse = function DiscoveryPulse(_ref) {
@@ -9,6 +10,20 @@ export var DiscoveryPulse = function DiscoveryPulse(_ref) {
9
10
  _ref$discoveryMode = _ref.discoveryMode,
10
11
  discoveryMode = _ref$discoveryMode === void 0 ? 'iteration' : _ref$discoveryMode;
11
12
  var discovered = isDiscovered || isLocalStorageKeyDiscovered(localStorageKey);
13
+ var _useAnalyticsEvents = useAnalyticsEvents(),
14
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
15
+ useEffect(function () {
16
+ if (!discovered) {
17
+ createAnalyticsEvent({
18
+ action: 'viewed',
19
+ actionSubject: 'pulse',
20
+ eventType: 'ui',
21
+ attributes: {
22
+ pulseIdentifier: localStorageKey
23
+ }
24
+ }).fire('media');
25
+ }
26
+ }, [createAnalyticsEvent, discovered, localStorageKey]);
12
27
  var onDiscovery = useCallback(function () {
13
28
  if (!discovered) {
14
29
  markLocalStorageKeyDiscovered(localStorageKey, localStorageKeyExpirationInMs);
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import { memo, useCallback, useMemo, useState } from 'react';
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import rafSchedule from 'raf-schd';
6
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
6
7
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
7
8
  import { Card as SmartCard } from '@atlaskit/smart-card';
8
9
  import useLinkUpgradeDiscoverability from '../common/hooks/useLinkUpgradeDiscoverability';
@@ -10,6 +11,7 @@ import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LO
10
11
  import { DiscoveryPulse } from '../common/pulse';
11
12
  import { registerCard, registerRemoveOverlay } from '../pm-plugins/actions';
12
13
  import InlineCardOverlay from '../ui/InlineCardOverlay';
14
+ import { getResolvedAttributesFromStore } from '../utils';
13
15
  // editor adds a standard line-height that is bigger than an inline smart link
14
16
  // due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
15
17
  var loaderWrapperStyles = css({
@@ -19,6 +21,7 @@ var loaderWrapperStyles = css({
19
21
  }
20
22
  });
21
23
  var InlineCard = function InlineCard(_ref) {
24
+ var _cardContext$value2;
22
25
  var node = _ref.node,
23
26
  cardContext = _ref.cardContext,
24
27
  showServerActions = _ref.showServerActions,
@@ -140,15 +143,20 @@ var InlineCard = function InlineCard(_ref) {
140
143
  }, innerCard) : innerCard;
141
144
  }, [innerCard, isHovered, isSelected, isInserted, shouldShowLinkOverlay, url]);
142
145
  var card = useMemo(function () {
146
+ var _cardContext$value;
143
147
  return jsx("span", {
144
148
  css: shouldShowLinkPulse && loaderWrapperStyles,
145
149
  className: "card"
146
- }, shouldShowLinkPulse ? jsx(DiscoveryPulse, {
150
+ }, shouldShowLinkPulse ? jsx(AnalyticsContext, {
151
+ data: {
152
+ attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
153
+ }
154
+ }, jsx(DiscoveryPulse, {
147
155
  localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
148
156
  localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
149
157
  discoveryMode: "start"
150
- }, cardWithOverlay) : cardWithOverlay);
151
- }, [shouldShowLinkPulse, cardWithOverlay]);
158
+ }, cardWithOverlay)) : cardWithOverlay);
159
+ }, [shouldShowLinkPulse, cardWithOverlay, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store]);
152
160
  // END: Awareness
153
161
 
154
162
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
@@ -11,7 +11,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSta
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import debounce from 'lodash/debounce';
13
13
  import { useIntl } from 'react-intl-next';
14
- import { browser } from '@atlaskit/editor-common/utils';
14
+ import { browser, ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
15
15
  import HipchatChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
16
16
  import HipchatChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
17
17
  import { N20A, N800 } from '@atlaskit/theme/colors';
@@ -99,7 +99,8 @@ var markerStyles = css({
99
99
  height: "var(--ds-space-0, 0)",
100
100
  width: "var(--ds-space-0, 0)",
101
101
  margin: "var(--ds-space-0, 0)",
102
- padding: "var(--ds-space-0, 0)"
102
+ padding: "var(--ds-space-0, 0)",
103
+ whiteSpace: 'nowrap'
103
104
  });
104
105
  var InlineCardOverlay = function InlineCardOverlay(_ref) {
105
106
  var children = _ref.children,
@@ -235,7 +236,7 @@ var InlineCardOverlay = function InlineCardOverlay(_ref) {
235
236
  "aria-hidden": "true",
236
237
  className: OVERLAY_MARKER_CLASSNAME,
237
238
  css: markerStyles
238
- }), jsx("a", {
239
+ }, ZERO_WIDTH_JOINER), jsx("a", {
239
240
  className: OVERLAY_CLASSNAME,
240
241
  css: [overlayStyles, browser.safari && safariOverlayStyles],
241
242
  style: {
@@ -11,6 +11,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import React from 'react';
13
13
  import PropTypes from 'prop-types';
14
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
14
15
  import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
15
16
  import { commandWithMetadata, getButtonGroupOption, LinkToolbarButtonGroup } from '@atlaskit/editor-common/card';
16
17
  import nodeNames, { cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -19,6 +20,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
19
20
  import { LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../common/local-storage';
20
21
  import { DiscoveryPulse } from '../common/pulse';
21
22
  import { shouldRenderToolbarPulse } from '../toolbar';
23
+ import { getResolvedAttributesFromStore } from '../utils';
22
24
  // eslint-disable-next-line @repo/internal/react/no-class-components
23
25
  export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
24
26
  _inherits(LinkToolbarAppearance, _React$Component);
@@ -117,9 +119,14 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
117
119
  var status = url ? cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 || (_cardContext$store2 = _cardContext$store2.getState()[url]) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.status : '';
118
120
  var embedEnabled = embedOption ? !embedOption.disabled : false;
119
121
  if (shouldRenderToolbarPulse(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showUpgradeDiscoverability)) {
120
- return /*#__PURE__*/React.createElement(DiscoveryPulse, {
122
+ var resolvedAnalyticsAttributes = getResolvedAttributesFromStore(url || '', currentAppearance || null, cardContext === null || cardContext === void 0 ? void 0 : cardContext.store);
123
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
124
+ data: {
125
+ attributes: _objectSpread({}, resolvedAnalyticsAttributes)
126
+ }
127
+ }, /*#__PURE__*/React.createElement(DiscoveryPulse, {
121
128
  localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
122
- }, LinkToolbarButtons);
129
+ }, LinkToolbarButtons));
123
130
  }
124
131
  return LinkToolbarButtons;
125
132
  });
@@ -3,21 +3,9 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  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) { _defineProperty(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; }
4
4
  import React, { useEffect } from 'react';
5
5
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
- import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
6
+ import { getResolvedAttributesFromStore } from '../utils';
7
7
  import { CardContextProvider } from './CardContextProvider';
8
8
  import { EditorAnalyticsContext } from './EditorAnalyticsContext';
9
- var getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store) {
10
- if (!store) {
11
- return {};
12
- }
13
- var urlState = store.getState()[url];
14
- var displayCategory = display === 'url' ? 'link' : undefined;
15
- return getResolvedAttributes({
16
- url: url,
17
- displayCategory: displayCategory
18
- }, urlState === null || urlState === void 0 ? void 0 : urlState.details);
19
- };
20
-
21
9
  /**
22
10
  * Handles firing the toolbar viewed event
23
11
  */
package/dist/esm/utils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
3
4
  import { pluginKey } from './pm-plugins/plugin-key';
4
5
  export var appearanceForNodeType = function appearanceForNodeType(spec) {
5
6
  if (spec.name === 'inlineCard') {
@@ -57,4 +58,15 @@ export var isEmbedSupportedAtPosition = function isEmbedSupportedAtPosition(curr
57
58
  };
58
59
  export var isBlockSupportedAtPosition = function isBlockSupportedAtPosition(currentNodePosition, editorState, currentAppearance) {
59
60
  return isAppearanceSupportedInParent(currentNodePosition, editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
61
+ };
62
+ export var getResolvedAttributesFromStore = function getResolvedAttributesFromStore(url, display, store) {
63
+ if (!store) {
64
+ return {};
65
+ }
66
+ var urlState = store === null || store === void 0 ? void 0 : store.getState()[url];
67
+ var displayCategory = display === 'url' ? 'link' : undefined;
68
+ return getResolvedAttributes({
69
+ url: url,
70
+ displayCategory: displayCategory
71
+ }, urlState === null || urlState === void 0 ? void 0 : urlState.details);
60
72
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { EditorAnalyticsContextProps } from './EditorAnalyticsContext';
2
+ import type { EditorAnalyticsContextProps } from './EditorAnalyticsContext';
3
3
  type ToolbarViewedEventProps = {
4
4
  url?: string;
5
5
  display: string | null;
@@ -1,6 +1,7 @@
1
1
  import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
2
2
  import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ import type { CardContext } from '@atlaskit/link-provider';
4
5
  import type { CardInfo } from './types';
5
6
  export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
6
7
  export declare const selectedCardAppearance: (state: EditorState) => CardAppearance | undefined;
@@ -19,3 +20,4 @@ export declare const displayInfoForCard: (node: Node, info?: CardInfo) => TitleU
19
20
  export declare const findCardInfo: (state: EditorState) => CardInfo | undefined;
20
21
  export declare const isEmbedSupportedAtPosition: (currentNodePosition: number, editorState: EditorState, currentAppearance?: CardAppearance) => boolean;
21
22
  export declare const isBlockSupportedAtPosition: (currentNodePosition: number, editorState: EditorState, currentAppearance?: CardAppearance) => boolean;
23
+ export declare const getResolvedAttributesFromStore: (url: string, display: string | null, store?: CardContext['store']) => {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { EditorAnalyticsContextProps } from './EditorAnalyticsContext';
2
+ import type { EditorAnalyticsContextProps } from './EditorAnalyticsContext';
3
3
  type ToolbarViewedEventProps = {
4
4
  url?: string;
5
5
  display: string | null;
@@ -1,6 +1,7 @@
1
1
  import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
2
2
  import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
+ import type { CardContext } from '@atlaskit/link-provider';
4
5
  import type { CardInfo } from './types';
5
6
  export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
6
7
  export declare const selectedCardAppearance: (state: EditorState) => CardAppearance | undefined;
@@ -19,3 +20,4 @@ export declare const displayInfoForCard: (node: Node, info?: CardInfo) => TitleU
19
20
  export declare const findCardInfo: (state: EditorState) => CardInfo | undefined;
20
21
  export declare const isEmbedSupportedAtPosition: (currentNodePosition: number, editorState: EditorState, currentAppearance?: CardAppearance) => boolean;
21
22
  export declare const isBlockSupportedAtPosition: (currentNodePosition: number, editorState: EditorState, currentAppearance?: CardAppearance) => boolean;
23
+ export declare const getResolvedAttributesFromStore: (url: string, display: string | null, store?: CardContext['store']) => {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.14.6",
3
+ "version": "0.14.8",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -8,7 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
- "team": "Editor: Media Experience Porygon",
11
+ "team": "Linking Platform",
12
12
  "singleton": true,
13
13
  "releaseModel": "continuous"
14
14
  },
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/linking-common": "^4.21.0",
53
53
  "@atlaskit/linking-types": "^8.5.0",
54
54
  "@atlaskit/platform-feature-flags": "^0.2.0",
55
- "@atlaskit/primitives": "^1.12.0",
55
+ "@atlaskit/primitives": "^1.13.0",
56
56
  "@atlaskit/smart-card": "^26.42.0",
57
57
  "@atlaskit/theme": "^12.6.0",
58
58
  "@atlaskit/tokens": "^1.29.0",