@atlaskit/editor-common 134.18.0 → 134.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/alignment-icon-map/package.json +10 -0
- package/credit-guard/check-ai-credit-status/package.json +10 -0
- package/credit-guard/popup/package.json +10 -0
- package/credit-guard/types/package.json +10 -0
- package/credit-guard/use-ai-credit-guard/package.json +10 -0
- package/credit-guard/use-ai-credit-status/package.json +10 -0
- package/credit-guard/use-credit-checked-action/package.json +10 -0
- package/dist/cjs/credit-guard/useAICreditStatus.js +40 -0
- package/dist/cjs/credit-guard/useCreditCheckedAction.js +19 -0
- package/dist/cjs/messages/rule.js +10 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/alignment-icon-map.js +40 -0
- package/dist/es2019/credit-guard/useAICreditStatus.js +26 -0
- package/dist/es2019/credit-guard/useCreditCheckedAction.js +13 -0
- package/dist/es2019/messages/rule.js +10 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/alignment-icon-map.js +34 -0
- package/dist/esm/credit-guard/useAICreditStatus.js +33 -0
- package/dist/esm/credit-guard/useCreditCheckedAction.js +13 -0
- package/dist/esm/messages/rule.js +10 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/alignment-icon-map.js +33 -0
- package/dist/types/credit-guard/types.d.ts +16 -1
- package/dist/types/credit-guard/useAICreditStatus.d.ts +3 -0
- package/dist/types/credit-guard/useCreditCheckedAction.d.ts +3 -0
- package/dist/types/messages/rule.d.ts +10 -0
- package/dist/types/ui/alignment-icon-map.d.ts +8 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 134.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`86477de71b158`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/86477de71b158) -
|
|
8
|
+
Converge Editor block Remix and image-generation credit guards on product-owned credit decisions.
|
|
9
|
+
Use the shared synchronous cached check with an optional invalidation subscription for mounted
|
|
10
|
+
surfaces, preserve host-owned content and Editor-owned visibility, and remove direct
|
|
11
|
+
credit-package dependencies from the shared consumers.
|
|
12
|
+
|
|
13
|
+
Preserve `featureName` and `touchPoint` analytics attribution for product-owned popup content,
|
|
14
|
+
including block-menu Ask Rovo impressions and credit requests. Existing
|
|
15
|
+
`rovo_credits_degradation_ui`, `confluence_ubp_remix`, and `confluence_ubp_ai_credits` rollout
|
|
16
|
+
controls remain in place.
|
|
17
|
+
|
|
18
|
+
Keep the reusable reactive credit hooks and provider contract in
|
|
19
|
+
`@atlaskit/editor-common/credit-guard`, alongside the existing check and popup. Image generation
|
|
20
|
+
and malleable-ui consume these shared foundations without importing credit helpers from the AI
|
|
21
|
+
plugin.
|
|
22
|
+
|
|
23
|
+
Expose the existing popup and synchronous guard helpers through granular public entrypoints and
|
|
24
|
+
migrate every credit-guard barrel consumer to its owning export.
|
|
25
|
+
|
|
26
|
+
- [`85d826388ed61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/85d826388ed61) -
|
|
27
|
+
[EDITOR-8341] export a shared AlignmentIconMap from editor-common and use it in the text alignment
|
|
28
|
+
and divider toolbars
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
|
|
3
34
|
## 134.18.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/alignment-icon-map",
|
|
3
|
+
"main": "../dist/cjs/ui/alignment-icon-map.js",
|
|
4
|
+
"module": "../dist/esm/ui/alignment-icon-map.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/ui/alignment-icon-map.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/ui/alignment-icon-map.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/check-ai-credit-status",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/checkAICreditStatus.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/checkAICreditStatus.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/checkAICreditStatus.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/checkAICreditStatus.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/popup",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/CreditCheckedPopup.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/CreditCheckedPopup.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/CreditCheckedPopup.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/CreditCheckedPopup.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/types",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/types.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/types.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/types.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/types.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/use-ai-credit-guard",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/useAICreditGuard.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/useAICreditGuard.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/useAICreditGuard.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/useAICreditGuard.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/use-ai-credit-status",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/useAICreditStatus.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/useAICreditStatus.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/useAICreditStatus.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/useAICreditStatus.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/use-credit-checked-action",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/useCreditCheckedAction.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/useCreditCheckedAction.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/useCreditCheckedAction.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/useCreditCheckedAction.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useAICreditStatus = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _checkAICreditStatus = require("./checkAICreditStatus");
|
|
11
|
+
var available = {
|
|
12
|
+
isBlocked: false
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Reuses cached product decisions; notifications preserve live depletion and recovery. */
|
|
16
|
+
var useAICreditStatus = exports.useAICreditStatus = function useAICreditStatus(provider, featureName) {
|
|
17
|
+
var isActive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
18
|
+
var getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
|
|
19
|
+
var subscribe = provider === null || provider === void 0 ? void 0 : provider.subscribeToAICreditStatus;
|
|
20
|
+
var _useState = (0, _react.useState)(function () {
|
|
21
|
+
return isActive && getAICreditStatus ? (0, _checkAICreditStatus.checkAICreditStatus)(getAICreditStatus, {
|
|
22
|
+
featureName: featureName
|
|
23
|
+
}) : available;
|
|
24
|
+
}),
|
|
25
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
26
|
+
status = _useState2[0],
|
|
27
|
+
setStatus = _useState2[1];
|
|
28
|
+
(0, _react.useEffect)(function () {
|
|
29
|
+
if (!isActive) return;
|
|
30
|
+
var refresh = function refresh() {
|
|
31
|
+
setStatus(getAICreditStatus ? (0, _checkAICreditStatus.checkAICreditStatus)(getAICreditStatus, {
|
|
32
|
+
featureName: featureName
|
|
33
|
+
}) : available);
|
|
34
|
+
};
|
|
35
|
+
var unsubscribe = subscribe === null || subscribe === void 0 ? void 0 : subscribe(refresh);
|
|
36
|
+
refresh();
|
|
37
|
+
return unsubscribe;
|
|
38
|
+
}, [featureName, getAICreditStatus, subscribe, isActive]);
|
|
39
|
+
return isActive && getAICreditStatus ? status : available;
|
|
40
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCreditCheckedAction = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _checkAICreditStatus = require("./checkAICreditStatus");
|
|
9
|
+
/** Recheck synchronously at activation using the same shared guard as other Editor actions. */
|
|
10
|
+
var useCreditCheckedAction = exports.useCreditCheckedAction = function useCreditCheckedAction(provider, featureName) {
|
|
11
|
+
var getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
|
|
12
|
+
return (0, _react.useCallback)(function (action) {
|
|
13
|
+
if (!getAICreditStatus || !(0, _checkAICreditStatus.checkAICreditStatus)(getAICreditStatus, {
|
|
14
|
+
featureName: featureName
|
|
15
|
+
}).isBlocked) {
|
|
16
|
+
action();
|
|
17
|
+
}
|
|
18
|
+
}, [getAICreditStatus, featureName]);
|
|
19
|
+
};
|
|
@@ -6,6 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ruleMessages = void 0;
|
|
7
7
|
var _reactIntl = require("react-intl");
|
|
8
8
|
var ruleMessages = exports.ruleMessages = (0, _reactIntl.defineMessages)({
|
|
9
|
+
addText: {
|
|
10
|
+
id: 'editor-common.messages.rule.addText',
|
|
11
|
+
defaultMessage: 'Add text',
|
|
12
|
+
description: 'Button for adding a text label to a divider.'
|
|
13
|
+
},
|
|
14
|
+
alignText: {
|
|
15
|
+
id: 'editor-common.messages.rule.alignText',
|
|
16
|
+
defaultMessage: 'Align text',
|
|
17
|
+
description: 'Button for aligning the text label of a divider.'
|
|
18
|
+
},
|
|
9
19
|
customDividerColor: {
|
|
10
20
|
id: 'editor-common.messages.rule.customDividerColor',
|
|
11
21
|
defaultMessage: 'Custom',
|
|
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
27
27
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
28
28
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
29
29
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
30
|
-
var packageVersion = "134.
|
|
30
|
+
var packageVersion = "134.18.0";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "134.
|
|
26
|
+
var packageVersion = "134.18.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AlignmentIconMap = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _alignTextCenter = _interopRequireDefault(require("@atlaskit/icon/core/align-text-center"));
|
|
11
|
+
var _alignTextLeft = _interopRequireDefault(require("@atlaskit/icon/core/align-text-left"));
|
|
12
|
+
var _alignTextRight = _interopRequireDefault(require("@atlaskit/icon/core/align-text-right"));
|
|
13
|
+
var _alignment = require("../messages/alignment");
|
|
14
|
+
var iconAndMessageMap = {
|
|
15
|
+
start: {
|
|
16
|
+
Component: _alignTextLeft.default,
|
|
17
|
+
label: _alignment.alignmentMessages.alignLeft
|
|
18
|
+
},
|
|
19
|
+
end: {
|
|
20
|
+
Component: _alignTextRight.default,
|
|
21
|
+
label: _alignment.alignmentMessages.alignRight
|
|
22
|
+
},
|
|
23
|
+
center: {
|
|
24
|
+
Component: _alignTextCenter.default,
|
|
25
|
+
label: _alignment.alignmentMessages.alignCenter
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var AlignmentIconMap = exports.AlignmentIconMap = function AlignmentIconMap(props) {
|
|
29
|
+
var _iconAndMessageMap$pr, _props$size;
|
|
30
|
+
var _ref = (_iconAndMessageMap$pr = iconAndMessageMap[props.alignment]) !== null && _iconAndMessageMap$pr !== void 0 ? _iconAndMessageMap$pr : iconAndMessageMap.center,
|
|
31
|
+
Component = _ref.Component,
|
|
32
|
+
label = _ref.label;
|
|
33
|
+
var intl = (0, _reactIntl.useIntl)();
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(Component, {
|
|
35
|
+
label: intl.formatMessage(label),
|
|
36
|
+
color: "currentColor",
|
|
37
|
+
spacing: "spacious",
|
|
38
|
+
size: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 'medium'
|
|
39
|
+
});
|
|
40
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { checkAICreditStatus } from './checkAICreditStatus';
|
|
3
|
+
const available = {
|
|
4
|
+
isBlocked: false
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
/** Reuses cached product decisions; notifications preserve live depletion and recovery. */
|
|
8
|
+
export const useAICreditStatus = (provider, featureName, isActive = true) => {
|
|
9
|
+
const getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
|
|
10
|
+
const subscribe = provider === null || provider === void 0 ? void 0 : provider.subscribeToAICreditStatus;
|
|
11
|
+
const [status, setStatus] = useState(() => isActive && getAICreditStatus ? checkAICreditStatus(getAICreditStatus, {
|
|
12
|
+
featureName
|
|
13
|
+
}) : available);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!isActive) return;
|
|
16
|
+
const refresh = () => {
|
|
17
|
+
setStatus(getAICreditStatus ? checkAICreditStatus(getAICreditStatus, {
|
|
18
|
+
featureName
|
|
19
|
+
}) : available);
|
|
20
|
+
};
|
|
21
|
+
const unsubscribe = subscribe === null || subscribe === void 0 ? void 0 : subscribe(refresh);
|
|
22
|
+
refresh();
|
|
23
|
+
return unsubscribe;
|
|
24
|
+
}, [featureName, getAICreditStatus, subscribe, isActive]);
|
|
25
|
+
return isActive && getAICreditStatus ? status : available;
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { checkAICreditStatus } from './checkAICreditStatus';
|
|
3
|
+
/** Recheck synchronously at activation using the same shared guard as other Editor actions. */
|
|
4
|
+
export const useCreditCheckedAction = (provider, featureName) => {
|
|
5
|
+
const getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
|
|
6
|
+
return useCallback(action => {
|
|
7
|
+
if (!getAICreditStatus || !checkAICreditStatus(getAICreditStatus, {
|
|
8
|
+
featureName
|
|
9
|
+
}).isBlocked) {
|
|
10
|
+
action();
|
|
11
|
+
}
|
|
12
|
+
}, [getAICreditStatus, featureName]);
|
|
13
|
+
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl';
|
|
2
2
|
export const ruleMessages = defineMessages({
|
|
3
|
+
addText: {
|
|
4
|
+
id: 'editor-common.messages.rule.addText',
|
|
5
|
+
defaultMessage: 'Add text',
|
|
6
|
+
description: 'Button for adding a text label to a divider.'
|
|
7
|
+
},
|
|
8
|
+
alignText: {
|
|
9
|
+
id: 'editor-common.messages.rule.alignText',
|
|
10
|
+
defaultMessage: 'Align text',
|
|
11
|
+
description: 'Button for aligning the text label of a divider.'
|
|
12
|
+
},
|
|
3
13
|
customDividerColor: {
|
|
4
14
|
id: 'editor-common.messages.rule.customDividerColor',
|
|
5
15
|
defaultMessage: 'Custom',
|
|
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
13
13
|
const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
14
14
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
15
15
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
16
|
-
const packageVersion = "134.
|
|
16
|
+
const packageVersion = "134.18.0";
|
|
17
17
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
18
18
|
// Remove URL as it has UGC
|
|
19
19
|
// Ignored via go/ees007
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "134.
|
|
16
|
+
const packageVersion = "134.18.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import AlignTextCenterIcon from '@atlaskit/icon/core/align-text-center';
|
|
4
|
+
import AlignTextLeftIcon from '@atlaskit/icon/core/align-text-left';
|
|
5
|
+
import AlignTextRightIcon from '@atlaskit/icon/core/align-text-right';
|
|
6
|
+
import { alignmentMessages as messages } from '../messages/alignment';
|
|
7
|
+
const iconAndMessageMap = {
|
|
8
|
+
start: {
|
|
9
|
+
Component: AlignTextLeftIcon,
|
|
10
|
+
label: messages.alignLeft
|
|
11
|
+
},
|
|
12
|
+
end: {
|
|
13
|
+
Component: AlignTextRightIcon,
|
|
14
|
+
label: messages.alignRight
|
|
15
|
+
},
|
|
16
|
+
center: {
|
|
17
|
+
Component: AlignTextCenterIcon,
|
|
18
|
+
label: messages.alignCenter
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const AlignmentIconMap = props => {
|
|
22
|
+
var _iconAndMessageMap$pr, _props$size;
|
|
23
|
+
const {
|
|
24
|
+
Component,
|
|
25
|
+
label
|
|
26
|
+
} = (_iconAndMessageMap$pr = iconAndMessageMap[props.alignment]) !== null && _iconAndMessageMap$pr !== void 0 ? _iconAndMessageMap$pr : iconAndMessageMap.center;
|
|
27
|
+
const intl = useIntl();
|
|
28
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
29
|
+
label: intl.formatMessage(label),
|
|
30
|
+
color: "currentColor",
|
|
31
|
+
spacing: "spacious",
|
|
32
|
+
size: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 'medium'
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { checkAICreditStatus } from './checkAICreditStatus';
|
|
4
|
+
var available = {
|
|
5
|
+
isBlocked: false
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** Reuses cached product decisions; notifications preserve live depletion and recovery. */
|
|
9
|
+
export var useAICreditStatus = function useAICreditStatus(provider, featureName) {
|
|
10
|
+
var isActive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
11
|
+
var getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
|
|
12
|
+
var subscribe = provider === null || provider === void 0 ? void 0 : provider.subscribeToAICreditStatus;
|
|
13
|
+
var _useState = useState(function () {
|
|
14
|
+
return isActive && getAICreditStatus ? checkAICreditStatus(getAICreditStatus, {
|
|
15
|
+
featureName: featureName
|
|
16
|
+
}) : available;
|
|
17
|
+
}),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
status = _useState2[0],
|
|
20
|
+
setStatus = _useState2[1];
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
if (!isActive) return;
|
|
23
|
+
var refresh = function refresh() {
|
|
24
|
+
setStatus(getAICreditStatus ? checkAICreditStatus(getAICreditStatus, {
|
|
25
|
+
featureName: featureName
|
|
26
|
+
}) : available);
|
|
27
|
+
};
|
|
28
|
+
var unsubscribe = subscribe === null || subscribe === void 0 ? void 0 : subscribe(refresh);
|
|
29
|
+
refresh();
|
|
30
|
+
return unsubscribe;
|
|
31
|
+
}, [featureName, getAICreditStatus, subscribe, isActive]);
|
|
32
|
+
return isActive && getAICreditStatus ? status : available;
|
|
33
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { checkAICreditStatus } from './checkAICreditStatus';
|
|
3
|
+
/** Recheck synchronously at activation using the same shared guard as other Editor actions. */
|
|
4
|
+
export var useCreditCheckedAction = function useCreditCheckedAction(provider, featureName) {
|
|
5
|
+
var getAICreditStatus = provider === null || provider === void 0 ? void 0 : provider.getAICreditStatus;
|
|
6
|
+
return useCallback(function (action) {
|
|
7
|
+
if (!getAICreditStatus || !checkAICreditStatus(getAICreditStatus, {
|
|
8
|
+
featureName: featureName
|
|
9
|
+
}).isBlocked) {
|
|
10
|
+
action();
|
|
11
|
+
}
|
|
12
|
+
}, [getAICreditStatus, featureName]);
|
|
13
|
+
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl';
|
|
2
2
|
export var ruleMessages = defineMessages({
|
|
3
|
+
addText: {
|
|
4
|
+
id: 'editor-common.messages.rule.addText',
|
|
5
|
+
defaultMessage: 'Add text',
|
|
6
|
+
description: 'Button for adding a text label to a divider.'
|
|
7
|
+
},
|
|
8
|
+
alignText: {
|
|
9
|
+
id: 'editor-common.messages.rule.alignText',
|
|
10
|
+
defaultMessage: 'Align text',
|
|
11
|
+
description: 'Button for aligning the text label of a divider.'
|
|
12
|
+
},
|
|
3
13
|
customDividerColor: {
|
|
4
14
|
id: 'editor-common.messages.rule.customDividerColor',
|
|
5
15
|
defaultMessage: 'Custom',
|
|
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
19
19
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "134.
|
|
22
|
+
var packageVersion = "134.18.0";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "134.
|
|
23
|
+
var packageVersion = "134.18.0";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import AlignTextCenterIcon from '@atlaskit/icon/core/align-text-center';
|
|
4
|
+
import AlignTextLeftIcon from '@atlaskit/icon/core/align-text-left';
|
|
5
|
+
import AlignTextRightIcon from '@atlaskit/icon/core/align-text-right';
|
|
6
|
+
import { alignmentMessages as messages } from '../messages/alignment';
|
|
7
|
+
var iconAndMessageMap = {
|
|
8
|
+
start: {
|
|
9
|
+
Component: AlignTextLeftIcon,
|
|
10
|
+
label: messages.alignLeft
|
|
11
|
+
},
|
|
12
|
+
end: {
|
|
13
|
+
Component: AlignTextRightIcon,
|
|
14
|
+
label: messages.alignRight
|
|
15
|
+
},
|
|
16
|
+
center: {
|
|
17
|
+
Component: AlignTextCenterIcon,
|
|
18
|
+
label: messages.alignCenter
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export var AlignmentIconMap = function AlignmentIconMap(props) {
|
|
22
|
+
var _iconAndMessageMap$pr, _props$size;
|
|
23
|
+
var _ref = (_iconAndMessageMap$pr = iconAndMessageMap[props.alignment]) !== null && _iconAndMessageMap$pr !== void 0 ? _iconAndMessageMap$pr : iconAndMessageMap.center,
|
|
24
|
+
Component = _ref.Component,
|
|
25
|
+
label = _ref.label;
|
|
26
|
+
var intl = useIntl();
|
|
27
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
28
|
+
label: intl.formatMessage(label),
|
|
29
|
+
color: "currentColor",
|
|
30
|
+
spacing: "spacious",
|
|
31
|
+
size: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 'medium'
|
|
32
|
+
});
|
|
33
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
export type EditorAICreditFeatureName = 'blockMenu-askRovo' | 'selectionToolbar-askRovo' | 'selectionToolbar-remix' | 'commentEditor-askRovo' | 'quickInsert-askRovo' | 'elementBrowser-askRovo' | 'panelFloatingToolbar-remix' | 'primaryToolbar-write' | 'mediaFloatingToolbar-editImage' | 'tableFloatingToolbar-remix' | 'smartLinkFloatingToolbar-askRovo' | 'codeBlockFloatingToolbar-remix' | 'imageGenerationMediaInsert';
|
|
2
|
+
export type EditorAICreditFeatureName = 'blockMenu-askRovo' | 'selectionToolbar-askRovo' | 'selectionToolbar-remix' | 'commentEditor-askRovo' | 'quickInsert-askRovo' | 'elementBrowser-askRovo' | 'panelFloatingToolbar-remix' | 'primaryToolbar-write' | 'mediaFloatingToolbar-editImage' | 'tableFloatingToolbar-remix' | 'smartLinkFloatingToolbar-askRovo' | 'codeBlockFloatingToolbar-remix' | 'imageGenerationMediaInsert' | 'blockControls-remix';
|
|
3
3
|
export type AICreditCheck = {
|
|
4
4
|
featureName: EditorAICreditFeatureName;
|
|
5
5
|
};
|
|
@@ -11,3 +11,18 @@ export type AICreditStatus = {
|
|
|
11
11
|
};
|
|
12
12
|
/** Supply a synchronous cached decision. Promise typing remains temporarily for legacy consumers. */
|
|
13
13
|
export type GetAICreditStatus = (context: AICreditCheck) => AICreditStatus | Promise<AICreditStatus>;
|
|
14
|
+
/** Product-owned credit decisions, optionally invalidated without rebuilding an Editor preset. */
|
|
15
|
+
export type EditorAICreditStatusProvider = {
|
|
16
|
+
/**
|
|
17
|
+
* Supply a synchronous cached product decision. The entry point identifies the requested
|
|
18
|
+
* feature; products own rollout policy, analytics attribution, and blocked content.
|
|
19
|
+
* Unavailable or legacy Promise decisions fail open. Omit to preserve existing behavior.
|
|
20
|
+
*/
|
|
21
|
+
getAICreditStatus?: GetAICreditStatus;
|
|
22
|
+
/**
|
|
23
|
+
* Optional notification that cached decisions changed. Consumers synchronously re-read
|
|
24
|
+
* getAICreditStatus. Products own the subscription and return an unsubscribe function.
|
|
25
|
+
* Omit for action-time checks that need no live updates.
|
|
26
|
+
*/
|
|
27
|
+
subscribeToAICreditStatus?: (onChange: () => void) => () => void;
|
|
28
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AICreditCheck, AICreditStatus, EditorAICreditStatusProvider } from './types';
|
|
2
|
+
/** Reuses cached product decisions; notifications preserve live depletion and recovery. */
|
|
3
|
+
export declare const useAICreditStatus: (provider: EditorAICreditStatusProvider | undefined, featureName: AICreditCheck['featureName'], isActive?: boolean) => AICreditStatus;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AICreditCheck, EditorAICreditStatusProvider } from './types';
|
|
2
|
+
/** Recheck synchronously at activation using the same shared guard as other Editor actions. */
|
|
3
|
+
export declare const useCreditCheckedAction: (provider: EditorAICreditStatusProvider | undefined, featureName: AICreditCheck['featureName']) => ((action: () => void) => void);
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export declare const ruleMessages: {
|
|
2
|
+
addText: {
|
|
3
|
+
defaultMessage: string;
|
|
4
|
+
description: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
alignText: {
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
description: string;
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
2
12
|
boldGrayDividerColor: {
|
|
3
13
|
defaultMessage: string;
|
|
4
14
|
description: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "134.
|
|
3
|
+
"version": "134.19.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
48
48
|
"@atlaskit/editor-shared-styles": "^5.1.0",
|
|
49
49
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
50
|
-
"@atlaskit/editor-toolbar": "^2.
|
|
50
|
+
"@atlaskit/editor-toolbar": "^2.11.0",
|
|
51
51
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
52
52
|
"@atlaskit/editor-ui-control-model": "^3.0.0",
|
|
53
53
|
"@atlaskit/emoji": "^73.6.0",
|
|
54
54
|
"@atlaskit/feature-gate-js-client": "^8.0.0",
|
|
55
|
-
"@atlaskit/icon": "^38.
|
|
55
|
+
"@atlaskit/icon": "^38.1.0",
|
|
56
56
|
"@atlaskit/link": "^5.1.0",
|
|
57
57
|
"@atlaskit/link-datasource": "^7.13.0",
|
|
58
58
|
"@atlaskit/link-picker": "^6.20.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@atlaskit/media-common": "^14.7.0",
|
|
64
64
|
"@atlaskit/media-file-preview": "^2.0.0",
|
|
65
65
|
"@atlaskit/media-picker": "^73.3.0",
|
|
66
|
-
"@atlaskit/media-ui": "^31.
|
|
66
|
+
"@atlaskit/media-ui": "^31.10.0",
|
|
67
67
|
"@atlaskit/media-viewer": "^54.12.0",
|
|
68
68
|
"@atlaskit/mention": "^30.9.0",
|
|
69
69
|
"@atlaskit/menu": "^11.0.0",
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"@atlaskit/popper": "^9.4.0",
|
|
76
76
|
"@atlaskit/popup": "^10.2.0",
|
|
77
77
|
"@atlaskit/primitives": "^22.7.0",
|
|
78
|
-
"@atlaskit/profilecard": "^27.
|
|
78
|
+
"@atlaskit/profilecard": "^27.10.0",
|
|
79
79
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
80
80
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
81
|
-
"@atlaskit/react-ufo": "^8.
|
|
82
|
-
"@atlaskit/section-message": "^10.
|
|
81
|
+
"@atlaskit/react-ufo": "^8.5.0",
|
|
82
|
+
"@atlaskit/section-message": "^10.3.0",
|
|
83
83
|
"@atlaskit/smart-card": "^46.14.0",
|
|
84
84
|
"@atlaskit/smart-user-picker": "^12.12.0",
|
|
85
85
|
"@atlaskit/spinner": "^20.4.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@atlaskit/teams-app-config": "^3.1.0",
|
|
88
88
|
"@atlaskit/textfield": "^10.3.0",
|
|
89
89
|
"@atlaskit/tmp-editor-statsig": "^262.0.0",
|
|
90
|
-
"@atlaskit/tokens": "^20.
|
|
90
|
+
"@atlaskit/tokens": "^20.12.0",
|
|
91
91
|
"@atlaskit/tooltip": "^24.4.0",
|
|
92
92
|
"@atlaskit/width-detector": "^7.2.0",
|
|
93
93
|
"@babel/runtime": "^7.0.0",
|