@atlaskit/editor-plugin-synced-block 10.7.3 → 10.8.1
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 +35 -0
- package/dist/cjs/pm-plugins/main.js +44 -24
- package/dist/cjs/syncedBlockPlugin.js +9 -3
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/ui/DeleteConfirmationModal.js +1 -1
- package/dist/cjs/ui/Flag.compiled.css +1 -0
- package/dist/cjs/ui/Flag.js +64 -7
- package/dist/cjs/ui/SourceSyncBlockPlaceholder.js +4 -1
- package/dist/cjs/ui/SyncBlockLabel.js +9 -2
- package/dist/cjs/ui/SyncedLocationDropdown.compiled.css +7 -0
- package/dist/cjs/ui/SyncedLocationDropdown.js +26 -3
- package/dist/cjs/ui/assets/SyncedLocationsEmptyStateIllustration.js +216 -0
- package/dist/cjs/ui/quick-insert.js +1 -1
- package/dist/es2019/pm-plugins/main.js +29 -10
- package/dist/es2019/syncedBlockPlugin.js +9 -3
- package/dist/es2019/types/index.js +1 -0
- package/dist/es2019/ui/DeleteConfirmationModal.js +1 -1
- package/dist/es2019/ui/Flag.compiled.css +1 -0
- package/dist/es2019/ui/Flag.js +60 -5
- package/dist/es2019/ui/SourceSyncBlockPlaceholder.js +4 -1
- package/dist/es2019/ui/SyncBlockLabel.js +9 -2
- package/dist/es2019/ui/SyncedLocationDropdown.compiled.css +7 -0
- package/dist/es2019/ui/SyncedLocationDropdown.js +26 -3
- package/dist/es2019/ui/assets/SyncedLocationsEmptyStateIllustration.js +208 -0
- package/dist/es2019/ui/quick-insert.js +1 -1
- package/dist/esm/pm-plugins/main.js +44 -24
- package/dist/esm/syncedBlockPlugin.js +9 -3
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/ui/DeleteConfirmationModal.js +1 -1
- package/dist/esm/ui/Flag.compiled.css +1 -0
- package/dist/esm/ui/Flag.js +64 -7
- package/dist/esm/ui/SourceSyncBlockPlaceholder.js +4 -1
- package/dist/esm/ui/SyncBlockLabel.js +9 -2
- package/dist/esm/ui/SyncedLocationDropdown.compiled.css +7 -0
- package/dist/esm/ui/SyncedLocationDropdown.js +26 -3
- package/dist/esm/ui/assets/SyncedLocationsEmptyStateIllustration.js +210 -0
- package/dist/esm/ui/quick-insert.js +1 -1
- package/dist/types/syncedBlockPluginType.d.ts +10 -0
- package/dist/types/types/index.d.ts +6 -1
- package/dist/types/ui/Flag.d.ts +8 -2
- package/dist/types/ui/assets/SyncedLocationsEmptyStateIllustration.d.ts +2 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 10.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 10.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`ff72ee885c82b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ff72ee885c82b) -
|
|
14
|
+
[ux] Prompt users with a feedback flag after undoing or deleting a synced block, and open the
|
|
15
|
+
product feedback collector only when they choose Give feedback. Keep the prompt UI and scoped
|
|
16
|
+
action alignment in the synced block plugin while preserving Flag's built-in action buttons.
|
|
17
|
+
|
|
18
|
+
Products check and persist the prompt allowance around the shared flag lifecycle:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
{
|
|
22
|
+
shouldShowFeedbackPrompt: () => !feedbackStorage.has('prompt-shown'),
|
|
23
|
+
onFeedbackPromptShown: () => feedbackStorage.set('prompt-shown', true),
|
|
24
|
+
onGiveFeedback: (context) => openFeedbackCollector(context),
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- [`17014b0e91a7f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/17014b0e91a7f) -
|
|
31
|
+
Update the synced locations activation empty state
|
|
32
|
+
- [`b4e3664f1eb3c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b4e3664f1eb3c) -
|
|
33
|
+
Keep the source sync block placeholder within narrow containers
|
|
34
|
+
- [`04f47b1369740`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/04f47b1369740) -
|
|
35
|
+
Clarify source synced block labels and show more of referenced titles
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
|
|
3
38
|
## 10.7.3
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
|
@@ -471,7 +471,7 @@ var buildStatusDecorations = function buildStatusDecorations(doc, syncBlockStore
|
|
|
471
471
|
* is explicitly scoped to a single plugin instance.
|
|
472
472
|
*/
|
|
473
473
|
var SyncedBlockPluginContext = /*#__PURE__*/function () {
|
|
474
|
-
function SyncedBlockPluginContext(onGiveFeedback) {
|
|
474
|
+
function SyncedBlockPluginContext(onGiveFeedback, shouldShowFeedbackPrompt, api) {
|
|
475
475
|
(0, _classCallCheck2.default)(this, SyncedBlockPluginContext);
|
|
476
476
|
(0, _defineProperty2.default)(this, "confirmationTransactionRef", {
|
|
477
477
|
current: undefined
|
|
@@ -480,9 +480,12 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
|
|
|
480
480
|
(0, _defineProperty2.default)(this, "cutRemovalGeneration", 0);
|
|
481
481
|
(0, _defineProperty2.default)(this, "_isCopyEvent", false);
|
|
482
482
|
(0, _defineProperty2.default)(this, "_isCutEvent", false);
|
|
483
|
+
(0, _defineProperty2.default)(this, "feedbackPromptConsumed", false);
|
|
483
484
|
(0, _defineProperty2.default)(this, "unpublishedFlagShown", new Set());
|
|
484
485
|
(0, _defineProperty2.default)(this, "extensionFlagShown", new Set());
|
|
485
486
|
this.onGiveFeedback = onGiveFeedback;
|
|
487
|
+
this.shouldShowFeedbackPrompt = shouldShowFeedbackPrompt;
|
|
488
|
+
this.api = api;
|
|
486
489
|
}
|
|
487
490
|
return (0, _createClass2.default)(SyncedBlockPluginContext, [{
|
|
488
491
|
key: "isCopyEvent",
|
|
@@ -580,7 +583,7 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
|
|
|
580
583
|
return;
|
|
581
584
|
}
|
|
582
585
|
if (context.blockType === 'reference') {
|
|
583
|
-
this.
|
|
586
|
+
this.requestFeedbackPrompt(context);
|
|
584
587
|
}
|
|
585
588
|
}
|
|
586
589
|
}, {
|
|
@@ -590,37 +593,54 @@ var SyncedBlockPluginContext = /*#__PURE__*/function () {
|
|
|
590
593
|
if (((_this$pendingSourceFe4 = this.pendingSourceFeedback) === null || _this$pendingSourceFe4 === void 0 ? void 0 : _this$pendingSourceFe4.sourceAttempt) === sourceAttempt && (_this$pendingSourceFe5 = this.pendingSourceFeedback) !== null && _this$pendingSourceFe5 !== void 0 && _this$pendingSourceFe5.deletionSucceeded && this.pendingSourceFeedback.transactionApplied) {
|
|
591
594
|
var context = this.pendingSourceFeedback.context;
|
|
592
595
|
this.pendingSourceFeedback = undefined;
|
|
593
|
-
this.
|
|
596
|
+
this.requestFeedbackPrompt(context);
|
|
594
597
|
}
|
|
595
598
|
}
|
|
596
599
|
}, {
|
|
597
|
-
key: "
|
|
598
|
-
value: function
|
|
600
|
+
key: "requestFeedbackPrompt",
|
|
601
|
+
value: function requestFeedbackPrompt(context) {
|
|
599
602
|
var _this2 = this;
|
|
603
|
+
if (this.feedbackPromptConsumed) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
this.feedbackPromptConsumed = true;
|
|
600
607
|
(0, _utils3.deferDispatch)(function () {
|
|
601
608
|
try {
|
|
602
|
-
var _this2$
|
|
603
|
-
var
|
|
604
|
-
void Promise.resolve(
|
|
609
|
+
var _this2$shouldShowFeed, _this2$shouldShowFeed2;
|
|
610
|
+
var shouldShow = (_this2$shouldShowFeed = (_this2$shouldShowFeed2 = _this2.shouldShowFeedbackPrompt) === null || _this2$shouldShowFeed2 === void 0 ? void 0 : _this2$shouldShowFeed2.call(_this2)) !== null && _this2$shouldShowFeed !== void 0 ? _this2$shouldShowFeed : true;
|
|
611
|
+
void Promise.resolve(shouldShow).then(function (isEligible) {
|
|
612
|
+
var _this2$api;
|
|
613
|
+
if (!isEligible) {
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
(_this2$api = _this2.api) === null || _this2$api === void 0 || _this2$api.core.actions.execute(function (_ref7) {
|
|
617
|
+
var tr = _ref7.tr;
|
|
618
|
+
return tr.setMeta(syncedBlockPluginKey, {
|
|
619
|
+
activeFlag: {
|
|
620
|
+
id: _types.FLAG_ID.SYNC_BLOCK_FEEDBACK_PROMPT,
|
|
621
|
+
feedbackContext: context
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
}).catch(function () {});
|
|
605
626
|
} catch (_unused) {
|
|
606
|
-
//
|
|
607
|
-
// never affect the already-applied editor transaction.
|
|
627
|
+
// Persisted feedback eligibility is optional product UI.
|
|
608
628
|
}
|
|
609
629
|
});
|
|
610
630
|
}
|
|
611
631
|
}]);
|
|
612
632
|
}();
|
|
613
633
|
var createPlugin = exports.createPlugin = function createPlugin(options, pmPluginFactoryParams, syncBlockStore, api) {
|
|
614
|
-
var
|
|
615
|
-
|
|
616
|
-
useLongPressSelection =
|
|
634
|
+
var _ref8 = options || {},
|
|
635
|
+
_ref8$useLongPressSel = _ref8.useLongPressSelection,
|
|
636
|
+
useLongPressSelection = _ref8$useLongPressSel === void 0 ? false : _ref8$useLongPressSel;
|
|
617
637
|
|
|
618
638
|
// Cache the experiment value once at plugin creation time.
|
|
619
639
|
// This fires the exposure event exactly once (correct per Exposure Events 101)
|
|
620
640
|
// and avoids ~10 redundant Statsig SDK evaluations per keystroke in hot paths
|
|
621
641
|
// (apply, filterTransaction, appendTransaction, decorations).
|
|
622
642
|
var isPerfExperimentOn = (0, _expValEquals.expValEquals)('editor_synced_block_perf', 'isEnabled', true);
|
|
623
|
-
var ctx = new SyncedBlockPluginContext(options === null || options === void 0 ? void 0 : options.onGiveFeedback);
|
|
643
|
+
var ctx = new SyncedBlockPluginContext(options === null || options === void 0 ? void 0 : options.onGiveFeedback, options === null || options === void 0 ? void 0 : options.shouldShowFeedbackPrompt, api);
|
|
624
644
|
var confirmationTransactionRef = ctx.confirmationTransactionRef;
|
|
625
645
|
var unpublishedFlagShown = ctx.unpublishedFlagShown;
|
|
626
646
|
var extensionFlagShown = ctx.extensionFlagShown;
|
|
@@ -630,8 +650,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
630
650
|
// Classic pages with sync blocks.
|
|
631
651
|
syncBlockStore.sourceManager.registerFlushCompletionCallback(function () {
|
|
632
652
|
(0, _utils3.deferDispatch)(function () {
|
|
633
|
-
api === null || api === void 0 || api.core.actions.execute(function (
|
|
634
|
-
var tr =
|
|
653
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref9) {
|
|
654
|
+
var tr = _ref9.tr;
|
|
635
655
|
return tr;
|
|
636
656
|
});
|
|
637
657
|
});
|
|
@@ -659,8 +679,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
659
679
|
// case the Confluence default is used.
|
|
660
680
|
var sourceProduct = (0, _utils2.getSourceProductFromResourceIdSafe)(resourceId);
|
|
661
681
|
(0, _utils3.deferDispatch)(function () {
|
|
662
|
-
api === null || api === void 0 || api.core.actions.execute(function (
|
|
663
|
-
var tr =
|
|
682
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref0) {
|
|
683
|
+
var tr = _ref0.tr;
|
|
664
684
|
return tr.setMeta(syncedBlockPluginKey, {
|
|
665
685
|
activeFlag: {
|
|
666
686
|
id: _types.FLAG_ID.UNPUBLISHED_SYNC_BLOCK_PASTED,
|
|
@@ -1003,8 +1023,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
1003
1023
|
return node;
|
|
1004
1024
|
});
|
|
1005
1025
|
},
|
|
1006
|
-
transformCopied: function transformCopied(slice,
|
|
1007
|
-
var state =
|
|
1026
|
+
transformCopied: function transformCopied(slice, _ref1) {
|
|
1027
|
+
var state = _ref1.state;
|
|
1008
1028
|
var pluginState = syncedBlockPluginKey.getState(state);
|
|
1009
1029
|
var syncBlockStore = pluginState === null || pluginState === void 0 ? void 0 : pluginState.syncBlockStore;
|
|
1010
1030
|
var schema = state.schema;
|
|
@@ -1276,8 +1296,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
1276
1296
|
if (!(step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep) || !('slice' in step)) {
|
|
1277
1297
|
return false;
|
|
1278
1298
|
}
|
|
1279
|
-
var
|
|
1280
|
-
slice =
|
|
1299
|
+
var _ref10 = step,
|
|
1300
|
+
slice = _ref10.slice;
|
|
1281
1301
|
var found = false;
|
|
1282
1302
|
slice.content.descendants(function (node) {
|
|
1283
1303
|
if (syncBlockStore.sourceManager.isSourceBlock(node) && node.attrs.resourceId) {
|
|
@@ -1317,8 +1337,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
1317
1337
|
tr.setMeta('addToHistory', false);
|
|
1318
1338
|
(0, _utils3.deferDispatch)(function () {
|
|
1319
1339
|
var _api$core;
|
|
1320
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (
|
|
1321
|
-
var tr =
|
|
1340
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref11) {
|
|
1341
|
+
var tr = _ref11.tr;
|
|
1322
1342
|
return tr.setMeta(syncedBlockPluginKey, {
|
|
1323
1343
|
activeFlag: {
|
|
1324
1344
|
id: _types.FLAG_ID.DUPLICATE_SOURCE_SYNC_BLOCK
|
|
@@ -34,7 +34,9 @@ var _toolbarComponents = require("./ui/toolbar-components");
|
|
|
34
34
|
*/
|
|
35
35
|
var LazySyncedBlockUI = function LazySyncedBlockUI(_ref) {
|
|
36
36
|
var syncBlockStoreManager = _ref.syncBlockStore,
|
|
37
|
-
api = _ref.api
|
|
37
|
+
api = _ref.api,
|
|
38
|
+
onFeedbackPromptShown = _ref.onFeedbackPromptShown,
|
|
39
|
+
onGiveFeedback = _ref.onGiveFeedback;
|
|
38
40
|
var hasSyncBlocks = (0, _hooks.useSharedPluginStateWithSelector)(api, ['syncedBlock'], function (states) {
|
|
39
41
|
var _states$syncedBlockSt;
|
|
40
42
|
return (_states$syncedBlockSt = states.syncedBlockState) === null || _states$syncedBlockSt === void 0 ? void 0 : _states$syncedBlockSt.hasSyncedBlocks;
|
|
@@ -53,7 +55,9 @@ var LazySyncedBlockUI = function LazySyncedBlockUI(_ref) {
|
|
|
53
55
|
syncBlockStoreManager: syncBlockStoreManager,
|
|
54
56
|
api: api
|
|
55
57
|
}), /*#__PURE__*/_react.default.createElement(_Flag.Flag, {
|
|
56
|
-
api: api
|
|
58
|
+
api: api,
|
|
59
|
+
onFeedbackPromptShown: onFeedbackPromptShown,
|
|
60
|
+
onGiveFeedback: onGiveFeedback
|
|
57
61
|
}));
|
|
58
62
|
};
|
|
59
63
|
var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_ref2) {
|
|
@@ -160,7 +164,9 @@ var syncedBlockPlugin = exports.syncedBlockPlugin = function syncedBlockPlugin(_
|
|
|
160
164
|
refs.wrapperElement = wrapperElement || undefined;
|
|
161
165
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true) && /*#__PURE__*/_react.default.createElement(_SourceSyncBlockPlaceholder.SourceSyncBlockPlaceholder, null), /*#__PURE__*/_react.default.createElement(LazySyncedBlockUI, {
|
|
162
166
|
syncBlockStore: syncBlockStore,
|
|
163
|
-
api: api
|
|
167
|
+
api: api,
|
|
168
|
+
onFeedbackPromptShown: config === null || config === void 0 ? void 0 : config.onFeedbackPromptShown,
|
|
169
|
+
onGiveFeedback: config === null || config === void 0 ? void 0 : config.onGiveFeedback
|
|
164
170
|
}));
|
|
165
171
|
},
|
|
166
172
|
getSharedState: function getSharedState(editorState) {
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var FLAG_ID = exports.FLAG_ID = /*#__PURE__*/function (FLAG_ID) {
|
|
|
15
15
|
FLAG_ID["INLINE_EXTENSION_IN_SYNC_BLOCK"] = "inline-extension-in-sync-block";
|
|
16
16
|
FLAG_ID["EXTENSION_IN_SYNC_BLOCK"] = "extension-in-sync-block";
|
|
17
17
|
FLAG_ID["DUPLICATE_SOURCE_SYNC_BLOCK"] = "duplicate-source-sync-block";
|
|
18
|
+
FLAG_ID["SYNC_BLOCK_FEEDBACK_PROMPT"] = "synced-block-feedback-prompt";
|
|
18
19
|
return FLAG_ID;
|
|
19
20
|
}({});
|
|
20
21
|
var SYNCED_BLOCK_BUTTON_TEST_ID = exports.SYNCED_BLOCK_BUTTON_TEST_ID = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._btc7grf3 [data-testid=synced-block-feedback-prompt-actions] button{padding-inline-start:0!important}
|
package/dist/cjs/ui/Flag.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* Flag.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -6,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
8
9
|
exports.getSyncBlockCopiedDescription = exports.Flag = void 0;
|
|
10
|
+
require("./Flag.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
9
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
13
|
var _react = _interopRequireDefault(require("react"));
|
|
11
14
|
var _reactIntl = require("react-intl");
|
|
@@ -14,15 +17,18 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
14
17
|
var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
15
18
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
16
19
|
var _flag = _interopRequireWildcard(require("@atlaskit/flag"));
|
|
20
|
+
var _megaphone = _interopRequireDefault(require("@atlaskit/icon/core/megaphone"));
|
|
17
21
|
var _statusSuccess = _interopRequireDefault(require("@atlaskit/icon/core/status-success"));
|
|
18
22
|
var _statusWarning = _interopRequireDefault(require("@atlaskit/icon/core/status-warning"));
|
|
19
23
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
20
24
|
var _main = require("../pm-plugins/main");
|
|
21
25
|
var _types = require("../types");
|
|
26
|
+
var _flagMap;
|
|
22
27
|
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); }
|
|
23
28
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
29
|
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) { (0, _defineProperty2.default)(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; }
|
|
25
|
-
var
|
|
30
|
+
var feedbackFlagStyles = null;
|
|
31
|
+
var flagMap = (_flagMap = {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_flagMap, _types.FLAG_ID.CANNOT_DELETE_WHEN_OFFLINE, {
|
|
26
32
|
title: _messages.syncBlockMessages.failToDeleteTitle,
|
|
27
33
|
description: _messages.syncBlockMessages.failToDeleteWhenOfflineDescription,
|
|
28
34
|
type: 'error'
|
|
@@ -61,7 +67,11 @@ var flagMap = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _d
|
|
|
61
67
|
title: _messages.syncBlockMessages.duplicateSourceSyncBlockTitle,
|
|
62
68
|
description: _messages.syncBlockMessages.duplicateSourceSyncBlockDescription,
|
|
63
69
|
type: 'error'
|
|
64
|
-
})
|
|
70
|
+
}), (0, _defineProperty2.default)(_flagMap, _types.FLAG_ID.SYNC_BLOCK_FEEDBACK_PROMPT, {
|
|
71
|
+
title: _messages.syncBlockMessages.feedbackFlagTitle,
|
|
72
|
+
description: _messages.syncBlockMessages.feedbackFlagDescription,
|
|
73
|
+
type: 'feedback'
|
|
74
|
+
}));
|
|
65
75
|
var getSyncBlockCopiedDescription = exports.getSyncBlockCopiedDescription = function getSyncBlockCopiedDescription(activeFlag, isSyncBlockActivationEnabled) {
|
|
66
76
|
if (!activeFlag || activeFlag.id !== _types.FLAG_ID.SYNC_BLOCK_COPIED || activeFlag.sourceProduct !== 'confluence-page' || !isSyncBlockActivationEnabled) {
|
|
67
77
|
return undefined;
|
|
@@ -69,7 +79,9 @@ var getSyncBlockCopiedDescription = exports.getSyncBlockCopiedDescription = func
|
|
|
69
79
|
return activeFlag.isLivePage || !activeFlag.isSourceContentUnpublished ? _messages.syncBlockMessages.syncBlockCopiedLivePageDescription : _messages.syncBlockMessages.syncBlockCopiedUnpublishedDescription;
|
|
70
80
|
};
|
|
71
81
|
var Flag = exports.Flag = function Flag(_ref) {
|
|
72
|
-
var api = _ref.api
|
|
82
|
+
var api = _ref.api,
|
|
83
|
+
onFeedbackPromptShown = _ref.onFeedbackPromptShown,
|
|
84
|
+
onGiveFeedback = _ref.onGiveFeedback;
|
|
73
85
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['syncedBlock', 'connectivity'], function (states) {
|
|
74
86
|
var _states$syncedBlockSt, _states$connectivityS;
|
|
75
87
|
return {
|
|
@@ -81,6 +93,18 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
81
93
|
mode = _useSharedPluginState.mode;
|
|
82
94
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
83
95
|
formatMessage = _useIntl.formatMessage;
|
|
96
|
+
var isFeedbackPromptVisible = activeFlag && activeFlag.id === _types.FLAG_ID.SYNC_BLOCK_FEEDBACK_PROMPT;
|
|
97
|
+
_react.default.useEffect(function () {
|
|
98
|
+
if (!isFeedbackPromptVisible || !onFeedbackPromptShown) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
var promptShownResult = onFeedbackPromptShown();
|
|
103
|
+
void Promise.resolve(promptShownResult).catch(function () {});
|
|
104
|
+
} catch (_unused) {
|
|
105
|
+
// Prompt persistence is optional product UI.
|
|
106
|
+
}
|
|
107
|
+
}, [isFeedbackPromptVisible, onFeedbackPromptShown]);
|
|
84
108
|
if (!activeFlag) {
|
|
85
109
|
return;
|
|
86
110
|
}
|
|
@@ -110,7 +134,7 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
110
134
|
});
|
|
111
135
|
return;
|
|
112
136
|
}
|
|
113
|
-
var
|
|
137
|
+
var dismissFlag = function dismissFlag(shouldFocusEditor) {
|
|
114
138
|
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
115
139
|
var tr = _ref3.tr;
|
|
116
140
|
onDismissedCallback === null || onDismissedCallback === void 0 || onDismissedCallback(tr);
|
|
@@ -120,7 +144,12 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
120
144
|
}));
|
|
121
145
|
return tr;
|
|
122
146
|
});
|
|
123
|
-
|
|
147
|
+
if (shouldFocusEditor) {
|
|
148
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var onDismissed = function onDismissed() {
|
|
152
|
+
return dismissFlag(true);
|
|
124
153
|
};
|
|
125
154
|
var typeToActions = function typeToActions() {
|
|
126
155
|
if (type === 'error') {
|
|
@@ -137,11 +166,28 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
137
166
|
target: '_blank',
|
|
138
167
|
rel: 'noopener noreferrer'
|
|
139
168
|
}];
|
|
169
|
+
} else if (type === 'feedback' && activeFlag.id === _types.FLAG_ID.SYNC_BLOCK_FEEDBACK_PROMPT && activeFlag.feedbackContext) {
|
|
170
|
+
var feedbackContext = activeFlag.feedbackContext;
|
|
171
|
+
return [{
|
|
172
|
+
content: formatMessage(_messages.syncBlockMessages.feedbackFlagGiveFeedback),
|
|
173
|
+
onClick: function onClick() {
|
|
174
|
+
dismissFlag(false);
|
|
175
|
+
try {
|
|
176
|
+
var feedbackResult = onGiveFeedback === null || onGiveFeedback === void 0 ? void 0 : onGiveFeedback(feedbackContext);
|
|
177
|
+
void Promise.resolve(feedbackResult).catch(function () {});
|
|
178
|
+
} catch (_unused2) {
|
|
179
|
+
// Feedback collectors are optional product UI.
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}, {
|
|
183
|
+
content: formatMessage(_messages.syncBlockMessages.feedbackFlagNoThanks),
|
|
184
|
+
onClick: onDismissed
|
|
185
|
+
}];
|
|
140
186
|
}
|
|
141
187
|
return undefined;
|
|
142
188
|
};
|
|
143
189
|
var FlagComponent = type === 'info' ? _flag.AutoDismissFlag : _flag.default;
|
|
144
|
-
|
|
190
|
+
var flag = /*#__PURE__*/_react.default.createElement(FlagComponent, {
|
|
145
191
|
onDismissed: onDismissed,
|
|
146
192
|
title: formatMessage(title),
|
|
147
193
|
description: description ? formatMessage(description) : undefined,
|
|
@@ -149,7 +195,11 @@ var Flag = exports.Flag = function Flag(_ref) {
|
|
|
149
195
|
testId: activeFlag.id,
|
|
150
196
|
icon: typeToIcon(type),
|
|
151
197
|
actions: typeToActions()
|
|
152
|
-
})
|
|
198
|
+
});
|
|
199
|
+
return /*#__PURE__*/_react.default.createElement(_flag.FlagGroup, null, type === 'feedback' ? /*#__PURE__*/_react.default.createElement("div", {
|
|
200
|
+
id: activeFlag.id,
|
|
201
|
+
className: (0, _runtime.ax)(["_btc7grf3"])
|
|
202
|
+
}, flag) : flag);
|
|
153
203
|
};
|
|
154
204
|
var typeToIcon = function typeToIcon(type) {
|
|
155
205
|
if (type === 'error') {
|
|
@@ -158,6 +208,13 @@ var typeToIcon = function typeToIcon(type) {
|
|
|
158
208
|
color: "var(--ds-icon-warning, #E06C00)"
|
|
159
209
|
});
|
|
160
210
|
}
|
|
211
|
+
if (type === 'feedback') {
|
|
212
|
+
return /*#__PURE__*/_react.default.createElement(_megaphone.default, {
|
|
213
|
+
label: "",
|
|
214
|
+
spacing: "spacious",
|
|
215
|
+
color: "var(--ds-icon, #292A2E)"
|
|
216
|
+
});
|
|
217
|
+
}
|
|
161
218
|
return /*#__PURE__*/_react.default.createElement(_statusSuccess.default, {
|
|
162
219
|
label: "",
|
|
163
220
|
color: "var(--ds-icon-success, #6A9A23)"
|
|
@@ -33,8 +33,11 @@ var getSourceSyncBlockPlaceholderStyles = function getSourceSyncBlockPlaceholder
|
|
|
33
33
|
font: 'inherit',
|
|
34
34
|
insetInlineStart: 0,
|
|
35
35
|
width: '100%',
|
|
36
|
+
overflow: 'hidden',
|
|
36
37
|
pointerEvents: 'none',
|
|
37
|
-
|
|
38
|
+
textOverflow: 'ellipsis',
|
|
39
|
+
userSelect: 'none',
|
|
40
|
+
whiteSpace: 'nowrap'
|
|
38
41
|
}
|
|
39
42
|
}));
|
|
40
43
|
};
|
|
@@ -14,6 +14,7 @@ var _syncBlock = require("@atlaskit/editor-common/sync-block");
|
|
|
14
14
|
var _blockSynced = _interopRequireDefault(require("@atlaskit/icon-lab/core/block-synced"));
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
18
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
18
19
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/visually-hidden"));
|
|
19
20
|
var _time = require("./utils/time");
|
|
@@ -80,7 +81,13 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
80
81
|
color: "color.text.subtle"
|
|
81
82
|
}, formatMessage(_messages.syncBlockMessages.unsyncedBlockLabel));
|
|
82
83
|
}
|
|
83
|
-
if (isSource
|
|
84
|
+
if (isSource) {
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
86
|
+
size: "small",
|
|
87
|
+
color: "color.text.subtle"
|
|
88
|
+
}, formatMessage((0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true) ? _messages.syncBlockMessages.sourceSyncedBlockLabel : _messages.syncBlockMessages.syncedBlockLabel));
|
|
89
|
+
}
|
|
90
|
+
if (!title) {
|
|
84
91
|
return /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
85
92
|
size: "small",
|
|
86
93
|
color: "color.text.subtle"
|
|
@@ -119,6 +126,6 @@ var SyncBlockLabelComponent = function SyncBlockLabelComponent(_ref) {
|
|
|
119
126
|
onShow: updateTooltipContent
|
|
120
127
|
}, label, /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
|
|
121
128
|
id: ariaDescribedById
|
|
122
|
-
}, tooltipContent));
|
|
129
|
+
}, (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true) ? tooltipMessage : tooltipContent));
|
|
123
130
|
};
|
|
124
131
|
var SyncBlockLabel = exports.SyncBlockLabel = /*#__PURE__*/_react.default.memo(SyncBlockLabelComponent);
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
._2rkol0p1{border-radius:var(--ds-radius-tile,25%)}
|
|
2
2
|
._y44vfmxe{animation:kgnpaw5 .7s ease-in-out}
|
|
3
|
+
._195g1wug{margin-inline:auto}
|
|
3
4
|
._1mour5cr{margin-block:var(--ds-space-negative-050,-4px)}
|
|
4
5
|
._1rjcv77o{padding-block:var(--ds-space-025,2px)}
|
|
6
|
+
._1rjcze3t{padding-block:var(--ds-space-0,0)}
|
|
5
7
|
._ku9g126e [data-ds--menu--heading-item]{margin-block:var(--ds-space-050,4px)!important}._18bk1rpy [data-ds--menu--heading-item]{color:var(--ds-text-subtlest,#6b6e76)}
|
|
6
8
|
._18m915vq{overflow-y:hidden}
|
|
7
9
|
._18m91wug{overflow-y:auto}
|
|
8
10
|
._1bah1h6o{justify-content:center}
|
|
11
|
+
._1bsb12aa{width:290px}
|
|
9
12
|
._1bsb19n7{width:106px}
|
|
13
|
+
._1bsb1kdj{width:25pc}
|
|
10
14
|
._1bsb1osq{width:100%}
|
|
11
15
|
._1bsbgktf{width:20px}
|
|
12
16
|
._1bsbo8uj{width:235px}
|
|
@@ -26,8 +30,11 @@
|
|
|
26
30
|
._ajmmnqa1{text-decoration-style:solid}
|
|
27
31
|
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
28
32
|
._c71lko4j{max-height:19pc}
|
|
33
|
+
._ca0q1ejb{padding-top:var(--ds-space-300,24px)}
|
|
34
|
+
._n3td1ejb{padding-bottom:var(--ds-space-300,24px)}
|
|
29
35
|
._o5721q9c{white-space:nowrap}
|
|
30
36
|
._syaz1rpy{color:var(--ds-text-subtlest,#6b6e76)}
|
|
31
37
|
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
38
|
+
._vchhusvi{box-sizing:border-box}
|
|
32
39
|
._y3gn1h6o{text-align:center}
|
|
33
40
|
@keyframes kgnpaw5{0%{opacity:0}to{opacity:1}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SyncedLocationDropdown.tsx generated by @compiled/babel-plugin
|
|
1
|
+
/* SyncedLocationDropdown.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -40,8 +40,11 @@ var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
|
40
40
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
41
41
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
42
42
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
43
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
44
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
43
45
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
44
46
|
var _types = require("../types");
|
|
47
|
+
var _SyncedLocationsEmptyStateIllustration = require("./assets/SyncedLocationsEmptyStateIllustration");
|
|
45
48
|
var _excluded = ["triggerRef"];
|
|
46
49
|
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); }
|
|
47
50
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
@@ -59,6 +62,9 @@ var styles = {
|
|
|
59
62
|
note: "_syaz1rpy _o5721q9c",
|
|
60
63
|
lozenge: "_ahbq12x7 _1ul91wqb",
|
|
61
64
|
noResultsContainer: "_1bsbo8uj _y3gn1h6o",
|
|
65
|
+
activationDropdownContent: "_1rjcze3t _1bsb1kdj",
|
|
66
|
+
activationNoResultsContainer: "_vchhusvi _1bsb1kdj _ca0q1ejb _n3td1ejb",
|
|
67
|
+
activationNoResultsContent: "_195g1wug _1bsb12aa _y3gn1h6o",
|
|
62
68
|
dropdownContent: "_1rjcv77o _1bsbsmdz _c71lko4j _1e0c1txw _1bah1h6o _4cvr1h6o",
|
|
63
69
|
containerWithMinHeight: "_1tkeqkoa",
|
|
64
70
|
contentContainer: "_y44vfmxe _1bsb1osq _1wpz1fhb _18m91wug",
|
|
@@ -516,6 +522,7 @@ var SyncedLocationDropdownWithCount = exports.SyncedLocationDropdownWithCount =
|
|
|
516
522
|
}));
|
|
517
523
|
}, [fetchStatus, intl, isOpen, referenceData, toggleOpen]);
|
|
518
524
|
return /*#__PURE__*/React.createElement(_uiMenu.DropdownContainer, {
|
|
525
|
+
alignX: "center",
|
|
519
526
|
testId: SYNCED_LOCATIONS_DROPDOWN_TEST_ID,
|
|
520
527
|
isOpen: isOpen,
|
|
521
528
|
trigger: trigger,
|
|
@@ -775,7 +782,7 @@ var DropdownContentWithReferenceData = function DropdownContentWithReferenceData
|
|
|
775
782
|
}
|
|
776
783
|
};
|
|
777
784
|
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
778
|
-
xcss: (0, _react2.cx)(styles.dropdownContent, shouldApplyMinHeight(fetchStatus, referenceData.length) && styles.containerWithMinHeight)
|
|
785
|
+
xcss: (0, _react2.cx)(styles.dropdownContent, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_sync_block_activation', 'isEnabled', true) && fetchStatus === 'success' && referenceData.length === 0 && styles.activationDropdownContent, shouldApplyMinHeight(fetchStatus, referenceData.length) && styles.containerWithMinHeight)
|
|
779
786
|
}, content());
|
|
780
787
|
};
|
|
781
788
|
var LoadingScreen = function LoadingScreen(_ref15) {
|
|
@@ -803,7 +810,23 @@ var ErrorScreen = function ErrorScreen(_ref16) {
|
|
|
803
810
|
};
|
|
804
811
|
var NoResultScreen = function NoResultScreen(_ref17) {
|
|
805
812
|
var formatMessage = _ref17.formatMessage;
|
|
806
|
-
return /*#__PURE__*/React.createElement(_compiled.
|
|
813
|
+
return (0, _expValEquals.expValEquals)('platform_editor_sync_block_activation', 'isEnabled', true) ? /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
814
|
+
xcss: styles.activationNoResultsContainer,
|
|
815
|
+
testId: "synced-locations-dropdown-content-no-results"
|
|
816
|
+
}, /*#__PURE__*/React.createElement(_compiled.Stack, {
|
|
817
|
+
alignInline: "center",
|
|
818
|
+
xcss: styles.activationNoResultsContent,
|
|
819
|
+
space: "space.150"
|
|
820
|
+
}, /*#__PURE__*/React.createElement(_SyncedLocationsEmptyStateIllustration.SyncedLocationsEmptyStateIllustration, null), /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
821
|
+
as: "p"
|
|
822
|
+
}, formatMessage(_messages.syncBlockMessages.syncedLocationDropdownActivationNoResults)), /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
823
|
+
as: "p"
|
|
824
|
+
}, /*#__PURE__*/React.createElement(_compiled.Anchor, {
|
|
825
|
+
href: _syncBlock.SYNCED_BLOCKS_DOCUMENTATION_URL,
|
|
826
|
+
target: "_blank",
|
|
827
|
+
rel: "noopener noreferrer",
|
|
828
|
+
xcss: styles.learnMoreLink
|
|
829
|
+
}, formatMessage(_messages.syncBlockMessages.syncedLocationDropdownLearnMoreLink))))) : /*#__PURE__*/React.createElement(_compiled.Stack, {
|
|
807
830
|
xcss: styles.noResultsContainer,
|
|
808
831
|
space: "space.100",
|
|
809
832
|
testId: "synced-locations-dropdown-content-no-results"
|