@atlaskit/smart-card 40.21.1 → 40.22.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/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/index.js +17 -5
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/index.js +16 -4
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/LinkUrl/HyperlinkResolver/index.js +16 -4
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/LinkUrl/HyperlinkResolver/index.d.ts +0 -1
- package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/index.d.ts +0 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 40.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`05e3ebc53b525`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/05e3ebc53b525) -
|
|
8
|
+
Add logic to resolve hyperlinks which match a google domain
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 40.21.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "40.21.
|
|
14
|
+
packageVersion: "40.21.1"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -5,26 +5,38 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
11
11
|
var _state = require("../../../state");
|
|
12
12
|
var _errorBoundary = _interopRequireDefault(require("./error-boundary"));
|
|
13
13
|
var _resolveHyperlink = require("./resolve-hyperlink");
|
|
14
14
|
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); }
|
|
15
|
-
var isSharePointDomain =
|
|
15
|
+
var isSharePointDomain = function isSharePointDomain(href) {
|
|
16
16
|
try {
|
|
17
17
|
var hostname = new URL(href).hostname.toLowerCase();
|
|
18
|
-
return hostname.includes('sharepoint.com') || hostname.includes('onedrive.
|
|
18
|
+
return hostname.includes('sharepoint.com') || hostname.includes('onedrive.live.com');
|
|
19
19
|
} catch (_unused) {
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
var isGoogleDomain = function isGoogleDomain(href) {
|
|
24
|
+
try {
|
|
25
|
+
var hostname = new URL(href).hostname.toLowerCase();
|
|
26
|
+
return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
|
|
27
|
+
} catch (_unused2) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
23
31
|
var HyperlinkResolver = function HyperlinkResolver(_ref) {
|
|
24
32
|
var href = _ref.href;
|
|
25
33
|
var hasSmartCardProvider = !!(0, _react.useContext)(_state.SmartCardContext);
|
|
26
|
-
var
|
|
27
|
-
|
|
34
|
+
var isSharePointResolveEnabled = _featureGateJsClient.default.getExperimentValue('platform_editor_resolve_hyperlinks_confluence', 'isEnabled', false) || _featureGateJsClient.default.getExperimentValue('platform_editor_resolve_hyperlinks_jira', 'isEnabled', false);
|
|
35
|
+
var isGoogleResolveEnabled = _featureGateJsClient.default.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
|
|
36
|
+
var shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
|
|
37
|
+
var shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
|
|
38
|
+
var shouldResolveHyperlink = hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
|
|
39
|
+
if (!shouldResolveHyperlink) {
|
|
28
40
|
return null;
|
|
29
41
|
}
|
|
30
42
|
return /*#__PURE__*/_react.default.createElement(_resolveHyperlink.ResolveHyperlink, {
|
|
@@ -21,7 +21,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
21
21
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
22
22
|
var PACKAGE_DATA = {
|
|
23
23
|
packageName: "@atlaskit/smart-card",
|
|
24
|
-
packageVersion: "40.21.
|
|
24
|
+
packageVersion: "40.21.1",
|
|
25
25
|
componentName: 'linkUrl'
|
|
26
26
|
};
|
|
27
27
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "40.21.
|
|
5
|
+
packageVersion: "40.21.1"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,10 +3,18 @@ import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
|
3
3
|
import { SmartCardContext } from '../../../state';
|
|
4
4
|
import withErrorBoundary from './error-boundary';
|
|
5
5
|
import { ResolveHyperlink } from './resolve-hyperlink';
|
|
6
|
-
|
|
6
|
+
const isSharePointDomain = href => {
|
|
7
7
|
try {
|
|
8
8
|
const hostname = new URL(href).hostname.toLowerCase();
|
|
9
|
-
return hostname.includes('sharepoint.com') || hostname.includes('onedrive.
|
|
9
|
+
return hostname.includes('sharepoint.com') || hostname.includes('onedrive.live.com');
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const isGoogleDomain = href => {
|
|
15
|
+
try {
|
|
16
|
+
const hostname = new URL(href).hostname.toLowerCase();
|
|
17
|
+
return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
|
|
10
18
|
} catch {
|
|
11
19
|
return false;
|
|
12
20
|
}
|
|
@@ -15,8 +23,12 @@ const HyperlinkResolver = ({
|
|
|
15
23
|
href
|
|
16
24
|
}) => {
|
|
17
25
|
const hasSmartCardProvider = !!useContext(SmartCardContext);
|
|
18
|
-
const
|
|
19
|
-
|
|
26
|
+
const isSharePointResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_jira', 'isEnabled', false);
|
|
27
|
+
const isGoogleResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
|
|
28
|
+
const shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
|
|
29
|
+
const shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
|
|
30
|
+
const shouldResolveHyperlink = hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
|
|
31
|
+
if (!shouldResolveHyperlink) {
|
|
20
32
|
return null;
|
|
21
33
|
}
|
|
22
34
|
return /*#__PURE__*/React.createElement(ResolveHyperlink, {
|
|
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
11
11
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
12
12
|
const PACKAGE_DATA = {
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "40.21.
|
|
14
|
+
packageVersion: "40.21.1",
|
|
15
15
|
componentName: 'linkUrl'
|
|
16
16
|
};
|
|
17
17
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "40.21.
|
|
7
|
+
packageVersion: "40.21.1"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,19 +3,31 @@ import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
|
3
3
|
import { SmartCardContext } from '../../../state';
|
|
4
4
|
import withErrorBoundary from './error-boundary';
|
|
5
5
|
import { ResolveHyperlink } from './resolve-hyperlink';
|
|
6
|
-
|
|
6
|
+
var isSharePointDomain = function isSharePointDomain(href) {
|
|
7
7
|
try {
|
|
8
8
|
var hostname = new URL(href).hostname.toLowerCase();
|
|
9
|
-
return hostname.includes('sharepoint.com') || hostname.includes('onedrive.
|
|
9
|
+
return hostname.includes('sharepoint.com') || hostname.includes('onedrive.live.com');
|
|
10
10
|
} catch (_unused) {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
+
var isGoogleDomain = function isGoogleDomain(href) {
|
|
15
|
+
try {
|
|
16
|
+
var hostname = new URL(href).hostname.toLowerCase();
|
|
17
|
+
return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
|
|
18
|
+
} catch (_unused2) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
14
22
|
var HyperlinkResolver = function HyperlinkResolver(_ref) {
|
|
15
23
|
var href = _ref.href;
|
|
16
24
|
var hasSmartCardProvider = !!useContext(SmartCardContext);
|
|
17
|
-
var
|
|
18
|
-
|
|
25
|
+
var isSharePointResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_jira', 'isEnabled', false);
|
|
26
|
+
var isGoogleResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
|
|
27
|
+
var shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
|
|
28
|
+
var shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
|
|
29
|
+
var shouldResolveHyperlink = hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
|
|
30
|
+
if (!shouldResolveHyperlink) {
|
|
19
31
|
return null;
|
|
20
32
|
}
|
|
21
33
|
return /*#__PURE__*/React.createElement(ResolveHyperlink, {
|
|
@@ -14,7 +14,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
14
14
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
15
15
|
var PACKAGE_DATA = {
|
|
16
16
|
packageName: "@atlaskit/smart-card",
|
|
17
|
-
packageVersion: "40.21.
|
|
17
|
+
packageVersion: "40.21.1",
|
|
18
18
|
componentName: 'linkUrl'
|
|
19
19
|
};
|
|
20
20
|
var Anchor = withLinkClickedEvent('a');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.22.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"@atlaskit/spinner": "^19.0.0",
|
|
68
68
|
"@atlaskit/textarea": "^8.0.0",
|
|
69
69
|
"@atlaskit/textfield": "^8.0.0",
|
|
70
|
-
"@atlaskit/theme": "^
|
|
71
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
70
|
+
"@atlaskit/theme": "^21.0.0",
|
|
71
|
+
"@atlaskit/tmp-editor-statsig": "^12.10.0",
|
|
72
72
|
"@atlaskit/tokens": "^6.3.0",
|
|
73
73
|
"@atlaskit/tooltip": "^20.4.0",
|
|
74
74
|
"@atlaskit/ufo": "^0.4.0",
|