@atlaskit/editor-plugin-card 0.14.23 → 0.14.24

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,12 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 0.14.24
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+ - Updated dependencies
9
+
3
10
  ## 0.14.23
4
11
 
5
12
  ### Patch Changes
@@ -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
  };
@@ -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
  };
@@ -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
  };
@@ -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;
@@ -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.24",
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.30.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.0.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",