@atlaskit/smart-card 26.50.15 → 26.51.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 +11 -0
- package/dist/cjs/extractors/common/context/extractAccessContext.js +28 -67
- package/dist/cjs/extractors/common/context/index.js +2 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/index.js +7 -3
- package/dist/cjs/view/BlockCard/views/ForbiddenView.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/elements/snippet-element/index.js +7 -3
- package/dist/cjs/view/FlexibleCard/utils.js +4 -4
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/ai-summary/index.js +5 -1
- package/dist/es2019/extractors/common/context/extractAccessContext.js +26 -68
- package/dist/es2019/extractors/common/context/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/index.js +9 -4
- package/dist/es2019/view/BlockCard/views/ForbiddenView.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/elements/snippet-element/index.js +7 -4
- package/dist/es2019/view/FlexibleCard/utils.js +5 -5
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/ai-summary/index.js +5 -1
- package/dist/esm/extractors/common/context/extractAccessContext.js +27 -66
- package/dist/esm/extractors/common/context/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/index.js +8 -4
- package/dist/esm/view/BlockCard/views/ForbiddenView.js +3 -2
- package/dist/esm/view/FlexibleCard/components/elements/snippet-element/index.js +7 -3
- package/dist/esm/view/FlexibleCard/utils.js +5 -5
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/ai-summary/index.js +5 -1
- package/dist/types/extractors/common/context/extractAccessContext.d.ts +1 -6
- package/dist/types/extractors/common/context/index.d.ts +1 -1
- package/dist/types-ts4.5/extractors/common/context/extractAccessContext.d.ts +1 -6
- package/dist/types-ts4.5/extractors/common/context/index.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.51.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#85226](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85226) [`721df2752215`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/721df2752215) - Replaces usages of extractRequestAccessContext for extractRequestAccessContextImproved and removes extractRequestAccessContext
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#87154](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87154) [`7ec9068aa6fb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7ec9068aa6fb) - Update style for Snippet & summary component to enable user text selection
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 26.50.15
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.extractRequestAccessContextImproved =
|
|
7
|
+
exports.extractRequestAccessContextImproved = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _messages = require("../../../messages");
|
|
10
10
|
var _ForbiddenAction = require("../../../view/BlockCard/actions/ForbiddenAction");
|
|
@@ -12,73 +12,30 @@ var _extractHostname = _interopRequireDefault(require("../hostname/extractHostna
|
|
|
12
12
|
var _analytics = require("../../../utils/analytics");
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
|
-
var
|
|
15
|
+
var extractRequestAccessContextImproved = exports.extractRequestAccessContextImproved = function extractRequestAccessContextImproved(_ref) {
|
|
16
16
|
var _jsonLd$requestAccess;
|
|
17
17
|
var jsonLd = _ref.jsonLd,
|
|
18
18
|
url = _ref.url,
|
|
19
|
-
product = _ref.product
|
|
19
|
+
product = _ref.product,
|
|
20
|
+
createAnalyticsEvent = _ref.createAnalyticsEvent;
|
|
20
21
|
var requestAccess = jsonLd !== null && jsonLd !== void 0 && jsonLd.requestAccess ? _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
|
|
21
22
|
hostname: (0, _extractHostname.default)(url)
|
|
22
23
|
}) : undefined;
|
|
23
24
|
switch (jsonLd === null || jsonLd === void 0 || (_jsonLd$requestAccess = jsonLd.requestAccess) === null || _jsonLd$requestAccess === void 0 ? void 0 : _jsonLd$requestAccess.accessType) {
|
|
24
|
-
case 'DIRECT_ACCESS':
|
|
25
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
26
|
-
callToActionMessageKey: 'click_to_join',
|
|
27
|
-
descriptiveMessageKey: 'click_to_join_description',
|
|
28
|
-
action: (0, _ForbiddenAction.ForbiddenAction)(function () {
|
|
29
|
-
return window.open(url);
|
|
30
|
-
}, 'click_to_join', _messages.messages.click_to_join, {
|
|
31
|
-
context: product
|
|
32
|
-
})
|
|
33
|
-
});
|
|
34
|
-
case 'REQUEST_ACCESS':
|
|
35
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
36
|
-
callToActionMessageKey: 'request_access',
|
|
37
|
-
descriptiveMessageKey: 'request_access_description',
|
|
38
|
-
action: (0, _ForbiddenAction.ForbiddenAction)(function () {
|
|
39
|
-
return window.open(url);
|
|
40
|
-
}, 'request_access', _messages.messages.request_access, {
|
|
41
|
-
product: product
|
|
42
|
-
})
|
|
43
|
-
});
|
|
44
|
-
case 'PENDING_REQUEST_EXISTS':
|
|
45
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
46
|
-
descriptiveMessageKey: 'request_access_pending_description'
|
|
47
|
-
});
|
|
48
|
-
case 'FORBIDDEN':
|
|
49
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
50
|
-
descriptiveMessageKey: 'forbidden_description'
|
|
51
|
-
});
|
|
52
|
-
case 'DENIED_REQUEST_EXISTS':
|
|
53
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
54
|
-
descriptiveMessageKey: 'request_denied_description'
|
|
55
|
-
});
|
|
56
|
-
default:
|
|
57
|
-
return requestAccess;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var extractRequestAccessContextImproved = exports.extractRequestAccessContextImproved = function extractRequestAccessContextImproved(_ref2) {
|
|
61
|
-
var _jsonLd$requestAccess2;
|
|
62
|
-
var jsonLd = _ref2.jsonLd,
|
|
63
|
-
url = _ref2.url,
|
|
64
|
-
product = _ref2.product,
|
|
65
|
-
createAnalyticsEvent = _ref2.createAnalyticsEvent;
|
|
66
|
-
var requestAccess = jsonLd !== null && jsonLd !== void 0 && jsonLd.requestAccess ? _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
|
|
67
|
-
hostname: (0, _extractHostname.default)(url)
|
|
68
|
-
}) : undefined;
|
|
69
|
-
switch (jsonLd === null || jsonLd === void 0 || (_jsonLd$requestAccess2 = jsonLd.requestAccess) === null || _jsonLd$requestAccess2 === void 0 ? void 0 : _jsonLd$requestAccess2.accessType) {
|
|
70
25
|
case 'DIRECT_ACCESS':
|
|
71
26
|
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
72
27
|
titleMessageKey: 'direct_access_title',
|
|
73
28
|
descriptiveMessageKey: 'direct_access_description',
|
|
74
29
|
callToActionMessageKey: 'direct_access',
|
|
75
30
|
action: (0, _ForbiddenAction.ForbiddenAction)(function () {
|
|
76
|
-
createAnalyticsEvent
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
31
|
+
if (createAnalyticsEvent !== undefined) {
|
|
32
|
+
createAnalyticsEvent({
|
|
33
|
+
action: 'clicked',
|
|
34
|
+
actionSubject: 'button',
|
|
35
|
+
actionSubjectId: 'crossJoin',
|
|
36
|
+
eventType: 'ui'
|
|
37
|
+
}).fire(_analytics.ANALYTICS_CHANNEL);
|
|
38
|
+
}
|
|
82
39
|
window.open(url);
|
|
83
40
|
}, 'direct_access', _messages.messages.direct_access, {
|
|
84
41
|
product: product
|
|
@@ -90,12 +47,14 @@ var extractRequestAccessContextImproved = exports.extractRequestAccessContextImp
|
|
|
90
47
|
descriptiveMessageKey: 'request_access_description',
|
|
91
48
|
callToActionMessageKey: 'request_access',
|
|
92
49
|
action: (0, _ForbiddenAction.ForbiddenAction)(function () {
|
|
93
|
-
createAnalyticsEvent
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
50
|
+
if (createAnalyticsEvent !== undefined) {
|
|
51
|
+
createAnalyticsEvent({
|
|
52
|
+
action: 'clicked',
|
|
53
|
+
actionSubject: 'button',
|
|
54
|
+
actionSubjectId: 'requestAccess',
|
|
55
|
+
eventType: 'ui'
|
|
56
|
+
}).fire(_analytics.ANALYTICS_CHANNEL);
|
|
57
|
+
}
|
|
99
58
|
window.open(url);
|
|
100
59
|
}, 'request_access', _messages.messages.request_access)
|
|
101
60
|
});
|
|
@@ -126,12 +85,14 @@ var extractRequestAccessContextImproved = exports.extractRequestAccessContextImp
|
|
|
126
85
|
descriptiveMessageKey: 'access_exists_description',
|
|
127
86
|
callToActionMessageKey: 'request_access',
|
|
128
87
|
action: (0, _ForbiddenAction.ForbiddenAction)(function () {
|
|
129
|
-
createAnalyticsEvent
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
88
|
+
if (createAnalyticsEvent !== undefined) {
|
|
89
|
+
createAnalyticsEvent({
|
|
90
|
+
action: 'clicked',
|
|
91
|
+
actionSubject: 'button',
|
|
92
|
+
actionSubjectId: 'requestAccess',
|
|
93
|
+
eventType: 'ui'
|
|
94
|
+
}).fire(_analytics.ANALYTICS_CHANNEL);
|
|
95
|
+
}
|
|
135
96
|
window.open(url);
|
|
136
97
|
}, 'access_exists', _messages.messages.request_access)
|
|
137
98
|
});
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "extractRequestAccessContextImproved", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return _extractAccessContext.
|
|
9
|
+
return _extractAccessContext.extractRequestAccessContextImproved;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
var _extractAccessContext = require("./extractAccessContext");
|
|
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
22
22
|
var context = exports.context = {
|
|
23
23
|
componentName: 'smart-cards',
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "26.
|
|
25
|
+
packageVersion: "26.51.0"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -60,6 +60,7 @@ Object.defineProperty(exports, "PreviewAction", {
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
63
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
63
64
|
var _helpers = require("../../state/helpers");
|
|
64
65
|
var _block = require("../../extractors/block");
|
|
65
66
|
var _jsonld = require("../../utils/jsonld");
|
|
@@ -84,7 +85,7 @@ var _PreviewAction = _interopRequireDefault(require("./actions/PreviewAction"));
|
|
|
84
85
|
/** @jsx jsx */
|
|
85
86
|
|
|
86
87
|
var BlockCard = exports.BlockCard = function BlockCard(_ref) {
|
|
87
|
-
var _details$meta, _forbiddenViewProps$c;
|
|
88
|
+
var _details$meta, _forbiddenViewProps$c, _forbiddenViewProps$c2;
|
|
88
89
|
var id = _ref.id,
|
|
89
90
|
url = _ref.url,
|
|
90
91
|
cardState = _ref.cardState,
|
|
@@ -102,6 +103,8 @@ var BlockCard = exports.BlockCard = function BlockCard(_ref) {
|
|
|
102
103
|
analytics = _ref.analytics,
|
|
103
104
|
enableFlexibleBlockCard = _ref.enableFlexibleBlockCard,
|
|
104
105
|
actionOptions = _ref.actionOptions;
|
|
106
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
107
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
105
108
|
var status = cardState.status,
|
|
106
109
|
details = cardState.details;
|
|
107
110
|
var data = details && details.data || (0, _jsonld.getEmptyJsonLd)();
|
|
@@ -215,10 +218,11 @@ var BlockCard = exports.BlockCard = function BlockCard(_ref) {
|
|
|
215
218
|
}
|
|
216
219
|
var forbiddenViewProps = (0, _block.extractBlockProps)(data, meta, extractorOpts);
|
|
217
220
|
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : (0, _jsonld.getForbiddenJsonLd)().meta;
|
|
218
|
-
var requestAccessContext = (0, _context.
|
|
221
|
+
var requestAccessContext = (0, _context.extractRequestAccessContextImproved)({
|
|
219
222
|
jsonLd: cardMetadata,
|
|
220
223
|
url: url,
|
|
221
|
-
product: (_forbiddenViewProps$c = forbiddenViewProps.context) === null || _forbiddenViewProps$
|
|
224
|
+
product: (_forbiddenViewProps$c = (_forbiddenViewProps$c2 = forbiddenViewProps.context) === null || _forbiddenViewProps$c2 === void 0 ? void 0 : _forbiddenViewProps$c2.text) !== null && _forbiddenViewProps$c !== void 0 ? _forbiddenViewProps$c : '',
|
|
225
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
222
226
|
});
|
|
223
227
|
return (0, _react.jsx)(_ForbiddenView.ForbiddenView, (0, _extends2.default)({}, forbiddenViewProps, {
|
|
224
228
|
isSelected: isSelected,
|
|
@@ -64,8 +64,9 @@ var ForbiddenView = exports.ForbiddenView = function ForbiddenView(_ref) {
|
|
|
64
64
|
_requestAccessContext = requestAccessContext.descriptiveMessageKey,
|
|
65
65
|
descriptiveMessageKey = _requestAccessContext === void 0 ? 'invalid_permissions_description' : _requestAccessContext,
|
|
66
66
|
_requestAccessContext2 = requestAccessContext.hostname,
|
|
67
|
-
hostname = _requestAccessContext2 === void 0 ? '' : _requestAccessContext2
|
|
68
|
-
|
|
67
|
+
hostname = _requestAccessContext2 === void 0 ? '' : _requestAccessContext2,
|
|
68
|
+
buttonDisabled = requestAccessContext.buttonDisabled;
|
|
69
|
+
var items = action !== undefined && !(buttonDisabled !== null && buttonDisabled !== void 0 ? buttonDisabled : false) ? [].concat((0, _toConsumableArray2.default)(actions), [action]) : actions;
|
|
69
70
|
return (0, _react.jsx)(_Frame.Frame, {
|
|
70
71
|
isSelected: isSelected,
|
|
71
72
|
testId: testId,
|
|
@@ -8,19 +8,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
12
11
|
var _react = require("@emotion/react");
|
|
13
12
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
14
13
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
15
14
|
var _text = _interopRequireDefault(require("../text"));
|
|
16
15
|
var _excluded = ["content", "maxLines", "overrideCss"];
|
|
17
|
-
var _templateObject;
|
|
18
16
|
/** @jsx jsx */
|
|
19
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
19
|
var SNIPPET_DEFAULT_MAX_LINES = 3;
|
|
22
20
|
var getSnippetStyles = function getSnippetStyles(overrideCss) {
|
|
23
|
-
return (0, _react.css)(
|
|
21
|
+
return (0, _react.css)({
|
|
22
|
+
color: "var(--ds-text, #172B4D)",
|
|
23
|
+
WebkitUserSelect: 'text',
|
|
24
|
+
MozUserSelect: 'text',
|
|
25
|
+
MsUserSelect: 'text',
|
|
26
|
+
userSelect: 'text'
|
|
27
|
+
}, overrideCss);
|
|
24
28
|
};
|
|
25
29
|
var SnippetElement = function SnippetElement() {
|
|
26
30
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -66,7 +66,7 @@ var getForbiddenMessageKey = function getForbiddenMessageKey(meta) {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
var getRetryOptions = exports.getRetryOptions = function getRetryOptions(url, status, response, onAuthorize) {
|
|
69
|
-
var _response$meta, _access$action;
|
|
69
|
+
var _response$meta, _access$action, _access$buttonDisable;
|
|
70
70
|
var data = response && response.data || (0, _jsonld.getEmptyJsonLd)();
|
|
71
71
|
var provider = (0, _linkExtractors.extractProvider)(data);
|
|
72
72
|
var context = provider === null || provider === void 0 ? void 0 : provider.text;
|
|
@@ -76,15 +76,15 @@ var getRetryOptions = exports.getRetryOptions = function getRetryOptions(url, st
|
|
|
76
76
|
switch (status) {
|
|
77
77
|
case _constants.SmartLinkStatus.Forbidden:
|
|
78
78
|
var meta = (_response$meta = response === null || response === void 0 ? void 0 : response.meta) !== null && _response$meta !== void 0 ? _response$meta : (0, _jsonld.getForbiddenJsonLd)().meta;
|
|
79
|
-
var access = (0, _context.
|
|
79
|
+
var access = (0, _context.extractRequestAccessContextImproved)({
|
|
80
80
|
jsonLd: meta,
|
|
81
81
|
url: url,
|
|
82
|
-
product: context
|
|
82
|
+
product: context !== null && context !== void 0 ? context : ''
|
|
83
83
|
});
|
|
84
84
|
var messageKey = getForbiddenMessageKey(meta);
|
|
85
85
|
var descriptor = _messages.messages[messageKey];
|
|
86
86
|
var retry = onAuthorize || (access === null || access === void 0 || (_access$action = access.action) === null || _access$action === void 0 ? void 0 : _access$action.promise);
|
|
87
|
-
var onClick = retry ? (0, _utils.handleOnClick)(retry) : undefined;
|
|
87
|
+
var onClick = retry && !((_access$buttonDisable = access === null || access === void 0 ? void 0 : access.buttonDisabled) !== null && _access$buttonDisable !== void 0 ? _access$buttonDisable : false) ? (0, _utils.handleOnClick)(retry) : undefined;
|
|
88
88
|
return {
|
|
89
89
|
descriptor: descriptor,
|
|
90
90
|
onClick: onClick,
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.
|
|
20
|
+
packageVersion: "26.51.0",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -23,7 +23,11 @@ var AISummaryCSSStyles = (0, _react2.css)({
|
|
|
23
23
|
fontSize: '0.75rem',
|
|
24
24
|
lineHeight: '1rem',
|
|
25
25
|
wordWrap: 'break-word',
|
|
26
|
-
whiteSpace: 'normal'
|
|
26
|
+
whiteSpace: 'normal',
|
|
27
|
+
WebkitUserSelect: 'text',
|
|
28
|
+
MozUserSelect: 'text',
|
|
29
|
+
MsUserSelect: 'text',
|
|
30
|
+
userSelect: 'text'
|
|
27
31
|
});
|
|
28
32
|
/**
|
|
29
33
|
* A component to render a response from AI in markdown text.
|
|
@@ -2,66 +2,18 @@ import { messages } from '../../../messages';
|
|
|
2
2
|
import { ForbiddenAction } from '../../../view/BlockCard/actions/ForbiddenAction';
|
|
3
3
|
import extractHostname from '../hostname/extractHostname';
|
|
4
4
|
import { ANALYTICS_CHANNEL } from '../../../utils/analytics';
|
|
5
|
-
export const extractRequestAccessContext = ({
|
|
6
|
-
jsonLd,
|
|
7
|
-
url,
|
|
8
|
-
product
|
|
9
|
-
}) => {
|
|
10
|
-
var _jsonLd$requestAccess;
|
|
11
|
-
const requestAccess = jsonLd !== null && jsonLd !== void 0 && jsonLd.requestAccess ? {
|
|
12
|
-
...(jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess),
|
|
13
|
-
hostname: extractHostname(url)
|
|
14
|
-
} : undefined;
|
|
15
|
-
switch (jsonLd === null || jsonLd === void 0 ? void 0 : (_jsonLd$requestAccess = jsonLd.requestAccess) === null || _jsonLd$requestAccess === void 0 ? void 0 : _jsonLd$requestAccess.accessType) {
|
|
16
|
-
case 'DIRECT_ACCESS':
|
|
17
|
-
return {
|
|
18
|
-
...requestAccess,
|
|
19
|
-
callToActionMessageKey: 'click_to_join',
|
|
20
|
-
descriptiveMessageKey: 'click_to_join_description',
|
|
21
|
-
action: ForbiddenAction(() => window.open(url), 'click_to_join', messages.click_to_join, {
|
|
22
|
-
context: product
|
|
23
|
-
})
|
|
24
|
-
};
|
|
25
|
-
case 'REQUEST_ACCESS':
|
|
26
|
-
return {
|
|
27
|
-
...requestAccess,
|
|
28
|
-
callToActionMessageKey: 'request_access',
|
|
29
|
-
descriptiveMessageKey: 'request_access_description',
|
|
30
|
-
action: ForbiddenAction(() => window.open(url), 'request_access', messages.request_access, {
|
|
31
|
-
product
|
|
32
|
-
})
|
|
33
|
-
};
|
|
34
|
-
case 'PENDING_REQUEST_EXISTS':
|
|
35
|
-
return {
|
|
36
|
-
...requestAccess,
|
|
37
|
-
descriptiveMessageKey: 'request_access_pending_description'
|
|
38
|
-
};
|
|
39
|
-
case 'FORBIDDEN':
|
|
40
|
-
return {
|
|
41
|
-
...requestAccess,
|
|
42
|
-
descriptiveMessageKey: 'forbidden_description'
|
|
43
|
-
};
|
|
44
|
-
case 'DENIED_REQUEST_EXISTS':
|
|
45
|
-
return {
|
|
46
|
-
...requestAccess,
|
|
47
|
-
descriptiveMessageKey: 'request_denied_description'
|
|
48
|
-
};
|
|
49
|
-
default:
|
|
50
|
-
return requestAccess;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
5
|
export const extractRequestAccessContextImproved = ({
|
|
54
6
|
jsonLd,
|
|
55
7
|
url,
|
|
56
8
|
product,
|
|
57
9
|
createAnalyticsEvent
|
|
58
10
|
}) => {
|
|
59
|
-
var _jsonLd$
|
|
11
|
+
var _jsonLd$requestAccess;
|
|
60
12
|
const requestAccess = jsonLd !== null && jsonLd !== void 0 && jsonLd.requestAccess ? {
|
|
61
13
|
...(jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess),
|
|
62
14
|
hostname: extractHostname(url)
|
|
63
15
|
} : undefined;
|
|
64
|
-
switch (jsonLd === null || jsonLd === void 0 ? void 0 : (_jsonLd$
|
|
16
|
+
switch (jsonLd === null || jsonLd === void 0 ? void 0 : (_jsonLd$requestAccess = jsonLd.requestAccess) === null || _jsonLd$requestAccess === void 0 ? void 0 : _jsonLd$requestAccess.accessType) {
|
|
65
17
|
case 'DIRECT_ACCESS':
|
|
66
18
|
return {
|
|
67
19
|
...requestAccess,
|
|
@@ -69,12 +21,14 @@ export const extractRequestAccessContextImproved = ({
|
|
|
69
21
|
descriptiveMessageKey: 'direct_access_description',
|
|
70
22
|
callToActionMessageKey: 'direct_access',
|
|
71
23
|
action: ForbiddenAction(() => {
|
|
72
|
-
createAnalyticsEvent
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
24
|
+
if (createAnalyticsEvent !== undefined) {
|
|
25
|
+
createAnalyticsEvent({
|
|
26
|
+
action: 'clicked',
|
|
27
|
+
actionSubject: 'button',
|
|
28
|
+
actionSubjectId: 'crossJoin',
|
|
29
|
+
eventType: 'ui'
|
|
30
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
31
|
+
}
|
|
78
32
|
window.open(url);
|
|
79
33
|
}, 'direct_access', messages.direct_access, {
|
|
80
34
|
product
|
|
@@ -87,12 +41,14 @@ export const extractRequestAccessContextImproved = ({
|
|
|
87
41
|
descriptiveMessageKey: 'request_access_description',
|
|
88
42
|
callToActionMessageKey: 'request_access',
|
|
89
43
|
action: ForbiddenAction(() => {
|
|
90
|
-
createAnalyticsEvent
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
44
|
+
if (createAnalyticsEvent !== undefined) {
|
|
45
|
+
createAnalyticsEvent({
|
|
46
|
+
action: 'clicked',
|
|
47
|
+
actionSubject: 'button',
|
|
48
|
+
actionSubjectId: 'requestAccess',
|
|
49
|
+
eventType: 'ui'
|
|
50
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
51
|
+
}
|
|
96
52
|
window.open(url);
|
|
97
53
|
}, 'request_access', messages.request_access)
|
|
98
54
|
};
|
|
@@ -125,12 +81,14 @@ export const extractRequestAccessContextImproved = ({
|
|
|
125
81
|
descriptiveMessageKey: 'access_exists_description',
|
|
126
82
|
callToActionMessageKey: 'request_access',
|
|
127
83
|
action: ForbiddenAction(() => {
|
|
128
|
-
createAnalyticsEvent
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
84
|
+
if (createAnalyticsEvent !== undefined) {
|
|
85
|
+
createAnalyticsEvent({
|
|
86
|
+
action: 'clicked',
|
|
87
|
+
actionSubject: 'button',
|
|
88
|
+
actionSubjectId: 'requestAccess',
|
|
89
|
+
eventType: 'ui'
|
|
90
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
91
|
+
}
|
|
134
92
|
window.open(url);
|
|
135
93
|
}, 'access_exists', messages.request_access)
|
|
136
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { extractRequestAccessContextImproved } from './extractAccessContext';
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.
|
|
7
|
+
packageVersion: "26.51.0"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
|
|
4
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
5
|
import { getExtensionKey } from '../../state/helpers';
|
|
5
6
|
import { extractBlockProps } from '../../extractors/block';
|
|
6
7
|
import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
|
|
7
|
-
import {
|
|
8
|
+
import { extractRequestAccessContextImproved } from '../../extractors/common/context';
|
|
8
9
|
import { CardLinkView } from '../LinkView';
|
|
9
10
|
import { AuthorizeAction } from './actions/AuthorizeAction';
|
|
10
11
|
import { ForbiddenAction } from './actions/ForbiddenAction';
|
|
@@ -42,7 +43,10 @@ export const BlockCard = ({
|
|
|
42
43
|
enableFlexibleBlockCard,
|
|
43
44
|
actionOptions
|
|
44
45
|
}) => {
|
|
45
|
-
var _details$meta, _forbiddenViewProps$c;
|
|
46
|
+
var _details$meta, _forbiddenViewProps$c, _forbiddenViewProps$c2;
|
|
47
|
+
const {
|
|
48
|
+
createAnalyticsEvent
|
|
49
|
+
} = useAnalyticsEvents();
|
|
46
50
|
const {
|
|
47
51
|
status,
|
|
48
52
|
details
|
|
@@ -156,10 +160,11 @@ export const BlockCard = ({
|
|
|
156
160
|
}
|
|
157
161
|
const forbiddenViewProps = extractBlockProps(data, meta, extractorOpts);
|
|
158
162
|
const cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
159
|
-
const requestAccessContext =
|
|
163
|
+
const requestAccessContext = extractRequestAccessContextImproved({
|
|
160
164
|
jsonLd: cardMetadata,
|
|
161
165
|
url,
|
|
162
|
-
product: (_forbiddenViewProps$c = forbiddenViewProps.context) === null || _forbiddenViewProps$
|
|
166
|
+
product: (_forbiddenViewProps$c = (_forbiddenViewProps$c2 = forbiddenViewProps.context) === null || _forbiddenViewProps$c2 === void 0 ? void 0 : _forbiddenViewProps$c2.text) !== null && _forbiddenViewProps$c !== void 0 ? _forbiddenViewProps$c : '',
|
|
167
|
+
createAnalyticsEvent
|
|
163
168
|
});
|
|
164
169
|
return jsx(BlockCardForbiddenView, _extends({}, forbiddenViewProps, {
|
|
165
170
|
isSelected: isSelected,
|
|
@@ -46,9 +46,10 @@ export const ForbiddenView = ({
|
|
|
46
46
|
const {
|
|
47
47
|
action,
|
|
48
48
|
descriptiveMessageKey = 'invalid_permissions_description',
|
|
49
|
-
hostname = ''
|
|
49
|
+
hostname = '',
|
|
50
|
+
buttonDisabled
|
|
50
51
|
} = requestAccessContext;
|
|
51
|
-
const items = action ? [...actions, action] : actions;
|
|
52
|
+
const items = action !== undefined && !(buttonDisabled !== null && buttonDisabled !== void 0 ? buttonDisabled : false) ? [...actions, action] : actions;
|
|
52
53
|
return jsx(Frame, {
|
|
53
54
|
isSelected: isSelected,
|
|
54
55
|
testId: testId,
|
|
@@ -5,10 +5,13 @@ import React, { useContext } from 'react';
|
|
|
5
5
|
import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
6
6
|
import Text from '../text';
|
|
7
7
|
const SNIPPET_DEFAULT_MAX_LINES = 3;
|
|
8
|
-
const getSnippetStyles = overrideCss => css
|
|
9
|
-
color:
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const getSnippetStyles = overrideCss => css({
|
|
9
|
+
color: "var(--ds-text, #172B4D)",
|
|
10
|
+
WebkitUserSelect: 'text',
|
|
11
|
+
MozUserSelect: 'text',
|
|
12
|
+
MsUserSelect: 'text',
|
|
13
|
+
userSelect: 'text'
|
|
14
|
+
}, overrideCss);
|
|
12
15
|
const SnippetElement = ({
|
|
13
16
|
content: overrideContent,
|
|
14
17
|
maxLines = SNIPPET_DEFAULT_MAX_LINES,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SmartLinkStatus } from '../../constants';
|
|
2
2
|
import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
|
|
3
|
-
import {
|
|
3
|
+
import { extractRequestAccessContextImproved } from '../../extractors/common/context';
|
|
4
4
|
import { messages } from '../../messages';
|
|
5
5
|
import extractFlexibleUiContext from '../../extractors/flexible';
|
|
6
6
|
import { extractErrorIcon } from '../../extractors/flexible/icon';
|
|
@@ -60,7 +60,7 @@ const getForbiddenMessageKey = meta => {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
export const getRetryOptions = (url, status, response, onAuthorize) => {
|
|
63
|
-
var _response$meta, _access$action;
|
|
63
|
+
var _response$meta, _access$action, _access$buttonDisable;
|
|
64
64
|
const data = response && response.data || getEmptyJsonLd();
|
|
65
65
|
const provider = extractProvider(data);
|
|
66
66
|
const context = provider === null || provider === void 0 ? void 0 : provider.text;
|
|
@@ -70,15 +70,15 @@ export const getRetryOptions = (url, status, response, onAuthorize) => {
|
|
|
70
70
|
switch (status) {
|
|
71
71
|
case SmartLinkStatus.Forbidden:
|
|
72
72
|
const meta = (_response$meta = response === null || response === void 0 ? void 0 : response.meta) !== null && _response$meta !== void 0 ? _response$meta : getForbiddenJsonLd().meta;
|
|
73
|
-
const access =
|
|
73
|
+
const access = extractRequestAccessContextImproved({
|
|
74
74
|
jsonLd: meta,
|
|
75
75
|
url,
|
|
76
|
-
product: context
|
|
76
|
+
product: context !== null && context !== void 0 ? context : ''
|
|
77
77
|
});
|
|
78
78
|
const messageKey = getForbiddenMessageKey(meta);
|
|
79
79
|
const descriptor = messages[messageKey];
|
|
80
80
|
const retry = onAuthorize || (access === null || access === void 0 ? void 0 : (_access$action = access.action) === null || _access$action === void 0 ? void 0 : _access$action.promise);
|
|
81
|
-
const onClick = retry ? handleOnClick(retry) : undefined;
|
|
81
|
+
const onClick = retry && !((_access$buttonDisable = access === null || access === void 0 ? void 0 : access.buttonDisabled) !== null && _access$buttonDisable !== void 0 ? _access$buttonDisable : false) ? handleOnClick(retry) : undefined;
|
|
82
82
|
return {
|
|
83
83
|
descriptor,
|
|
84
84
|
onClick,
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "26.
|
|
10
|
+
packageVersion: "26.51.0",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -13,7 +13,11 @@ const AISummaryCSSStyles = css({
|
|
|
13
13
|
fontSize: '0.75rem',
|
|
14
14
|
lineHeight: '1rem',
|
|
15
15
|
wordWrap: 'break-word',
|
|
16
|
-
whiteSpace: 'normal'
|
|
16
|
+
whiteSpace: 'normal',
|
|
17
|
+
WebkitUserSelect: 'text',
|
|
18
|
+
MozUserSelect: 'text',
|
|
19
|
+
MsUserSelect: 'text',
|
|
20
|
+
userSelect: 'text'
|
|
17
21
|
});
|
|
18
22
|
/**
|
|
19
23
|
* A component to render a response from AI in markdown text.
|
|
@@ -5,73 +5,30 @@ import { messages } from '../../../messages';
|
|
|
5
5
|
import { ForbiddenAction } from '../../../view/BlockCard/actions/ForbiddenAction';
|
|
6
6
|
import extractHostname from '../hostname/extractHostname';
|
|
7
7
|
import { ANALYTICS_CHANNEL } from '../../../utils/analytics';
|
|
8
|
-
export var
|
|
8
|
+
export var extractRequestAccessContextImproved = function extractRequestAccessContextImproved(_ref) {
|
|
9
9
|
var _jsonLd$requestAccess;
|
|
10
10
|
var jsonLd = _ref.jsonLd,
|
|
11
11
|
url = _ref.url,
|
|
12
|
-
product = _ref.product
|
|
12
|
+
product = _ref.product,
|
|
13
|
+
createAnalyticsEvent = _ref.createAnalyticsEvent;
|
|
13
14
|
var requestAccess = jsonLd !== null && jsonLd !== void 0 && jsonLd.requestAccess ? _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
|
|
14
15
|
hostname: extractHostname(url)
|
|
15
16
|
}) : undefined;
|
|
16
17
|
switch (jsonLd === null || jsonLd === void 0 || (_jsonLd$requestAccess = jsonLd.requestAccess) === null || _jsonLd$requestAccess === void 0 ? void 0 : _jsonLd$requestAccess.accessType) {
|
|
17
|
-
case 'DIRECT_ACCESS':
|
|
18
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
19
|
-
callToActionMessageKey: 'click_to_join',
|
|
20
|
-
descriptiveMessageKey: 'click_to_join_description',
|
|
21
|
-
action: ForbiddenAction(function () {
|
|
22
|
-
return window.open(url);
|
|
23
|
-
}, 'click_to_join', messages.click_to_join, {
|
|
24
|
-
context: product
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
case 'REQUEST_ACCESS':
|
|
28
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
29
|
-
callToActionMessageKey: 'request_access',
|
|
30
|
-
descriptiveMessageKey: 'request_access_description',
|
|
31
|
-
action: ForbiddenAction(function () {
|
|
32
|
-
return window.open(url);
|
|
33
|
-
}, 'request_access', messages.request_access, {
|
|
34
|
-
product: product
|
|
35
|
-
})
|
|
36
|
-
});
|
|
37
|
-
case 'PENDING_REQUEST_EXISTS':
|
|
38
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
39
|
-
descriptiveMessageKey: 'request_access_pending_description'
|
|
40
|
-
});
|
|
41
|
-
case 'FORBIDDEN':
|
|
42
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
43
|
-
descriptiveMessageKey: 'forbidden_description'
|
|
44
|
-
});
|
|
45
|
-
case 'DENIED_REQUEST_EXISTS':
|
|
46
|
-
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
47
|
-
descriptiveMessageKey: 'request_denied_description'
|
|
48
|
-
});
|
|
49
|
-
default:
|
|
50
|
-
return requestAccess;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
export var extractRequestAccessContextImproved = function extractRequestAccessContextImproved(_ref2) {
|
|
54
|
-
var _jsonLd$requestAccess2;
|
|
55
|
-
var jsonLd = _ref2.jsonLd,
|
|
56
|
-
url = _ref2.url,
|
|
57
|
-
product = _ref2.product,
|
|
58
|
-
createAnalyticsEvent = _ref2.createAnalyticsEvent;
|
|
59
|
-
var requestAccess = jsonLd !== null && jsonLd !== void 0 && jsonLd.requestAccess ? _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
|
|
60
|
-
hostname: extractHostname(url)
|
|
61
|
-
}) : undefined;
|
|
62
|
-
switch (jsonLd === null || jsonLd === void 0 || (_jsonLd$requestAccess2 = jsonLd.requestAccess) === null || _jsonLd$requestAccess2 === void 0 ? void 0 : _jsonLd$requestAccess2.accessType) {
|
|
63
18
|
case 'DIRECT_ACCESS':
|
|
64
19
|
return _objectSpread(_objectSpread({}, requestAccess), {}, {
|
|
65
20
|
titleMessageKey: 'direct_access_title',
|
|
66
21
|
descriptiveMessageKey: 'direct_access_description',
|
|
67
22
|
callToActionMessageKey: 'direct_access',
|
|
68
23
|
action: ForbiddenAction(function () {
|
|
69
|
-
createAnalyticsEvent
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
24
|
+
if (createAnalyticsEvent !== undefined) {
|
|
25
|
+
createAnalyticsEvent({
|
|
26
|
+
action: 'clicked',
|
|
27
|
+
actionSubject: 'button',
|
|
28
|
+
actionSubjectId: 'crossJoin',
|
|
29
|
+
eventType: 'ui'
|
|
30
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
31
|
+
}
|
|
75
32
|
window.open(url);
|
|
76
33
|
}, 'direct_access', messages.direct_access, {
|
|
77
34
|
product: product
|
|
@@ -83,12 +40,14 @@ export var extractRequestAccessContextImproved = function extractRequestAccessCo
|
|
|
83
40
|
descriptiveMessageKey: 'request_access_description',
|
|
84
41
|
callToActionMessageKey: 'request_access',
|
|
85
42
|
action: ForbiddenAction(function () {
|
|
86
|
-
createAnalyticsEvent
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
43
|
+
if (createAnalyticsEvent !== undefined) {
|
|
44
|
+
createAnalyticsEvent({
|
|
45
|
+
action: 'clicked',
|
|
46
|
+
actionSubject: 'button',
|
|
47
|
+
actionSubjectId: 'requestAccess',
|
|
48
|
+
eventType: 'ui'
|
|
49
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
50
|
+
}
|
|
92
51
|
window.open(url);
|
|
93
52
|
}, 'request_access', messages.request_access)
|
|
94
53
|
});
|
|
@@ -119,12 +78,14 @@ export var extractRequestAccessContextImproved = function extractRequestAccessCo
|
|
|
119
78
|
descriptiveMessageKey: 'access_exists_description',
|
|
120
79
|
callToActionMessageKey: 'request_access',
|
|
121
80
|
action: ForbiddenAction(function () {
|
|
122
|
-
createAnalyticsEvent
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
81
|
+
if (createAnalyticsEvent !== undefined) {
|
|
82
|
+
createAnalyticsEvent({
|
|
83
|
+
action: 'clicked',
|
|
84
|
+
actionSubject: 'button',
|
|
85
|
+
actionSubjectId: 'requestAccess',
|
|
86
|
+
eventType: 'ui'
|
|
87
|
+
}).fire(ANALYTICS_CHANNEL);
|
|
88
|
+
}
|
|
128
89
|
window.open(url);
|
|
129
90
|
}, 'access_exists', messages.request_access)
|
|
130
91
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { extractRequestAccessContextImproved } from './extractAccessContext';
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "26.
|
|
18
|
+
packageVersion: "26.51.0"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
|
|
4
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
5
|
import { getExtensionKey } from '../../state/helpers';
|
|
5
6
|
import { extractBlockProps } from '../../extractors/block';
|
|
6
7
|
import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
|
|
7
|
-
import {
|
|
8
|
+
import { extractRequestAccessContextImproved } from '../../extractors/common/context';
|
|
8
9
|
import { CardLinkView } from '../LinkView';
|
|
9
10
|
import { AuthorizeAction } from './actions/AuthorizeAction';
|
|
10
11
|
import { ForbiddenAction } from './actions/ForbiddenAction';
|
|
@@ -24,7 +25,7 @@ import { handleClickCommon } from './utils/handlers';
|
|
|
24
25
|
export { default as PreviewAction } from './actions/PreviewAction';
|
|
25
26
|
export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
|
|
26
27
|
export var BlockCard = function BlockCard(_ref) {
|
|
27
|
-
var _details$meta, _forbiddenViewProps$c;
|
|
28
|
+
var _details$meta, _forbiddenViewProps$c, _forbiddenViewProps$c2;
|
|
28
29
|
var id = _ref.id,
|
|
29
30
|
url = _ref.url,
|
|
30
31
|
cardState = _ref.cardState,
|
|
@@ -42,6 +43,8 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
42
43
|
analytics = _ref.analytics,
|
|
43
44
|
enableFlexibleBlockCard = _ref.enableFlexibleBlockCard,
|
|
44
45
|
actionOptions = _ref.actionOptions;
|
|
46
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
47
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
45
48
|
var status = cardState.status,
|
|
46
49
|
details = cardState.details;
|
|
47
50
|
var data = details && details.data || getEmptyJsonLd();
|
|
@@ -155,10 +158,11 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
155
158
|
}
|
|
156
159
|
var forbiddenViewProps = extractBlockProps(data, meta, extractorOpts);
|
|
157
160
|
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
158
|
-
var requestAccessContext =
|
|
161
|
+
var requestAccessContext = extractRequestAccessContextImproved({
|
|
159
162
|
jsonLd: cardMetadata,
|
|
160
163
|
url: url,
|
|
161
|
-
product: (_forbiddenViewProps$c = forbiddenViewProps.context) === null || _forbiddenViewProps$
|
|
164
|
+
product: (_forbiddenViewProps$c = (_forbiddenViewProps$c2 = forbiddenViewProps.context) === null || _forbiddenViewProps$c2 === void 0 ? void 0 : _forbiddenViewProps$c2.text) !== null && _forbiddenViewProps$c !== void 0 ? _forbiddenViewProps$c : '',
|
|
165
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
162
166
|
});
|
|
163
167
|
return jsx(BlockCardForbiddenView, _extends({}, forbiddenViewProps, {
|
|
164
168
|
isSelected: isSelected,
|
|
@@ -56,8 +56,9 @@ export var ForbiddenView = function ForbiddenView(_ref) {
|
|
|
56
56
|
_requestAccessContext = requestAccessContext.descriptiveMessageKey,
|
|
57
57
|
descriptiveMessageKey = _requestAccessContext === void 0 ? 'invalid_permissions_description' : _requestAccessContext,
|
|
58
58
|
_requestAccessContext2 = requestAccessContext.hostname,
|
|
59
|
-
hostname = _requestAccessContext2 === void 0 ? '' : _requestAccessContext2
|
|
60
|
-
|
|
59
|
+
hostname = _requestAccessContext2 === void 0 ? '' : _requestAccessContext2,
|
|
60
|
+
buttonDisabled = requestAccessContext.buttonDisabled;
|
|
61
|
+
var items = action !== undefined && !(buttonDisabled !== null && buttonDisabled !== void 0 ? buttonDisabled : false) ? [].concat(_toConsumableArray(actions), [action]) : actions;
|
|
61
62
|
return jsx(Frame, {
|
|
62
63
|
isSelected: isSelected,
|
|
63
64
|
testId: testId,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
3
|
var _excluded = ["content", "maxLines", "overrideCss"];
|
|
5
|
-
var _templateObject;
|
|
6
4
|
/** @jsx jsx */
|
|
7
5
|
import { css, jsx } from '@emotion/react';
|
|
8
6
|
import React, { useContext } from 'react';
|
|
@@ -10,7 +8,13 @@ import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
|
10
8
|
import Text from '../text';
|
|
11
9
|
var SNIPPET_DEFAULT_MAX_LINES = 3;
|
|
12
10
|
var getSnippetStyles = function getSnippetStyles(overrideCss) {
|
|
13
|
-
return css(
|
|
11
|
+
return css({
|
|
12
|
+
color: "var(--ds-text, #172B4D)",
|
|
13
|
+
WebkitUserSelect: 'text',
|
|
14
|
+
MozUserSelect: 'text',
|
|
15
|
+
MsUserSelect: 'text',
|
|
16
|
+
userSelect: 'text'
|
|
17
|
+
}, overrideCss);
|
|
14
18
|
};
|
|
15
19
|
var SnippetElement = function SnippetElement() {
|
|
16
20
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SmartLinkStatus } from '../../constants';
|
|
2
2
|
import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
|
|
3
|
-
import {
|
|
3
|
+
import { extractRequestAccessContextImproved } from '../../extractors/common/context';
|
|
4
4
|
import { messages } from '../../messages';
|
|
5
5
|
import extractFlexibleUiContext from '../../extractors/flexible';
|
|
6
6
|
import { extractErrorIcon } from '../../extractors/flexible/icon';
|
|
@@ -59,7 +59,7 @@ var getForbiddenMessageKey = function getForbiddenMessageKey(meta) {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
export var getRetryOptions = function getRetryOptions(url, status, response, onAuthorize) {
|
|
62
|
-
var _response$meta, _access$action;
|
|
62
|
+
var _response$meta, _access$action, _access$buttonDisable;
|
|
63
63
|
var data = response && response.data || getEmptyJsonLd();
|
|
64
64
|
var provider = extractProvider(data);
|
|
65
65
|
var context = provider === null || provider === void 0 ? void 0 : provider.text;
|
|
@@ -69,15 +69,15 @@ export var getRetryOptions = function getRetryOptions(url, status, response, onA
|
|
|
69
69
|
switch (status) {
|
|
70
70
|
case SmartLinkStatus.Forbidden:
|
|
71
71
|
var meta = (_response$meta = response === null || response === void 0 ? void 0 : response.meta) !== null && _response$meta !== void 0 ? _response$meta : getForbiddenJsonLd().meta;
|
|
72
|
-
var access =
|
|
72
|
+
var access = extractRequestAccessContextImproved({
|
|
73
73
|
jsonLd: meta,
|
|
74
74
|
url: url,
|
|
75
|
-
product: context
|
|
75
|
+
product: context !== null && context !== void 0 ? context : ''
|
|
76
76
|
});
|
|
77
77
|
var messageKey = getForbiddenMessageKey(meta);
|
|
78
78
|
var descriptor = messages[messageKey];
|
|
79
79
|
var retry = onAuthorize || (access === null || access === void 0 || (_access$action = access.action) === null || _access$action === void 0 ? void 0 : _access$action.promise);
|
|
80
|
-
var onClick = retry ? handleOnClick(retry) : undefined;
|
|
80
|
+
var onClick = retry && !((_access$buttonDisable = access === null || access === void 0 ? void 0 : access.buttonDisabled) !== null && _access$buttonDisable !== void 0 ? _access$buttonDisable : false) ? handleOnClick(retry) : undefined;
|
|
81
81
|
return {
|
|
82
82
|
descriptor: descriptor,
|
|
83
83
|
onClick: onClick,
|
|
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
10
10
|
import LinkWarningModal from './LinkWarningModal';
|
|
11
11
|
var PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "26.
|
|
13
|
+
packageVersion: "26.51.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -15,7 +15,11 @@ var AISummaryCSSStyles = css({
|
|
|
15
15
|
fontSize: '0.75rem',
|
|
16
16
|
lineHeight: '1rem',
|
|
17
17
|
wordWrap: 'break-word',
|
|
18
|
-
whiteSpace: 'normal'
|
|
18
|
+
whiteSpace: 'normal',
|
|
19
|
+
WebkitUserSelect: 'text',
|
|
20
|
+
MozUserSelect: 'text',
|
|
21
|
+
MsUserSelect: 'text',
|
|
22
|
+
userSelect: 'text'
|
|
19
23
|
});
|
|
20
24
|
/**
|
|
21
25
|
* A component to render a response from AI in markdown text.
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
2
|
import { RequestAccessContextProps } from '../../../view/types';
|
|
3
3
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
export declare const extractRequestAccessContext: ({ jsonLd, url, product, }: {
|
|
5
|
-
jsonLd: JsonLd.Meta.BaseMeta;
|
|
6
|
-
url: string;
|
|
7
|
-
product?: string | undefined;
|
|
8
|
-
}) => RequestAccessContextProps;
|
|
9
4
|
export declare const extractRequestAccessContextImproved: ({ jsonLd, url, product, createAnalyticsEvent, }: {
|
|
10
5
|
jsonLd: JsonLd.Meta.BaseMeta;
|
|
11
6
|
url: string;
|
|
12
7
|
product: string;
|
|
13
|
-
createAnalyticsEvent
|
|
8
|
+
createAnalyticsEvent?: CreateUIAnalyticsEvent | undefined;
|
|
14
9
|
}) => RequestAccessContextProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { extractRequestAccessContextImproved } from './extractAccessContext';
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
2
|
import { RequestAccessContextProps } from '../../../view/types';
|
|
3
3
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
export declare const extractRequestAccessContext: ({ jsonLd, url, product, }: {
|
|
5
|
-
jsonLd: JsonLd.Meta.BaseMeta;
|
|
6
|
-
url: string;
|
|
7
|
-
product?: string | undefined;
|
|
8
|
-
}) => RequestAccessContextProps;
|
|
9
4
|
export declare const extractRequestAccessContextImproved: ({ jsonLd, url, product, createAnalyticsEvent, }: {
|
|
10
5
|
jsonLd: JsonLd.Meta.BaseMeta;
|
|
11
6
|
url: string;
|
|
12
7
|
product: string;
|
|
13
|
-
createAnalyticsEvent
|
|
8
|
+
createAnalyticsEvent?: CreateUIAnalyticsEvent | undefined;
|
|
14
9
|
}) => RequestAccessContextProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { extractRequestAccessContextImproved } from './extractAccessContext';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.51.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
53
53
|
"@atlaskit/popup": "^1.14.0",
|
|
54
|
-
"@atlaskit/primitives": "^5.
|
|
54
|
+
"@atlaskit/primitives": "^5.3.0",
|
|
55
55
|
"@atlaskit/spinner": "^16.0.0",
|
|
56
56
|
"@atlaskit/theme": "^12.7.0",
|
|
57
57
|
"@atlaskit/tokens": "^1.42.0",
|