@atlaskit/editor-plugin-card 0.14.23 → 0.14.25

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,19 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 0.14.25
4
+
5
+ ### Patch Changes
6
+
7
+ - [#63612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63612) [`30f0f85d5af6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30f0f85d5af6) - Disable datasource table resize button when the component is nested inside another component.
8
+ - Updated dependencies
9
+
10
+ ## 0.14.24
11
+
12
+ ### Patch Changes
13
+
14
+ - [#63549](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63549) [`c2147cd56a94`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c2147cd56a94) - Fix inconsistency of discoverability pulse
15
+ - Updated dependencies
16
+
3
17
  ## 0.14.23
4
18
 
5
19
  ### Patch Changes
@@ -183,6 +183,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
183
183
  _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
184
184
  var sharedState = props === null || props === void 0 || (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.width) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.sharedState;
185
185
  _this2.tableWidth = sharedState === null || sharedState === void 0 || (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
186
+ _this2.isNodeNested = props.isNodeNested;
186
187
  sharedState === null || sharedState === void 0 || sharedState.onChange(function (_ref3) {
187
188
  var nextSharedState = _ref3.nextSharedState;
188
189
  if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.width && _this2.tableWidth !== (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width)) {
@@ -211,7 +212,7 @@ var Datasource = exports.Datasource = /*#__PURE__*/function (_ReactNodeView) {
211
212
  }, (0, _react2.jsx)("div", {
212
213
  className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
213
214
  style: {
214
- minWidth: (0, _utils.calcBreakoutWidth)(attrs.layout, this.tableWidth)
215
+ minWidth: this.isNodeNested ? '100%' : (0, _utils.calcBreakoutWidth)(attrs.layout, this.tableWidth)
215
216
  }
216
217
  }, (0, _react2.jsx)(DatasourceComponent, {
217
218
  node: this.node,
@@ -155,12 +155,16 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
155
155
  var _node$attrs2;
156
156
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
157
157
  var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
158
+ var isNested = selection.$anchor.depth > 0;
158
159
 
159
- // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
160
- dispatch((0, _actions.setCardLayoutAndDatasourceTableRef)({
161
- datasourceTableRef: datasourceTableRef,
162
- layout: layout
163
- })(tr));
160
+ // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
161
+ if (!isNested) {
162
+ // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
163
+ dispatch((0, _actions.setCardLayoutAndDatasourceTableRef)({
164
+ datasourceTableRef: datasourceTableRef,
165
+ layout: layout
166
+ })(tr));
167
+ }
164
168
  }
165
169
  } else {
166
170
  if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
@@ -223,6 +227,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
223
227
  if (isDatasource) {
224
228
  var _node$attrs4;
225
229
  if (options.allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
230
+ var datasourcePosition = typeof getPos === 'function' && getPos();
231
+ var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
232
+ var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
226
233
  return new _datasource.Datasource({
227
234
  node: node,
228
235
  view: view,
@@ -230,7 +237,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
230
237
  portalProviderAPI: portalProviderAPI,
231
238
  eventDispatcher: eventDispatcher,
232
239
  hasIntlContext: hasIntlContext,
233
- pluginInjectionApi: pluginInjectionApi
240
+ pluginInjectionApi: pluginInjectionApi,
241
+ isNodeNested: isNodeNested
234
242
  }).init();
235
243
  } else {
236
244
  return inlineCardViewProducer(node, view, getPos, decorations);
@@ -94,14 +94,16 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
94
94
  return (0, _react2.jsx)("span", {
95
95
  css: shouldShowLinkPulse && loaderWrapperStyles,
96
96
  className: "card"
97
- }, shouldShowLinkPulse ? (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
97
+ }, (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
98
98
  data: {
99
99
  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)
100
100
  }
101
101
  }, (0, _react2.jsx)(_Pulse.DiscoveryPulse, {
102
102
  localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
103
103
  localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
104
- discoveryMode: "start"
105
- }, cardWithOverlay)) : cardWithOverlay);
106
- }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, cardWithOverlay]);
104
+ discoveryMode: "start",
105
+ shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
106
+ testId: "link-discovery-pulse"
107
+ }, cardWithOverlay)));
108
+ }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
107
109
  };
@@ -135,7 +135,8 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
135
135
  attributes: _objectSpread({}, resolvedAnalyticsAttributes)
136
136
  }
137
137
  }, /*#__PURE__*/_react.default.createElement(_Pulse.DiscoveryPulse, {
138
- localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
138
+ localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR,
139
+ testId: "toolbar-discovery-pulse"
139
140
  }, LinkToolbarButtons));
140
141
  }
141
142
  return LinkToolbarButtons;
@@ -14,15 +14,17 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
14
14
  var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
15
15
  var children = _ref.children,
16
16
  localStorageKey = _ref.localStorageKey,
17
- isDiscovered = _ref.isDiscovered,
18
17
  localStorageKeyExpirationInMs = _ref.localStorageKeyExpirationInMs,
19
18
  _ref$discoveryMode = _ref.discoveryMode,
20
- discoveryMode = _ref$discoveryMode === void 0 ? 'iteration' : _ref$discoveryMode;
21
- var discovered = isDiscovered || (0, _localStorage.isLocalStorageKeyDiscovered)(localStorageKey);
19
+ discoveryMode = _ref$discoveryMode === void 0 ? 'iteration' : _ref$discoveryMode,
20
+ shouldShowPulse = _ref.shouldShowPulse,
21
+ testId = _ref.testId;
22
+ var discovered = (0, _localStorage.isLocalStorageKeyDiscovered)(localStorageKey);
23
+ var showPulse = shouldShowPulse !== null && shouldShowPulse !== void 0 ? shouldShowPulse : !discovered;
22
24
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
23
25
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
24
26
  (0, _react.useEffect)(function () {
25
- if (!discovered) {
27
+ if (showPulse) {
26
28
  createAnalyticsEvent({
27
29
  action: 'viewed',
28
30
  actionSubject: 'pulse',
@@ -32,16 +34,16 @@ var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
32
34
  }
33
35
  }).fire('media');
34
36
  }
35
- }, [createAnalyticsEvent, discovered, localStorageKey]);
37
+ }, [createAnalyticsEvent, discovered, localStorageKey, showPulse]);
36
38
  var onDiscovery = (0, _react.useCallback)(function () {
37
39
  if (!discovered) {
38
40
  (0, _localStorage.markLocalStorageKeyDiscovered)(localStorageKey, localStorageKeyExpirationInMs);
39
41
  }
40
42
  }, [discovered, localStorageKey, localStorageKeyExpirationInMs]);
41
- var pulseProps = {
42
- onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
43
+ return /*#__PURE__*/_react.default.createElement(_linkingCommon.Pulse, {
43
44
  onAnimationIteration: discoveryMode === 'iteration' ? onDiscovery : undefined,
44
- isDiscovered: discovered
45
- };
46
- return /*#__PURE__*/_react.default.createElement(_linkingCommon.Pulse, pulseProps, children);
45
+ onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
46
+ showPulse: showPulse,
47
+ testId: testId
48
+ }, children);
47
49
  };
@@ -150,6 +150,7 @@ export class Datasource extends ReactNodeView {
150
150
  super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
151
151
  const sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.width) === null || _props$pluginInjectio2 === void 0 ? void 0 : _props$pluginInjectio2.sharedState;
152
152
  this.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
153
+ this.isNodeNested = props.isNodeNested;
153
154
  sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(({
154
155
  nextSharedState
155
156
  }) => {
@@ -177,7 +178,7 @@ export class Datasource extends ReactNodeView {
177
178
  }, jsx("div", {
178
179
  className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
179
180
  style: {
180
- minWidth: calcBreakoutWidth(attrs.layout, this.tableWidth)
181
+ minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
181
182
  }
182
183
  }, jsx(DatasourceComponent, {
183
184
  node: this.node,
@@ -144,12 +144,16 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
144
144
  var _node$attrs2;
145
145
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
146
146
  const layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
147
+ const isNested = selection.$anchor.depth > 0;
147
148
 
148
- // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
149
- dispatch(setCardLayoutAndDatasourceTableRef({
150
- datasourceTableRef,
151
- layout
152
- })(tr));
149
+ // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
150
+ if (!isNested) {
151
+ // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
152
+ dispatch(setCardLayoutAndDatasourceTableRef({
153
+ datasourceTableRef,
154
+ layout
155
+ })(tr));
156
+ }
153
157
  }
154
158
  } else {
155
159
  if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
@@ -214,6 +218,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
214
218
  if (isDatasource) {
215
219
  var _node$attrs4, _node$attrs4$datasour;
216
220
  if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
221
+ const datasourcePosition = typeof getPos === 'function' && getPos();
222
+ const datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
223
+ const isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
217
224
  return new Datasource({
218
225
  node,
219
226
  view,
@@ -221,7 +228,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
221
228
  portalProviderAPI,
222
229
  eventDispatcher,
223
230
  hasIntlContext,
224
- pluginInjectionApi
231
+ pluginInjectionApi,
232
+ isNodeNested
225
233
  }).init();
226
234
  } else {
227
235
  return inlineCardViewProducer(node, view, getPos, decorations);
@@ -78,14 +78,16 @@ export const AwarenessWrapper = ({
78
78
  return jsx("span", {
79
79
  css: shouldShowLinkPulse && loaderWrapperStyles,
80
80
  className: "card"
81
- }, shouldShowLinkPulse ? jsx(AnalyticsContext, {
81
+ }, jsx(AnalyticsContext, {
82
82
  data: {
83
83
  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)
84
84
  }
85
85
  }, jsx(DiscoveryPulse, {
86
86
  localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
87
87
  localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
88
- discoveryMode: "start"
89
- }, cardWithOverlay)) : cardWithOverlay);
90
- }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, cardWithOverlay]);
88
+ discoveryMode: "start",
89
+ shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
90
+ testId: "link-discovery-pulse"
91
+ }, cardWithOverlay)));
92
+ }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
91
93
  };
@@ -106,7 +106,8 @@ export class LinkToolbarAppearance extends React.Component {
106
106
  }
107
107
  }
108
108
  }, /*#__PURE__*/React.createElement(DiscoveryPulse, {
109
- localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
109
+ localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR,
110
+ testId: "toolbar-discovery-pulse"
110
111
  }, LinkToolbarButtons));
111
112
  }
112
113
  return LinkToolbarButtons;
@@ -5,16 +5,18 @@ import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../.
5
5
  export const DiscoveryPulse = ({
6
6
  children,
7
7
  localStorageKey,
8
- isDiscovered,
9
8
  localStorageKeyExpirationInMs,
10
- discoveryMode = 'iteration'
9
+ discoveryMode = 'iteration',
10
+ shouldShowPulse,
11
+ testId
11
12
  }) => {
12
- const discovered = isDiscovered || isLocalStorageKeyDiscovered(localStorageKey);
13
+ const discovered = isLocalStorageKeyDiscovered(localStorageKey);
14
+ const showPulse = shouldShowPulse !== null && shouldShowPulse !== void 0 ? shouldShowPulse : !discovered;
13
15
  const {
14
16
  createAnalyticsEvent
15
17
  } = useAnalyticsEvents();
16
18
  useEffect(() => {
17
- if (!discovered) {
19
+ if (showPulse) {
18
20
  createAnalyticsEvent({
19
21
  action: 'viewed',
20
22
  actionSubject: 'pulse',
@@ -24,16 +26,16 @@ export const DiscoveryPulse = ({
24
26
  }
25
27
  }).fire('media');
26
28
  }
27
- }, [createAnalyticsEvent, discovered, localStorageKey]);
29
+ }, [createAnalyticsEvent, discovered, localStorageKey, showPulse]);
28
30
  const onDiscovery = useCallback(() => {
29
31
  if (!discovered) {
30
32
  markLocalStorageKeyDiscovered(localStorageKey, localStorageKeyExpirationInMs);
31
33
  }
32
34
  }, [discovered, localStorageKey, localStorageKeyExpirationInMs]);
33
- const pulseProps = {
34
- onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
35
+ return /*#__PURE__*/React.createElement(Pulse, {
35
36
  onAnimationIteration: discoveryMode === 'iteration' ? onDiscovery : undefined,
36
- isDiscovered: discovered
37
- };
38
- return /*#__PURE__*/React.createElement(Pulse, pulseProps, children);
37
+ onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
38
+ showPulse: showPulse,
39
+ testId: testId
40
+ }, children);
39
41
  };
@@ -177,6 +177,7 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
177
177
  _this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
178
178
  var sharedState = props === null || props === void 0 || (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 || (_props$pluginInjectio = _props$pluginInjectio.width) === null || _props$pluginInjectio === void 0 ? void 0 : _props$pluginInjectio.sharedState;
179
179
  _this2.tableWidth = sharedState === null || sharedState === void 0 || (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
180
+ _this2.isNodeNested = props.isNodeNested;
180
181
  sharedState === null || sharedState === void 0 || sharedState.onChange(function (_ref3) {
181
182
  var nextSharedState = _ref3.nextSharedState;
182
183
  if (nextSharedState !== null && nextSharedState !== void 0 && nextSharedState.width && _this2.tableWidth !== (nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.width)) {
@@ -205,7 +206,7 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
205
206
  }, jsx("div", {
206
207
  className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
207
208
  style: {
208
- minWidth: calcBreakoutWidth(attrs.layout, this.tableWidth)
209
+ minWidth: this.isNodeNested ? '100%' : calcBreakoutWidth(attrs.layout, this.tableWidth)
209
210
  }
210
211
  }, jsx(DatasourceComponent, {
211
212
  node: this.node,
@@ -143,12 +143,16 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
143
143
  var _node$attrs2;
144
144
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
145
145
  var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
146
+ var isNested = selection.$anchor.depth > 0;
146
147
 
147
- // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
148
- dispatch(setCardLayoutAndDatasourceTableRef({
149
- datasourceTableRef: datasourceTableRef,
150
- layout: layout
151
- })(tr));
148
+ // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
149
+ if (!isNested) {
150
+ // we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
151
+ dispatch(setCardLayoutAndDatasourceTableRef({
152
+ datasourceTableRef: datasourceTableRef,
153
+ layout: layout
154
+ })(tr));
155
+ }
152
156
  }
153
157
  } else {
154
158
  if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
@@ -211,6 +215,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
211
215
  if (isDatasource) {
212
216
  var _node$attrs4;
213
217
  if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
218
+ var datasourcePosition = typeof getPos === 'function' && getPos();
219
+ var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
220
+ var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
214
221
  return new Datasource({
215
222
  node: node,
216
223
  view: view,
@@ -218,7 +225,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
218
225
  portalProviderAPI: portalProviderAPI,
219
226
  eventDispatcher: eventDispatcher,
220
227
  hasIntlContext: hasIntlContext,
221
- pluginInjectionApi: pluginInjectionApi
228
+ pluginInjectionApi: pluginInjectionApi,
229
+ isNodeNested: isNodeNested
222
230
  }).init();
223
231
  } else {
224
232
  return inlineCardViewProducer(node, view, getPos, decorations);
@@ -86,14 +86,16 @@ export var AwarenessWrapper = function AwarenessWrapper(_ref) {
86
86
  return jsx("span", {
87
87
  css: shouldShowLinkPulse && loaderWrapperStyles,
88
88
  className: "card"
89
- }, shouldShowLinkPulse ? jsx(AnalyticsContext, {
89
+ }, jsx(AnalyticsContext, {
90
90
  data: {
91
91
  attributes: getResolvedAttributesFromStore(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
92
92
  }
93
93
  }, jsx(DiscoveryPulse, {
94
94
  localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
95
95
  localStorageKeyExpirationInMs: ONE_DAY_IN_MILLISECONDS,
96
- discoveryMode: "start"
97
- }, cardWithOverlay)) : cardWithOverlay);
98
- }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, cardWithOverlay]);
96
+ discoveryMode: "start",
97
+ shouldShowPulse: isResolvedViewRendered && shouldShowLinkPulse,
98
+ testId: "link-discovery-pulse"
99
+ }, cardWithOverlay)));
100
+ }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay]);
99
101
  };
@@ -125,7 +125,8 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
125
125
  attributes: _objectSpread({}, resolvedAnalyticsAttributes)
126
126
  }
127
127
  }, /*#__PURE__*/React.createElement(DiscoveryPulse, {
128
- localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR
128
+ localStorageKey: LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR,
129
+ testId: "toolbar-discovery-pulse"
129
130
  }, LinkToolbarButtons));
130
131
  }
131
132
  return LinkToolbarButtons;
@@ -5,15 +5,17 @@ import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../.
5
5
  export var DiscoveryPulse = function DiscoveryPulse(_ref) {
6
6
  var children = _ref.children,
7
7
  localStorageKey = _ref.localStorageKey,
8
- isDiscovered = _ref.isDiscovered,
9
8
  localStorageKeyExpirationInMs = _ref.localStorageKeyExpirationInMs,
10
9
  _ref$discoveryMode = _ref.discoveryMode,
11
- discoveryMode = _ref$discoveryMode === void 0 ? 'iteration' : _ref$discoveryMode;
12
- var discovered = isDiscovered || isLocalStorageKeyDiscovered(localStorageKey);
10
+ discoveryMode = _ref$discoveryMode === void 0 ? 'iteration' : _ref$discoveryMode,
11
+ shouldShowPulse = _ref.shouldShowPulse,
12
+ testId = _ref.testId;
13
+ var discovered = isLocalStorageKeyDiscovered(localStorageKey);
14
+ var showPulse = shouldShowPulse !== null && shouldShowPulse !== void 0 ? shouldShowPulse : !discovered;
13
15
  var _useAnalyticsEvents = useAnalyticsEvents(),
14
16
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
15
17
  useEffect(function () {
16
- if (!discovered) {
18
+ if (showPulse) {
17
19
  createAnalyticsEvent({
18
20
  action: 'viewed',
19
21
  actionSubject: 'pulse',
@@ -23,16 +25,16 @@ export var DiscoveryPulse = function DiscoveryPulse(_ref) {
23
25
  }
24
26
  }).fire('media');
25
27
  }
26
- }, [createAnalyticsEvent, discovered, localStorageKey]);
28
+ }, [createAnalyticsEvent, discovered, localStorageKey, showPulse]);
27
29
  var onDiscovery = useCallback(function () {
28
30
  if (!discovered) {
29
31
  markLocalStorageKeyDiscovered(localStorageKey, localStorageKeyExpirationInMs);
30
32
  }
31
33
  }, [discovered, localStorageKey, localStorageKeyExpirationInMs]);
32
- var pulseProps = {
33
- onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
34
+ return /*#__PURE__*/React.createElement(Pulse, {
34
35
  onAnimationIteration: discoveryMode === 'iteration' ? onDiscovery : undefined,
35
- isDiscovered: discovered
36
- };
37
- return /*#__PURE__*/React.createElement(Pulse, pulseProps, children);
36
+ onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
37
+ showPulse: showPulse,
38
+ testId: testId
39
+ }, children);
38
40
  };
@@ -18,6 +18,7 @@ export interface DatasourceProps extends ReactComponentProps {
18
18
  eventDispatcher: EventDispatcher;
19
19
  hasIntlContext: boolean;
20
20
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
21
+ isNodeNested?: boolean;
21
22
  }
22
23
  interface DatasourceComponentProps extends ReactComponentProps, Pick<DatasourceProps, 'node' | 'view' | 'getPos'> {
23
24
  }
@@ -39,6 +40,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
39
40
  }
40
41
  export declare class Datasource extends ReactNodeView<DatasourceProps> {
41
42
  private tableWidth;
43
+ private isNodeNested;
42
44
  constructor(props: DatasourceProps);
43
45
  createDomRef(): HTMLElement;
44
46
  render(): jsx.JSX.Element;
@@ -13,14 +13,12 @@ export interface PulseProps {
13
13
  * The time in ms after which the key in local storage will be considered expired and the Pulse will be shown again
14
14
  */
15
15
  localStorageKeyExpirationInMs?: number;
16
- /**
17
- * And indicator that the feature was discovered externally and the pulsation needs to stop.
18
- */
19
- isDiscovered?: boolean;
20
16
  /**
21
17
  * Indicates when the feature is considered discovered. If "start" is passed, local storage key will be invalidated
22
18
  * as soon as the animation starts. If "iteration" is passed (the default one), it will be invalidated after the first iteration
23
19
  */
24
20
  discoveryMode?: PulseDiscoveryMode;
21
+ shouldShowPulse?: boolean;
22
+ testId?: string;
25
23
  }
26
- export declare const DiscoveryPulse: ({ children, localStorageKey, isDiscovered, localStorageKeyExpirationInMs, discoveryMode, }: PulseProps) => JSX.Element;
24
+ export declare const DiscoveryPulse: ({ children, localStorageKey, localStorageKeyExpirationInMs, discoveryMode, shouldShowPulse, testId, }: PulseProps) => JSX.Element;
@@ -18,6 +18,7 @@ export interface DatasourceProps extends ReactComponentProps {
18
18
  eventDispatcher: EventDispatcher;
19
19
  hasIntlContext: boolean;
20
20
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
21
+ isNodeNested?: boolean;
21
22
  }
22
23
  interface DatasourceComponentProps extends ReactComponentProps, Pick<DatasourceProps, 'node' | 'view' | 'getPos'> {
23
24
  }
@@ -39,6 +40,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
39
40
  }
40
41
  export declare class Datasource extends ReactNodeView<DatasourceProps> {
41
42
  private tableWidth;
43
+ private isNodeNested;
42
44
  constructor(props: DatasourceProps);
43
45
  createDomRef(): HTMLElement;
44
46
  render(): jsx.JSX.Element;
@@ -13,14 +13,12 @@ export interface PulseProps {
13
13
  * The time in ms after which the key in local storage will be considered expired and the Pulse will be shown again
14
14
  */
15
15
  localStorageKeyExpirationInMs?: number;
16
- /**
17
- * And indicator that the feature was discovered externally and the pulsation needs to stop.
18
- */
19
- isDiscovered?: boolean;
20
16
  /**
21
17
  * Indicates when the feature is considered discovered. If "start" is passed, local storage key will be invalidated
22
18
  * as soon as the animation starts. If "iteration" is passed (the default one), it will be invalidated after the first iteration
23
19
  */
24
20
  discoveryMode?: PulseDiscoveryMode;
21
+ shouldShowPulse?: boolean;
22
+ testId?: string;
25
23
  }
26
- export declare const DiscoveryPulse: ({ children, localStorageKey, isDiscovered, localStorageKeyExpirationInMs, discoveryMode, }: PulseProps) => JSX.Element;
24
+ export declare const DiscoveryPulse: ({ children, localStorageKey, localStorageKeyExpirationInMs, discoveryMode, shouldShowPulse, testId, }: PulseProps) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.14.23",
3
+ "version": "0.14.25",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/adf-schema": "^35.2.0",
36
36
  "@atlaskit/analytics-next": "^9.1.0",
37
37
  "@atlaskit/custom-steps": "^0.0.10",
38
- "@atlaskit/editor-common": "^76.29.0",
38
+ "@atlaskit/editor-common": "^76.31.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^0.2.0",
41
41
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/link-analytics": "^8.3.0",
51
51
  "@atlaskit/link-client-extension": "^1.8.0",
52
52
  "@atlaskit/link-datasource": "^1.19.0",
53
- "@atlaskit/linking-common": "^4.21.0",
53
+ "@atlaskit/linking-common": "^5.1.0",
54
54
  "@atlaskit/linking-types": "^8.5.0",
55
55
  "@atlaskit/platform-feature-flags": "^0.2.0",
56
56
  "@atlaskit/primitives": "^1.15.0",