@atlaskit/editor-plugin-card 6.4.4 → 6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 6.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#161907](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161907)
8
+ [`0f083a35b280f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f083a35b280f) -
9
+ [ux] Add optional CompetitorPrompt component to display for Smart Link card for experiment
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 6.4.5
16
+
17
+ ### Patch Changes
18
+
19
+ - [#163546](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/163546)
20
+ [`d3faab1b963ad`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d3faab1b963ad) -
21
+ [ux] ED-28147 smart link support for cmd/ctrl click to open in new tab
22
+ - Updated dependencies
23
+
3
24
  ## 6.4.4
4
25
 
5
26
  ### Patch Changes
@@ -111,7 +111,8 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
111
111
  node = _this$props2.node,
112
112
  cardContext = _this$props2.cardContext,
113
113
  actionOptions = _this$props2.actionOptions,
114
- onClick = _this$props2.onClick;
114
+ onClick = _this$props2.onClick,
115
+ CompetitorPrompt = _this$props2.CompetitorPrompt;
115
116
  var _node$attrs = node.attrs,
116
117
  url = _node$attrs.url,
117
118
  data = _node$attrs.data;
@@ -124,7 +125,8 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
124
125
  onResolve: this.onResolve,
125
126
  onError: this.onError,
126
127
  platform: 'web',
127
- actionOptions: actionOptions
128
+ actionOptions: actionOptions,
129
+ CompetitorPrompt: CompetitorPrompt
128
130
  }), this.gapCursorSpan());
129
131
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
130
132
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
@@ -192,7 +194,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
192
194
  var _this$reactComponentP3 = this.reactComponentProps,
193
195
  actionOptions = _this$reactComponentP3.actionOptions,
194
196
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
195
- onClickCallback = _this$reactComponentP3.onClickCallback;
197
+ onClickCallback = _this$reactComponentP3.onClickCallback,
198
+ CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
196
199
  return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
197
200
  node: this.node,
198
201
  view: this.view,
@@ -200,7 +203,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
200
203
  actionOptions: actionOptions,
201
204
  pluginInjectionApi: pluginInjectionApi,
202
205
  onClickCallback: onClickCallback,
203
- id: this.id
206
+ id: this.id,
207
+ CompetitorPrompt: CompetitorPrompt
204
208
  });
205
209
  }
206
210
  }, {
@@ -235,14 +239,16 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
235
239
  pluginInjectionApi = _ref3.pluginInjectionApi,
236
240
  onClickCallback = _ref3.onClickCallback,
237
241
  allowDatasource = _ref3.allowDatasource,
238
- inlineCardViewProducer = _ref3.inlineCardViewProducer;
242
+ inlineCardViewProducer = _ref3.inlineCardViewProducer,
243
+ CompetitorPrompt = _ref3.CompetitorPrompt;
239
244
  return function (node, view, getPos, decorations) {
240
245
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
241
246
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
242
247
  var reactComponentProps = {
243
248
  actionOptions: actionOptions,
244
249
  pluginInjectionApi: pluginInjectionApi,
245
- onClickCallback: onClickCallback
250
+ onClickCallback: onClickCallback,
251
+ CompetitorPrompt: CompetitorPrompt
246
252
  };
247
253
  var isDatasource = (0, _utils2.isDatasourceNode)(node);
248
254
  if (isDatasource) {
@@ -13,6 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
15
15
  var _v = _interopRequireDefault(require("uuid/v4"));
16
+ var _analytics = require("@atlaskit/editor-common/analytics");
16
17
  var _hooks = require("@atlaskit/editor-common/hooks");
17
18
  var _link = require("@atlaskit/editor-common/link");
18
19
  var _ui = require("@atlaskit/editor-common/ui");
@@ -21,9 +22,11 @@ var _state = require("@atlaskit/editor-prosemirror/state");
21
22
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
23
  var _smartCard = require("@atlaskit/smart-card");
23
24
  var _ssr = require("@atlaskit/smart-card/ssr");
25
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
24
26
  var _actions = require("../pm-plugins/actions");
25
27
  var _utils = require("../pm-plugins/utils");
26
28
  var _ConfigureOverlay = _interopRequireDefault(require("../ui/ConfigureOverlay"));
29
+ var _toolbar = require("../ui/toolbar");
27
30
  var _genericCard = require("./genericCard");
28
31
  var _inlineCardWithAwareness = require("./inlineCardWithAwareness");
29
32
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -39,7 +42,8 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
39
42
  isHovered = _ref.isHovered,
40
43
  showHoverPreview = _ref.showHoverPreview,
41
44
  hoverPreviewOptions = _ref.hoverPreviewOptions,
42
- isPageSSRed = _ref.isPageSSRed;
45
+ isPageSSRed = _ref.isPageSSRed,
46
+ pluginInjectionApi = _ref.pluginInjectionApi;
43
47
  var _node$attrs = node.attrs,
44
48
  url = _node$attrs.url,
45
49
  data = _node$attrs.data;
@@ -95,13 +99,28 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
95
99
  url: url
96
100
  });
97
101
  }, [onResolve]);
102
+ var handleOnClick = (0, _react.useCallback)(function (event) {
103
+ onClick === null || onClick === void 0 || onClick(event);
104
+ if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _experiments.editorExperiment)('platform_editor_smart_link_cmd_ctrl_click', true, {
105
+ exposure: true
106
+ })) {
107
+ // open link in new tab when performing a cmd/ctrl + click
108
+ if (event.metaKey || event.ctrlKey) {
109
+ var _pluginInjectionApi$a;
110
+ var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
111
+ editorAnalyticsApi = _ref2.actions;
112
+ (0, _toolbar.visitCardLinkAnalyticsOnly)(editorAnalyticsApi, _analytics.INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
113
+ window.open(url, '_blank');
114
+ }
115
+ }
116
+ }, [onClick, url, view, pluginInjectionApi]);
98
117
  var card = (0, _react.useMemo)(function () {
99
118
  if (isPageSSRed && url && (0, _platformFeatureFlags.fg)('platform_ssr_smartlinks_editor')) {
100
119
  return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
101
120
  key: url,
102
121
  url: url,
103
122
  appearance: "inline",
104
- onClick: onClick,
123
+ onClick: handleOnClick,
105
124
  container: scrollContainer,
106
125
  onResolve: onResolve,
107
126
  onError: onError,
@@ -116,7 +135,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
116
135
  key: url,
117
136
  url: url !== null && url !== void 0 ? url : data.url,
118
137
  appearance: "inline",
119
- onClick: onClick,
138
+ onClick: handleOnClick,
120
139
  container: scrollContainer,
121
140
  onResolve: onResolve,
122
141
  onError: onError,
@@ -126,7 +145,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
126
145
  showHoverPreview: showHoverPreview,
127
146
  hoverPreviewOptions: hoverPreviewOptions
128
147
  });
129
- }, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
148
+ }, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
130
149
 
131
150
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
132
151
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
@@ -206,9 +225,9 @@ function InlineCardNodeView(props) {
206
225
  view: view,
207
226
  isHoveredCallback: setIsOverlayHovered,
208
227
  onOpenLinkClick: function onOpenLinkClick(event) {
209
- var _pluginInjectionApi$a;
228
+ var _pluginInjectionApi$a2;
210
229
  (0, _link.handleNavigation)({
211
- fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.fireAnalyticsEvent,
230
+ fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.fireAnalyticsEvent,
212
231
  onClickCallback: onClickCallback,
213
232
  url: url,
214
233
  event: event
@@ -230,8 +249,8 @@ function InlineCardNodeView(props) {
230
249
  // eslint-disable-next-line react/jsx-props-no-spreading
231
250
  }, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), (0, _platformFeatureFlags.fg)('prompt_whiteboard_competitor_link_gate') && CompetitorPromptComponent);
232
251
  }
233
- var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(_ref2) {
234
- var inlineCardViewProducer = _ref2.inlineCardViewProducer;
252
+ var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(_ref3) {
253
+ var inlineCardViewProducer = _ref3.inlineCardViewProducer;
235
254
  return function (node, view, getPos, decorations) {
236
255
  return inlineCardViewProducer(node, view, getPos, decorations);
237
256
  };
@@ -31,7 +31,7 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
31
31
  };
32
32
  });
33
33
  var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0, _react.memo)(function (_ref) {
34
- var _pluginInjectionApi$c, _pluginInjectionApi$a;
34
+ var _pluginInjectionApi$c;
35
35
  var node = _ref.node,
36
36
  cardContext = _ref.cardContext,
37
37
  actionOptions = _ref.actionOptions,
@@ -58,8 +58,6 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
58
58
  isResolvedViewRendered = _useState6[0],
59
59
  setIsResolvedViewRendered = _useState6[1];
60
60
  var editorAppearance = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.editorAppearance;
61
- var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
62
- editorAnalyticsApi = _ref2.actions;
63
61
  var onResolve = (0, _react.useCallback)(function (tr, title) {
64
62
  var metadata = tr.getMeta(_pluginKey.pluginKey);
65
63
  if (metadata && metadata.type === 'REGISTER') {
@@ -88,11 +86,12 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
88
86
  var _useSharedState = useSharedState(pluginInjectionApi),
89
87
  mode = _useSharedState.mode;
90
88
  var innerCardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
89
+ var _pluginInjectionApi$a;
91
90
  return /*#__PURE__*/_react.default.createElement(_OpenButtonOverlay.default, {
92
91
  isVisible: isResolvedViewRendered,
93
92
  url: node.attrs.url,
94
93
  editorAppearance: editorAppearance,
95
- editorAnalyticsApi: editorAnalyticsApi,
94
+ editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
96
95
  view: view
97
96
  }, /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
98
97
  node: node,
@@ -104,9 +103,10 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
104
103
  onClick: onClick,
105
104
  cardContext: cardContext,
106
105
  isHovered: isHovered,
107
- isPageSSRed: isPageSSRed
106
+ isPageSSRed: isPageSSRed,
107
+ pluginInjectionApi: pluginInjectionApi
108
108
  }));
109
- }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, editorAnalyticsApi]);
109
+ }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
110
110
  var innerCardOriginal = (0, _react.useMemo)(function () {
111
111
  return /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
112
112
  node: node,
@@ -118,9 +118,10 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
118
118
  onClick: onClick,
119
119
  cardContext: cardContext,
120
120
  isHovered: isHovered,
121
- isPageSSRed: isPageSSRed
121
+ isPageSSRed: isPageSSRed,
122
+ pluginInjectionApi: pluginInjectionApi
122
123
  });
123
- }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
124
+ }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
124
125
  var shouldShowOpenButtonOverlay = (0, _react.useMemo)(function () {
125
126
  var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8');
126
127
  return (mode === 'edit' || editorAppearance === 'comment' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') || shouldShowOpenButtonOverlayInChomeless) && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
@@ -263,7 +263,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
263
263
  pluginInjectionApi: pluginInjectionApi,
264
264
  onClickCallback: onClickCallback,
265
265
  allowDatasource: options.allowDatasource,
266
- inlineCardViewProducer: inlineCardViewProducer
266
+ inlineCardViewProducer: inlineCardViewProducer,
267
+ CompetitorPrompt: options.CompetitorPrompt
267
268
  }),
268
269
  embedCard: (0, _lazyEmbedCard.lazyEmbedCardView)({
269
270
  allowResizing: allowResizing,
@@ -84,7 +84,7 @@ var visitCardLink = exports.visitCardLink = function visitCardLink(editorAnalyti
84
84
  // EDM-12466:
85
85
  // During smart_link_editor_update_toolbar_open_link clean up
86
86
  // Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
87
- // INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | NPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK
87
+ // INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
88
88
  if (!(0, _platformFeatureFlags.fg)('smart_link_editor_update_toolbar_open_link')) {
89
89
  var _titleUrlPairFromNode = (0, _utils3.titleUrlPairFromNode)(state.selection.node),
90
90
  url = _titleUrlPairFromNode.url;
@@ -92,7 +92,8 @@ export class BlockCardComponent extends React.PureComponent {
92
92
  node,
93
93
  cardContext,
94
94
  actionOptions,
95
- onClick
95
+ onClick,
96
+ CompetitorPrompt
96
97
  } = this.props;
97
98
  const {
98
99
  url,
@@ -107,7 +108,8 @@ export class BlockCardComponent extends React.PureComponent {
107
108
  onResolve: this.onResolve,
108
109
  onError: this.onError,
109
110
  platform: 'web',
110
- actionOptions: actionOptions
111
+ actionOptions: actionOptions,
112
+ CompetitorPrompt: CompetitorPrompt
111
113
  }), this.gapCursorSpan());
112
114
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
113
115
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
@@ -155,7 +157,8 @@ export class BlockCard extends ReactNodeView {
155
157
  const {
156
158
  actionOptions,
157
159
  pluginInjectionApi,
158
- onClickCallback
160
+ onClickCallback,
161
+ CompetitorPrompt
159
162
  } = this.reactComponentProps;
160
163
  return /*#__PURE__*/React.createElement(WrappedBlockCard, {
161
164
  node: this.node,
@@ -164,7 +167,8 @@ export class BlockCard extends ReactNodeView {
164
167
  actionOptions: actionOptions,
165
168
  pluginInjectionApi: pluginInjectionApi,
166
169
  onClickCallback: onClickCallback,
167
- id: this.id
170
+ id: this.id,
171
+ CompetitorPrompt: CompetitorPrompt
168
172
  });
169
173
  }
170
174
  destroy() {
@@ -196,7 +200,8 @@ export const blockCardNodeView = ({
196
200
  pluginInjectionApi,
197
201
  onClickCallback,
198
202
  allowDatasource,
199
- inlineCardViewProducer
203
+ inlineCardViewProducer,
204
+ CompetitorPrompt
200
205
  }) => (node, view, getPos, decorations) => {
201
206
  const {
202
207
  portalProviderAPI,
@@ -205,7 +210,8 @@ export const blockCardNodeView = ({
205
210
  const reactComponentProps = {
206
211
  actionOptions,
207
212
  pluginInjectionApi,
208
- onClickCallback: onClickCallback
213
+ onClickCallback: onClickCallback,
214
+ CompetitorPrompt
209
215
  };
210
216
  const isDatasource = isDatasourceNode(node);
211
217
  if (isDatasource) {
@@ -2,17 +2,20 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import rafSchedule from 'raf-schd';
4
4
  import uuid from 'uuid/v4';
5
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
6
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
7
  import { handleNavigation } from '@atlaskit/editor-common/link';
7
- import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
8
+ import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
8
9
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
11
  import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import { Card as SmartCard } from '@atlaskit/smart-card';
12
13
  import { CardSSR } from '@atlaskit/smart-card/ssr';
14
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
15
  import { registerCard, removeCard } from '../pm-plugins/actions';
14
16
  import { getAwarenessProps } from '../pm-plugins/utils';
15
17
  import OverlayWrapper from '../ui/ConfigureOverlay';
18
+ import { visitCardLinkAnalyticsOnly } from '../ui/toolbar';
16
19
  import { Card } from './genericCard';
17
20
  import { InlineCardWithAwareness } from './inlineCardWithAwareness';
18
21
  export const InlineCard = /*#__PURE__*/memo(({
@@ -27,7 +30,8 @@ export const InlineCard = /*#__PURE__*/memo(({
27
30
  isHovered,
28
31
  showHoverPreview,
29
32
  hoverPreviewOptions,
30
- isPageSSRed
33
+ isPageSSRed,
34
+ pluginInjectionApi
31
35
  }) => {
32
36
  const {
33
37
  url,
@@ -89,13 +93,29 @@ export const InlineCard = /*#__PURE__*/memo(({
89
93
  url
90
94
  });
91
95
  }, [onResolve]);
96
+ const handleOnClick = useCallback(event => {
97
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
98
+ if (editorExperiment('platform_editor_controls', 'variant1') && editorExperiment('platform_editor_smart_link_cmd_ctrl_click', true, {
99
+ exposure: true
100
+ })) {
101
+ // open link in new tab when performing a cmd/ctrl + click
102
+ if (event.metaKey || event.ctrlKey) {
103
+ var _pluginInjectionApi$a;
104
+ const {
105
+ actions: editorAnalyticsApi
106
+ } = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {};
107
+ visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
108
+ window.open(url, '_blank');
109
+ }
110
+ }
111
+ }, [onClick, url, view, pluginInjectionApi]);
92
112
  const card = useMemo(() => {
93
113
  if (isPageSSRed && url && fg('platform_ssr_smartlinks_editor')) {
94
114
  return /*#__PURE__*/React.createElement(CardSSR, {
95
115
  key: url,
96
116
  url: url,
97
117
  appearance: "inline",
98
- onClick: onClick,
118
+ onClick: handleOnClick,
99
119
  container: scrollContainer,
100
120
  onResolve: onResolve,
101
121
  onError: onError,
@@ -110,7 +130,7 @@ export const InlineCard = /*#__PURE__*/memo(({
110
130
  key: url,
111
131
  url: url !== null && url !== void 0 ? url : data.url,
112
132
  appearance: "inline",
113
- onClick: onClick,
133
+ onClick: handleOnClick,
114
134
  container: scrollContainer,
115
135
  onResolve: onResolve,
116
136
  onError: onError,
@@ -120,7 +140,7 @@ export const InlineCard = /*#__PURE__*/memo(({
120
140
  showHoverPreview: showHoverPreview,
121
141
  hoverPreviewOptions: hoverPreviewOptions
122
142
  });
123
- }, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
143
+ }, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
124
144
 
125
145
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
126
146
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
@@ -201,9 +221,9 @@ export function InlineCardNodeView(props) {
201
221
  view: view,
202
222
  isHoveredCallback: setIsOverlayHovered,
203
223
  onOpenLinkClick: event => {
204
- var _pluginInjectionApi$a;
224
+ var _pluginInjectionApi$a2;
205
225
  handleNavigation({
206
- fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.fireAnalyticsEvent,
226
+ fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.fireAnalyticsEvent,
207
227
  onClickCallback,
208
228
  url,
209
229
  event
@@ -36,14 +36,11 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
36
36
  isPageSSRed,
37
37
  appearance
38
38
  }) => {
39
- var _pluginInjectionApi$c, _pluginInjectionApi$a;
39
+ var _pluginInjectionApi$c;
40
40
  const [isHovered, setIsHovered] = useState(false);
41
41
  const [isInserted, setIsInserted] = useState(false);
42
42
  const [isResolvedViewRendered, setIsResolvedViewRendered] = useState(false);
43
43
  const editorAppearance = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.editorAppearance;
44
- const {
45
- actions: editorAnalyticsApi
46
- } = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {};
47
44
  const onResolve = useCallback((tr, title) => {
48
45
  const metadata = tr.getMeta(pluginKey);
49
46
  if (metadata && metadata.type === 'REGISTER') {
@@ -68,24 +65,28 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
68
65
  const {
69
66
  mode
70
67
  } = useSharedState(pluginInjectionApi);
71
- const innerCardWithOpenButtonOverlay = useMemo(() => /*#__PURE__*/React.createElement(OpenButtonOverlay, {
72
- isVisible: isResolvedViewRendered,
73
- url: node.attrs.url,
74
- editorAppearance: editorAppearance,
75
- editorAnalyticsApi: editorAnalyticsApi,
76
- view: view
77
- }, /*#__PURE__*/React.createElement(InlineCard, {
78
- node: node,
79
- view: view,
80
- getPos: getPos,
81
- useAlternativePreloader: useAlternativePreloader,
82
- actionOptions: actionOptions,
83
- onResolve: onResolve,
84
- onClick: onClick,
85
- cardContext: cardContext,
86
- isHovered: isHovered,
87
- isPageSSRed: isPageSSRed
88
- })), [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, editorAnalyticsApi]);
68
+ const innerCardWithOpenButtonOverlay = useMemo(() => {
69
+ var _pluginInjectionApi$a;
70
+ return /*#__PURE__*/React.createElement(OpenButtonOverlay, {
71
+ isVisible: isResolvedViewRendered,
72
+ url: node.attrs.url,
73
+ editorAppearance: editorAppearance,
74
+ editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
75
+ view: view
76
+ }, /*#__PURE__*/React.createElement(InlineCard, {
77
+ node: node,
78
+ view: view,
79
+ getPos: getPos,
80
+ useAlternativePreloader: useAlternativePreloader,
81
+ actionOptions: actionOptions,
82
+ onResolve: onResolve,
83
+ onClick: onClick,
84
+ cardContext: cardContext,
85
+ isHovered: isHovered,
86
+ isPageSSRed: isPageSSRed,
87
+ pluginInjectionApi: pluginInjectionApi
88
+ }));
89
+ }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
89
90
  const innerCardOriginal = useMemo(() => /*#__PURE__*/React.createElement(InlineCard, {
90
91
  node: node,
91
92
  view: view,
@@ -96,8 +97,9 @@ export const InlineCardWithAwareness = /*#__PURE__*/memo(({
96
97
  onClick: onClick,
97
98
  cardContext: cardContext,
98
99
  isHovered: isHovered,
99
- isPageSSRed: isPageSSRed
100
- }), [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
100
+ isPageSSRed: isPageSSRed,
101
+ pluginInjectionApi: pluginInjectionApi
102
+ }), [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
101
103
  const shouldShowOpenButtonOverlay = useMemo(() => {
102
104
  const shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless' && fg('platform_editor_controls_patch_8');
103
105
  return (mode === 'edit' || editorAppearance === 'comment' && fg('platform_editor_controls_patch_6') || shouldShowOpenButtonOverlayInChomeless) && editorExperiment('platform_editor_controls', 'variant1');
@@ -262,7 +262,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
262
262
  pluginInjectionApi,
263
263
  onClickCallback,
264
264
  allowDatasource: options.allowDatasource,
265
- inlineCardViewProducer
265
+ inlineCardViewProducer,
266
+ CompetitorPrompt: options.CompetitorPrompt
266
267
  }),
267
268
  embedCard: lazyEmbedCardView({
268
269
  allowResizing,
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { isSafeUrl } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID, buildOpenedSettingsPayload, buildVisitedNonHyperLinkPayload, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID, EVENT_TYPE, INPUT_METHOD, buildOpenedSettingsPayload, buildVisitedNonHyperLinkPayload } from '@atlaskit/editor-common/analytics';
4
4
  import { buildLayoutButtons, buildLayoutDropdown, commandWithMetadata } from '@atlaskit/editor-common/card';
5
5
  import { getLinkPreferencesURLFromENV } from '@atlaskit/editor-common/link';
6
6
  import commonMessages, { annotationMessages, linkMessages, linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -72,7 +72,7 @@ export const visitCardLink = (editorAnalyticsApi, inputMethod) => (state, dispat
72
72
  // EDM-12466:
73
73
  // During smart_link_editor_update_toolbar_open_link clean up
74
74
  // Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
75
- // INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | NPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK
75
+ // INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
76
76
  if (!fg('smart_link_editor_update_toolbar_open_link')) {
77
77
  const {
78
78
  url
@@ -105,7 +105,8 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
105
105
  node = _this$props2.node,
106
106
  cardContext = _this$props2.cardContext,
107
107
  actionOptions = _this$props2.actionOptions,
108
- onClick = _this$props2.onClick;
108
+ onClick = _this$props2.onClick,
109
+ CompetitorPrompt = _this$props2.CompetitorPrompt;
109
110
  var _node$attrs = node.attrs,
110
111
  url = _node$attrs.url,
111
112
  data = _node$attrs.data;
@@ -118,7 +119,8 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
118
119
  onResolve: this.onResolve,
119
120
  onError: this.onError,
120
121
  platform: 'web',
121
- actionOptions: actionOptions
122
+ actionOptions: actionOptions,
123
+ CompetitorPrompt: CompetitorPrompt
122
124
  }), this.gapCursorSpan());
123
125
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
124
126
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
@@ -186,7 +188,8 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
186
188
  var _this$reactComponentP3 = this.reactComponentProps,
187
189
  actionOptions = _this$reactComponentP3.actionOptions,
188
190
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
189
- onClickCallback = _this$reactComponentP3.onClickCallback;
191
+ onClickCallback = _this$reactComponentP3.onClickCallback,
192
+ CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
190
193
  return /*#__PURE__*/React.createElement(WrappedBlockCard, {
191
194
  node: this.node,
192
195
  view: this.view,
@@ -194,7 +197,8 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
194
197
  actionOptions: actionOptions,
195
198
  pluginInjectionApi: pluginInjectionApi,
196
199
  onClickCallback: onClickCallback,
197
- id: this.id
200
+ id: this.id,
201
+ CompetitorPrompt: CompetitorPrompt
198
202
  });
199
203
  }
200
204
  }, {
@@ -229,14 +233,16 @@ export var blockCardNodeView = function blockCardNodeView(_ref3) {
229
233
  pluginInjectionApi = _ref3.pluginInjectionApi,
230
234
  onClickCallback = _ref3.onClickCallback,
231
235
  allowDatasource = _ref3.allowDatasource,
232
- inlineCardViewProducer = _ref3.inlineCardViewProducer;
236
+ inlineCardViewProducer = _ref3.inlineCardViewProducer,
237
+ CompetitorPrompt = _ref3.CompetitorPrompt;
233
238
  return function (node, view, getPos, decorations) {
234
239
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
235
240
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
236
241
  var reactComponentProps = {
237
242
  actionOptions: actionOptions,
238
243
  pluginInjectionApi: pluginInjectionApi,
239
- onClickCallback: onClickCallback
244
+ onClickCallback: onClickCallback,
245
+ CompetitorPrompt: CompetitorPrompt
240
246
  };
241
247
  var isDatasource = isDatasourceNode(node);
242
248
  if (isDatasource) {
@@ -3,17 +3,20 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import rafSchedule from 'raf-schd';
5
5
  import uuid from 'uuid/v4';
6
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
7
  import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
8
  import { handleNavigation } from '@atlaskit/editor-common/link';
8
- import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-common/ui';
9
+ import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
9
10
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
10
11
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
12
  import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { Card as SmartCard } from '@atlaskit/smart-card';
13
14
  import { CardSSR } from '@atlaskit/smart-card/ssr';
15
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
16
  import { registerCard, removeCard } from '../pm-plugins/actions';
15
17
  import { getAwarenessProps } from '../pm-plugins/utils';
16
18
  import OverlayWrapper from '../ui/ConfigureOverlay';
19
+ import { visitCardLinkAnalyticsOnly } from '../ui/toolbar';
17
20
  import { Card } from './genericCard';
18
21
  import { InlineCardWithAwareness } from './inlineCardWithAwareness';
19
22
  export var InlineCard = /*#__PURE__*/memo(function (_ref) {
@@ -28,7 +31,8 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
28
31
  isHovered = _ref.isHovered,
29
32
  showHoverPreview = _ref.showHoverPreview,
30
33
  hoverPreviewOptions = _ref.hoverPreviewOptions,
31
- isPageSSRed = _ref.isPageSSRed;
34
+ isPageSSRed = _ref.isPageSSRed,
35
+ pluginInjectionApi = _ref.pluginInjectionApi;
32
36
  var _node$attrs = node.attrs,
33
37
  url = _node$attrs.url,
34
38
  data = _node$attrs.data;
@@ -84,13 +88,28 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
84
88
  url: url
85
89
  });
86
90
  }, [onResolve]);
91
+ var handleOnClick = useCallback(function (event) {
92
+ onClick === null || onClick === void 0 || onClick(event);
93
+ if (editorExperiment('platform_editor_controls', 'variant1') && editorExperiment('platform_editor_smart_link_cmd_ctrl_click', true, {
94
+ exposure: true
95
+ })) {
96
+ // open link in new tab when performing a cmd/ctrl + click
97
+ if (event.metaKey || event.ctrlKey) {
98
+ var _pluginInjectionApi$a;
99
+ var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
100
+ editorAnalyticsApi = _ref2.actions;
101
+ visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
102
+ window.open(url, '_blank');
103
+ }
104
+ }
105
+ }, [onClick, url, view, pluginInjectionApi]);
87
106
  var card = useMemo(function () {
88
107
  if (isPageSSRed && url && fg('platform_ssr_smartlinks_editor')) {
89
108
  return /*#__PURE__*/React.createElement(CardSSR, {
90
109
  key: url,
91
110
  url: url,
92
111
  appearance: "inline",
93
- onClick: onClick,
112
+ onClick: handleOnClick,
94
113
  container: scrollContainer,
95
114
  onResolve: onResolve,
96
115
  onError: onError,
@@ -105,7 +124,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
105
124
  key: url,
106
125
  url: url !== null && url !== void 0 ? url : data.url,
107
126
  appearance: "inline",
108
- onClick: onClick,
127
+ onClick: handleOnClick,
109
128
  container: scrollContainer,
110
129
  onResolve: onResolve,
111
130
  onError: onError,
@@ -115,7 +134,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
115
134
  showHoverPreview: showHoverPreview,
116
135
  hoverPreviewOptions: hoverPreviewOptions
117
136
  });
118
- }, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
137
+ }, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
119
138
 
120
139
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
121
140
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
@@ -195,9 +214,9 @@ export function InlineCardNodeView(props) {
195
214
  view: view,
196
215
  isHoveredCallback: setIsOverlayHovered,
197
216
  onOpenLinkClick: function onOpenLinkClick(event) {
198
- var _pluginInjectionApi$a;
217
+ var _pluginInjectionApi$a2;
199
218
  handleNavigation({
200
- fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.fireAnalyticsEvent,
219
+ fireAnalyticsEvent: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.fireAnalyticsEvent,
201
220
  onClickCallback: onClickCallback,
202
221
  url: url,
203
222
  event: event
@@ -219,8 +238,8 @@ export function InlineCardNodeView(props) {
219
238
  // eslint-disable-next-line react/jsx-props-no-spreading
220
239
  }, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), fg('prompt_whiteboard_competitor_link_gate') && CompetitorPromptComponent);
221
240
  }
222
- export var inlineCardNodeView = function inlineCardNodeView(_ref2) {
223
- var inlineCardViewProducer = _ref2.inlineCardViewProducer;
241
+ export var inlineCardNodeView = function inlineCardNodeView(_ref3) {
242
+ var inlineCardViewProducer = _ref3.inlineCardViewProducer;
224
243
  return function (node, view, getPos, decorations) {
225
244
  return inlineCardViewProducer(node, view, getPos, decorations);
226
245
  };
@@ -22,7 +22,7 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInject
22
22
  };
23
23
  });
24
24
  export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
25
- var _pluginInjectionApi$c, _pluginInjectionApi$a;
25
+ var _pluginInjectionApi$c;
26
26
  var node = _ref.node,
27
27
  cardContext = _ref.cardContext,
28
28
  actionOptions = _ref.actionOptions,
@@ -49,8 +49,6 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
49
49
  isResolvedViewRendered = _useState6[0],
50
50
  setIsResolvedViewRendered = _useState6[1];
51
51
  var editorAppearance = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card.sharedState.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.editorAppearance;
52
- var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
53
- editorAnalyticsApi = _ref2.actions;
54
52
  var onResolve = useCallback(function (tr, title) {
55
53
  var metadata = tr.getMeta(pluginKey);
56
54
  if (metadata && metadata.type === 'REGISTER') {
@@ -79,11 +77,12 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
79
77
  var _useSharedState = useSharedState(pluginInjectionApi),
80
78
  mode = _useSharedState.mode;
81
79
  var innerCardWithOpenButtonOverlay = useMemo(function () {
80
+ var _pluginInjectionApi$a;
82
81
  return /*#__PURE__*/React.createElement(OpenButtonOverlay, {
83
82
  isVisible: isResolvedViewRendered,
84
83
  url: node.attrs.url,
85
84
  editorAppearance: editorAppearance,
86
- editorAnalyticsApi: editorAnalyticsApi,
85
+ editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
87
86
  view: view
88
87
  }, /*#__PURE__*/React.createElement(InlineCard, {
89
88
  node: node,
@@ -95,9 +94,10 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
95
94
  onClick: onClick,
96
95
  cardContext: cardContext,
97
96
  isHovered: isHovered,
98
- isPageSSRed: isPageSSRed
97
+ isPageSSRed: isPageSSRed,
98
+ pluginInjectionApi: pluginInjectionApi
99
99
  }));
100
- }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, editorAnalyticsApi]);
100
+ }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
101
101
  var innerCardOriginal = useMemo(function () {
102
102
  return /*#__PURE__*/React.createElement(InlineCard, {
103
103
  node: node,
@@ -109,9 +109,10 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
109
109
  onClick: onClick,
110
110
  cardContext: cardContext,
111
111
  isHovered: isHovered,
112
- isPageSSRed: isPageSSRed
112
+ isPageSSRed: isPageSSRed,
113
+ pluginInjectionApi: pluginInjectionApi
113
114
  });
114
- }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed]);
115
+ }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
115
116
  var shouldShowOpenButtonOverlay = useMemo(function () {
116
117
  var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless' && fg('platform_editor_controls_patch_8');
117
118
  return (mode === 'edit' || editorAppearance === 'comment' && fg('platform_editor_controls_patch_6') || shouldShowOpenButtonOverlayInChomeless) && editorExperiment('platform_editor_controls', 'variant1');
@@ -256,7 +256,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
256
256
  pluginInjectionApi: pluginInjectionApi,
257
257
  onClickCallback: onClickCallback,
258
258
  allowDatasource: options.allowDatasource,
259
- inlineCardViewProducer: inlineCardViewProducer
259
+ inlineCardViewProducer: inlineCardViewProducer,
260
+ CompetitorPrompt: options.CompetitorPrompt
260
261
  }),
261
262
  embedCard: lazyEmbedCardView({
262
263
  allowResizing: allowResizing,
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  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; }
5
5
  import React from 'react';
6
6
  import { isSafeUrl } from '@atlaskit/adf-schema';
7
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID, buildOpenedSettingsPayload, buildVisitedNonHyperLinkPayload, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID as ACTION_SUBJECTID, EVENT_TYPE, INPUT_METHOD, buildOpenedSettingsPayload, buildVisitedNonHyperLinkPayload } from '@atlaskit/editor-common/analytics';
8
8
  import { buildLayoutButtons, buildLayoutDropdown, commandWithMetadata } from '@atlaskit/editor-common/card';
9
9
  import { getLinkPreferencesURLFromENV } from '@atlaskit/editor-common/link';
10
10
  import commonMessages, { annotationMessages, linkMessages, linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
@@ -75,7 +75,7 @@ export var visitCardLink = function visitCardLink(editorAnalyticsApi, inputMetho
75
75
  // EDM-12466:
76
76
  // During smart_link_editor_update_toolbar_open_link clean up
77
77
  // Consider updating the code to use visitCardLink or visitCardLinkAnalyticsOnly for all input methods:
78
- // INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | NPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK
78
+ // INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK || INPUT_METHOD.META_CLICK
79
79
  if (!fg('smart_link_editor_update_toolbar_open_link')) {
80
80
  var _titleUrlPairFromNode = titleUrlPairFromNode(state.selection.node),
81
81
  url = _titleUrlPairFromNode.url;
@@ -25,7 +25,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
25
25
  }) => void;
26
26
  render(): React.JSX.Element;
27
27
  }
28
- export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback'>;
28
+ export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'CompetitorPrompt'>;
29
29
  export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
30
30
  private id;
31
31
  unsubscribe: (() => void) | undefined;
@@ -45,5 +45,9 @@ export interface BlockCardNodeViewProperties {
45
45
  onClickCallback: BlockCardNodeViewProps['onClickCallback'];
46
46
  allowDatasource: boolean | undefined;
47
47
  inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
48
+ CompetitorPrompt?: React.ComponentType<{
49
+ sourceUrl: string;
50
+ linkType?: string;
51
+ }>;
48
52
  }
49
- export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
53
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
1
  import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
2
+ import React from 'react';
3
3
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
4
  import type { OnClickCallback } from '@atlaskit/editor-common/card';
5
5
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
6
6
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
- import type { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
7
+ import type { ReactComponentProps, getPosHandler } from '@atlaskit/editor-common/react-node-view';
8
8
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
9
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
10
10
  import { type Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { SmartCardProps } from './genericCard';
6
6
  import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
7
- export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, }: SmartCardProps) => React.JSX.Element | null>;
7
+ export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
8
8
  export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage' | 'isPageSSRed' | 'CompetitorPrompt'>;
9
9
  /**
10
10
  *
@@ -8,7 +8,7 @@ import type { cardPlugin } from '../index';
8
8
  import type { CardPluginOptions } from '../types';
9
9
  export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
10
10
  export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR) => Command;
11
- export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK) => Command;
11
+ export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
12
12
  export declare const openLinkSettings: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
13
13
  export declare const floatingToolbar: (cardOptions: CardOptions, lpLinkPicker: boolean, linkPickerOptions?: LinkPickerOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>, disableFloatingToolbar?: boolean) => FloatingToolbarHandler;
14
14
  export declare const getSettingsButton: (intl: IntlShape, editorAnalyticsApi: EditorAnalyticsAPI | undefined, userPreferencesLink?: string) => FloatingToolbarItem<Command>;
@@ -25,7 +25,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
25
25
  }) => void;
26
26
  render(): React.JSX.Element;
27
27
  }
28
- export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback'>;
28
+ export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'CompetitorPrompt'>;
29
29
  export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
30
30
  private id;
31
31
  unsubscribe: (() => void) | undefined;
@@ -45,5 +45,9 @@ export interface BlockCardNodeViewProperties {
45
45
  onClickCallback: BlockCardNodeViewProps['onClickCallback'];
46
46
  allowDatasource: boolean | undefined;
47
47
  inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
48
+ CompetitorPrompt?: React.ComponentType<{
49
+ sourceUrl: string;
50
+ linkType?: string;
51
+ }>;
48
52
  }
49
- export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
53
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
1
  import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
2
+ import React from 'react';
3
3
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
4
  import type { OnClickCallback } from '@atlaskit/editor-common/card';
5
5
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
6
6
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
- import type { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
7
+ import type { ReactComponentProps, getPosHandler } from '@atlaskit/editor-common/react-node-view';
8
8
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
9
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
10
10
  import { type Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { SmartCardProps } from './genericCard';
6
6
  import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
7
- export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, }: SmartCardProps) => React.JSX.Element | null>;
7
+ export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
8
8
  export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage' | 'isPageSSRed' | 'CompetitorPrompt'>;
9
9
  /**
10
10
  *
@@ -8,7 +8,7 @@ import type { cardPlugin } from '../index';
8
8
  import type { CardPluginOptions } from '../types';
9
9
  export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
10
10
  export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TOOLBAR) => Command;
11
- export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK) => Command;
11
+ export declare const visitCardLinkAnalyticsOnly: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod: INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.META_CLICK) => Command;
12
12
  export declare const openLinkSettings: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
13
13
  export declare const floatingToolbar: (cardOptions: CardOptions, lpLinkPicker: boolean, linkPickerOptions?: LinkPickerOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>, disableFloatingToolbar?: boolean) => FloatingToolbarHandler;
14
14
  export declare const getSettingsButton: (intl: IntlShape, editorAnalyticsApi: EditorAnalyticsAPI | undefined, userPreferencesLink?: string) => FloatingToolbarItem<Command>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "6.4.4",
3
+ "version": "6.5.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -61,9 +61,9 @@
61
61
  "@atlaskit/menu": "^8.0.0",
62
62
  "@atlaskit/platform-feature-flags": "^1.1.0",
63
63
  "@atlaskit/primitives": "^14.8.0",
64
- "@atlaskit/smart-card": "^38.5.0",
64
+ "@atlaskit/smart-card": "^38.7.0",
65
65
  "@atlaskit/theme": "^18.0.0",
66
- "@atlaskit/tmp-editor-statsig": "^5.8.0",
66
+ "@atlaskit/tmp-editor-statsig": "^5.11.0",
67
67
  "@atlaskit/tokens": "^5.0.0",
68
68
  "@babel/runtime": "^7.0.0",
69
69
  "@emotion/react": "^11.7.1",
@@ -73,7 +73,7 @@
73
73
  "uuid": "^3.1.0"
74
74
  },
75
75
  "peerDependencies": {
76
- "@atlaskit/link-provider": "^3.2.0",
76
+ "@atlaskit/link-provider": "^3.3.0",
77
77
  "react": "^18.2.0",
78
78
  "react-intl-next": "npm:react-intl@^5.18.1"
79
79
  },