@atlaskit/editor-plugin-card 6.4.5 → 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,17 @@
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
+
3
15
  ## 6.4.5
4
16
 
5
17
  ### 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) {
@@ -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,
@@ -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) {
@@ -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,
@@ -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) {
@@ -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,
@@ -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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "6.4.5",
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.6.0",
64
+ "@atlaskit/smart-card": "^38.7.0",
65
65
  "@atlaskit/theme": "^18.0.0",
66
- "@atlaskit/tmp-editor-statsig": "^5.10.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",