@atlaskit/editor-plugin-card 25.0.4 → 25.0.5

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,23 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 25.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6d07b4f04155f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6d07b4f04155f) -
8
+ Cleanup `feature gate` `jim-lower-ranking-in-jira-macro-search`. Quick insert search now always
9
+ ranks the Jira work items (datasource) item above the legacy Jira macro when their scores are
10
+ close, and the Jira work items quick insert item always has a priority of 500.
11
+ - [`109d353d55cfb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/109d353d55cfb) -
12
+ Add a pre-auth value proposition modal for unauthenticated third-party Smart Links created or
13
+ converted in the editor. `@atlaskit/smart-card/pre-auth-value-proposition-modal` exports the
14
+ controlled modal; editor lazy-loads it from Smart Link lifecycle events. Variants
15
+ `modal_text_only` and `modal_with_image` (plus `control`) are behind experiment
16
+ `platform_sl_3p_preauth_value_modal` and gate `platform_sl_3p_preauth_value_modal_killswitch`.
17
+ Connect reuses the existing auth flow. The modal shows once per provider and at most once every
18
+ seven days across providers. Open/close analytics use `source: 'preAuthValuePropositionModal'`.
19
+ - Updated dependencies
20
+
3
21
  ## 25.0.4
4
22
 
5
23
  ### Patch Changes
@@ -35,6 +35,7 @@ var _EditorLinkingPlatformAnalytics = require("./ui/EditorLinkingPlatformAnalyti
35
35
  var _EditorSmartCardEvents = require("./ui/EditorSmartCardEvents");
36
36
  var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
37
37
  var _PasteDisplayAsMenu = require("./ui/PasteDisplayAsMenu");
38
+ var _PreAuthValuePropositionModal = require("./ui/PreAuthValuePropositionModal");
38
39
  var _getCardQuickInsertComponents = require("./ui/quick-insert/getCardQuickInsertComponents");
39
40
  var _toolbar = require("./ui/toolbar");
40
41
  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" != _typeof3(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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
@@ -175,7 +176,9 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref2) {
175
176
  }
176
177
  editorViewForPasteMenu = editorView;
177
178
  var breakoutEnabled = options.editorAppearance === 'full-page';
178
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/_react.default.createElement(PasteMenuSmartCardClientSync, {
179
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _fg.fg)('platform_sl_3p_preauth_value_modal_killswitch') ? /*#__PURE__*/_react.default.createElement(_PreAuthValuePropositionModal.PreAuthValuePropositionModalListener, {
180
+ cardPluginEvents: cardPluginEvents
181
+ }) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/_react.default.createElement(PasteMenuSmartCardClientSync, {
179
182
  clientRef: pasteMenuSmartCardClientRef
180
183
  }), /*#__PURE__*/_react.default.createElement(_EditorSmartCardEvents.EditorSmartCardEvents, {
181
184
  editorView: editorView
@@ -341,17 +344,15 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref2) {
341
344
  if (!options.allowDatasource) {
342
345
  return quickInsertArray;
343
346
  }
344
- quickInsertArray.push(_objectSpread(_objectSpread({
347
+ quickInsertArray.push({
345
348
  id: 'datasource',
346
349
  title: formatMessage((0, _fg.fg)('confluence-issue-terminology-refresh') ? _messages.cardMessages.datasourceJiraIssueIssueTermRefresh : _messages.cardMessages.datasourceJiraIssue),
347
350
  description: formatMessage((0, _fg.fg)('confluence-issue-terminology-refresh') ? _messages.cardMessages.datasourceJiraIssueDescriptionIssueTermRefresh : _messages.cardMessages.datasourceJiraIssueDescription),
348
351
  isDisabledOffline: true,
349
352
  categories: ['external-content', 'development'],
350
353
  keywords: ['jira'],
351
- featured: true
352
- }, (0, _fg.fg)('jim-lower-ranking-in-jira-macro-search') && {
353
- priority: 500
354
- }), {}, {
354
+ featured: true,
355
+ priority: 500,
355
356
  icon: function icon() {
356
357
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDatasourceJiraIssue, null);
357
358
  },
@@ -360,7 +361,7 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref2) {
360
361
  (0, _actions.showDatasourceModal)('jira')(tr);
361
362
  return tr;
362
363
  }
363
- }));
364
+ });
364
365
  if ((0, _utils.canRenderDatasource)(_assetsModal.ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
365
366
  quickInsertArray.push({
366
367
  id: 'datasource',
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.PreAuthValuePropositionModalListener = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _types = require("./analytics/types");
12
+ var _utils = require("./analytics/utils");
13
+ 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" != (0, _typeof2.default)(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); }
14
+ var PreAuthValuePropositionModal = /*#__PURE__*/(0, _react.lazy)(function () {
15
+ return Promise.resolve().then(function () {
16
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_smart-card-pre-auth-value-proposition-modal" */'@atlaskit/smart-card/pre-auth-value-proposition-modal'));
17
+ }).then(function (module) {
18
+ return {
19
+ default: module.PreAuthValuePropositionModal
20
+ };
21
+ });
22
+ });
23
+ var getNewSmartLinkUrl = function getNewSmartLinkUrl(event) {
24
+ if (event.subject !== _types.EVENT_SUBJECT.LINK || event.data.isUndo || event.data.isRedo || (0, _utils.appearanceForLink)(event.data.node) === 'url') {
25
+ return;
26
+ }
27
+ if (event.event === _types.EVENT.CREATED || event.event === _types.EVENT.UPDATED && event.data.previousDisplay === 'url') {
28
+ return (0, _utils.getUrl)(event.data.node);
29
+ }
30
+ };
31
+ var ModalListener = function ModalListener(_ref) {
32
+ var cardPluginEvents = _ref.cardPluginEvents;
33
+ var _useState = (0, _react.useState)(),
34
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
35
+ url = _useState2[0],
36
+ setUrl = _useState2[1];
37
+ (0, _react.useEffect)(function () {
38
+ return cardPluginEvents.subscribe(function (event) {
39
+ var newSmartLinkUrl = getNewSmartLinkUrl(event);
40
+ if (newSmartLinkUrl) {
41
+ setUrl(function (currentUrl) {
42
+ return currentUrl !== null && currentUrl !== void 0 ? currentUrl : newSmartLinkUrl;
43
+ });
44
+ }
45
+ });
46
+ }, [cardPluginEvents]);
47
+ var onFinished = (0, _react.useCallback)(function () {
48
+ return setUrl(undefined);
49
+ }, []);
50
+ return url ? /*#__PURE__*/_react.default.createElement(_react.Suspense, {
51
+ fallback: null
52
+ }, /*#__PURE__*/_react.default.createElement(PreAuthValuePropositionModal, {
53
+ key: url,
54
+ url: url,
55
+ onFinished: onFinished
56
+ })) : null;
57
+ };
58
+ var PreAuthValuePropositionModalListener = exports.PreAuthValuePropositionModalListener = /*#__PURE__*/_react.default.memo(ModalListener);
@@ -25,6 +25,7 @@ import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
25
25
  // eslint-disable-next-line import/no-named-as-default
26
26
  import LayoutButton from './ui/LayoutButton';
27
27
  import { getPasteDisplayAsMenuComponents } from './ui/PasteDisplayAsMenu';
28
+ import { PreAuthValuePropositionModalListener } from './ui/PreAuthValuePropositionModal';
28
29
  import { getCardQuickInsertComponents } from './ui/quick-insert/getCardQuickInsertComponents';
29
30
  import { floatingToolbar, getEndingToolbarItems, getStartingToolbarItems } from './ui/toolbar';
30
31
  const PasteMenuSmartCardClientSync = ({
@@ -170,7 +171,9 @@ export const cardPlugin = ({
170
171
  }
171
172
  editorViewForPasteMenu = editorView;
172
173
  const breakoutEnabled = options.editorAppearance === 'full-page';
173
- return /*#__PURE__*/React.createElement(React.Fragment, null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
174
+ return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_sl_3p_preauth_value_modal_killswitch') ? /*#__PURE__*/React.createElement(PreAuthValuePropositionModalListener, {
175
+ cardPluginEvents: cardPluginEvents
176
+ }) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
174
177
  clientRef: pasteMenuSmartCardClientRef
175
178
  }), /*#__PURE__*/React.createElement(EditorSmartCardEvents, {
176
179
  editorView: editorView
@@ -283,9 +286,7 @@ export const cardPlugin = ({
283
286
  categories: ['external-content', 'development'],
284
287
  keywords: ['jira'],
285
288
  featured: true,
286
- ...(fg('jim-lower-ranking-in-jira-macro-search') && {
287
- priority: 500
288
- }),
289
+ priority: 500,
289
290
  icon: () => /*#__PURE__*/React.createElement(IconDatasourceJiraIssue, null),
290
291
  action(insert) {
291
292
  const tr = insert(undefined);
@@ -0,0 +1,34 @@
1
+ import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
2
+ import { EVENT, EVENT_SUBJECT } from './analytics/types';
3
+ import { appearanceForLink, getUrl } from './analytics/utils';
4
+ const PreAuthValuePropositionModal = /*#__PURE__*/lazy(() => import( /* webpackChunkName: "@atlaskit-internal_smart-card-pre-auth-value-proposition-modal" */'@atlaskit/smart-card/pre-auth-value-proposition-modal').then(module => ({
5
+ default: module.PreAuthValuePropositionModal
6
+ })));
7
+ const getNewSmartLinkUrl = event => {
8
+ if (event.subject !== EVENT_SUBJECT.LINK || event.data.isUndo || event.data.isRedo || appearanceForLink(event.data.node) === 'url') {
9
+ return;
10
+ }
11
+ if (event.event === EVENT.CREATED || event.event === EVENT.UPDATED && event.data.previousDisplay === 'url') {
12
+ return getUrl(event.data.node);
13
+ }
14
+ };
15
+ const ModalListener = ({
16
+ cardPluginEvents
17
+ }) => {
18
+ const [url, setUrl] = useState();
19
+ useEffect(() => cardPluginEvents.subscribe(event => {
20
+ const newSmartLinkUrl = getNewSmartLinkUrl(event);
21
+ if (newSmartLinkUrl) {
22
+ setUrl(currentUrl => currentUrl !== null && currentUrl !== void 0 ? currentUrl : newSmartLinkUrl);
23
+ }
24
+ }), [cardPluginEvents]);
25
+ const onFinished = useCallback(() => setUrl(undefined), []);
26
+ return url ? /*#__PURE__*/React.createElement(Suspense, {
27
+ fallback: null
28
+ }, /*#__PURE__*/React.createElement(PreAuthValuePropositionModal, {
29
+ key: url,
30
+ url: url,
31
+ onFinished: onFinished
32
+ })) : null;
33
+ };
34
+ export const PreAuthValuePropositionModalListener = /*#__PURE__*/React.memo(ModalListener);
@@ -31,6 +31,7 @@ import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
31
31
  // eslint-disable-next-line import/no-named-as-default
32
32
  import LayoutButton from './ui/LayoutButton';
33
33
  import { getPasteDisplayAsMenuComponents } from './ui/PasteDisplayAsMenu';
34
+ import { PreAuthValuePropositionModalListener } from './ui/PreAuthValuePropositionModal';
34
35
  import { getCardQuickInsertComponents } from './ui/quick-insert/getCardQuickInsertComponents';
35
36
  import { floatingToolbar, getEndingToolbarItems, getStartingToolbarItems } from './ui/toolbar';
36
37
  var PasteMenuSmartCardClientSync = function PasteMenuSmartCardClientSync(_ref) {
@@ -167,7 +168,9 @@ export var cardPlugin = function cardPlugin(_ref2) {
167
168
  }
168
169
  editorViewForPasteMenu = editorView;
169
170
  var breakoutEnabled = options.editorAppearance === 'full-page';
170
- return /*#__PURE__*/React.createElement(React.Fragment, null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
171
+ return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_sl_3p_preauth_value_modal_killswitch') ? /*#__PURE__*/React.createElement(PreAuthValuePropositionModalListener, {
172
+ cardPluginEvents: cardPluginEvents
173
+ }) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
171
174
  clientRef: pasteMenuSmartCardClientRef
172
175
  }), /*#__PURE__*/React.createElement(EditorSmartCardEvents, {
173
176
  editorView: editorView
@@ -333,17 +336,15 @@ export var cardPlugin = function cardPlugin(_ref2) {
333
336
  if (!options.allowDatasource) {
334
337
  return quickInsertArray;
335
338
  }
336
- quickInsertArray.push(_objectSpread(_objectSpread({
339
+ quickInsertArray.push({
337
340
  id: 'datasource',
338
341
  title: formatMessage(fg('confluence-issue-terminology-refresh') ? messages.datasourceJiraIssueIssueTermRefresh : messages.datasourceJiraIssue),
339
342
  description: formatMessage(fg('confluence-issue-terminology-refresh') ? messages.datasourceJiraIssueDescriptionIssueTermRefresh : messages.datasourceJiraIssueDescription),
340
343
  isDisabledOffline: true,
341
344
  categories: ['external-content', 'development'],
342
345
  keywords: ['jira'],
343
- featured: true
344
- }, fg('jim-lower-ranking-in-jira-macro-search') && {
345
- priority: 500
346
- }), {}, {
346
+ featured: true,
347
+ priority: 500,
347
348
  icon: function icon() {
348
349
  return /*#__PURE__*/React.createElement(IconDatasourceJiraIssue, null);
349
350
  },
@@ -352,7 +353,7 @@ export var cardPlugin = function cardPlugin(_ref2) {
352
353
  showDatasourceModal('jira')(tr);
353
354
  return tr;
354
355
  }
355
- }));
356
+ });
356
357
  if (canRenderDatasource(ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
357
358
  quickInsertArray.push({
358
359
  id: 'datasource',
@@ -0,0 +1,47 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
3
+ import { EVENT, EVENT_SUBJECT } from './analytics/types';
4
+ import { appearanceForLink, getUrl } from './analytics/utils';
5
+ var PreAuthValuePropositionModal = /*#__PURE__*/lazy(function () {
6
+ return import( /* webpackChunkName: "@atlaskit-internal_smart-card-pre-auth-value-proposition-modal" */'@atlaskit/smart-card/pre-auth-value-proposition-modal').then(function (module) {
7
+ return {
8
+ default: module.PreAuthValuePropositionModal
9
+ };
10
+ });
11
+ });
12
+ var getNewSmartLinkUrl = function getNewSmartLinkUrl(event) {
13
+ if (event.subject !== EVENT_SUBJECT.LINK || event.data.isUndo || event.data.isRedo || appearanceForLink(event.data.node) === 'url') {
14
+ return;
15
+ }
16
+ if (event.event === EVENT.CREATED || event.event === EVENT.UPDATED && event.data.previousDisplay === 'url') {
17
+ return getUrl(event.data.node);
18
+ }
19
+ };
20
+ var ModalListener = function ModalListener(_ref) {
21
+ var cardPluginEvents = _ref.cardPluginEvents;
22
+ var _useState = useState(),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ url = _useState2[0],
25
+ setUrl = _useState2[1];
26
+ useEffect(function () {
27
+ return cardPluginEvents.subscribe(function (event) {
28
+ var newSmartLinkUrl = getNewSmartLinkUrl(event);
29
+ if (newSmartLinkUrl) {
30
+ setUrl(function (currentUrl) {
31
+ return currentUrl !== null && currentUrl !== void 0 ? currentUrl : newSmartLinkUrl;
32
+ });
33
+ }
34
+ });
35
+ }, [cardPluginEvents]);
36
+ var onFinished = useCallback(function () {
37
+ return setUrl(undefined);
38
+ }, []);
39
+ return url ? /*#__PURE__*/React.createElement(Suspense, {
40
+ fallback: null
41
+ }, /*#__PURE__*/React.createElement(PreAuthValuePropositionModal, {
42
+ key: url,
43
+ url: url,
44
+ onFinished: onFinished
45
+ })) : null;
46
+ };
47
+ export var PreAuthValuePropositionModalListener = /*#__PURE__*/React.memo(ModalListener);
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { EditorCardPluginEvents } from './analytics/create-events-queue';
3
+ import type { CardPluginEvent } from './analytics/types';
4
+ type PreAuthValuePropositionModalListenerProps = {
5
+ cardPluginEvents: EditorCardPluginEvents<CardPluginEvent>;
6
+ };
7
+ export declare const PreAuthValuePropositionModalListener: React.MemoExoticComponent<(props: PreAuthValuePropositionModalListenerProps) => React.JSX.Element | null>;
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "25.0.4",
3
+ "version": "25.0.5",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,7 +28,7 @@
28
28
  "@atlaskit/custom-steps": "^1.1.0",
29
29
  "@atlaskit/editor-card-provider": "^7.3.0",
30
30
  "@atlaskit/editor-plugin-analytics": "^19.0.0",
31
- "@atlaskit/editor-plugin-annotation": "^19.0.0",
31
+ "@atlaskit/editor-plugin-annotation": "^19.1.0",
32
32
  "@atlaskit/editor-plugin-base": "^20.0.0",
33
33
  "@atlaskit/editor-plugin-connectivity": "^19.0.0",
34
34
  "@atlaskit/editor-plugin-decorations": "^19.0.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/link": "^5.1.0",
53
53
  "@atlaskit/link-analytics": "^12.4.0",
54
54
  "@atlaskit/link-client-extension": "^7.3.0",
55
- "@atlaskit/link-datasource": "^6.13.0",
55
+ "@atlaskit/link-datasource": "^6.14.0",
56
56
  "@atlaskit/link-extractors": "^4.2.0",
57
57
  "@atlaskit/linking-common": "^12.3.0",
58
58
  "@atlaskit/linking-types": "^15.3.0",
@@ -62,9 +62,9 @@
62
62
  "@atlaskit/platform-feature-flags-react": "^1.2.0",
63
63
  "@atlaskit/primitives": "^22.5.0",
64
64
  "@atlaskit/prosemirror-history": "^1.2.0",
65
- "@atlaskit/smart-card": "^45.25.0",
65
+ "@atlaskit/smart-card": "^45.28.0",
66
66
  "@atlaskit/tmp-editor-statsig": "^202.0.0",
67
- "@atlaskit/tokens": "^18.2.0",
67
+ "@atlaskit/tokens": "^18.3.0",
68
68
  "@babel/runtime": "^7.0.0",
69
69
  "@emotion/react": "^11.7.1",
70
70
  "lodash": "^4.17.21",
@@ -73,7 +73,7 @@
73
73
  "uuid": "^11.1.1"
74
74
  },
75
75
  "peerDependencies": {
76
- "@atlaskit/editor-common": "^123.5.0",
76
+ "@atlaskit/editor-common": "^123.7.0",
77
77
  "@atlaskit/link-provider": "^5.7.0",
78
78
  "react": "^18.2.0 || ^19.2.0",
79
79
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -95,10 +95,10 @@
95
95
  "platform_editor_adf_with_localid": {
96
96
  "type": "boolean"
97
97
  },
98
- "platform_lp_sllv_table_settings_menu": {
98
+ "platform_sl_3p_preauth_value_modal_killswitch": {
99
99
  "type": "boolean"
100
100
  },
101
- "jim-lower-ranking-in-jira-macro-search": {
101
+ "platform_lp_sllv_table_settings_menu": {
102
102
  "type": "boolean"
103
103
  }
104
104
  },