@atlaskit/smart-card 43.1.0 → 43.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.js +7 -18
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.js +4 -16
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.js +6 -16
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.d.ts +1 -2
- package/dist/types-ts4.5/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.d.ts +1 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9fa4acd606891`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9fa4acd606891) -
|
|
8
|
+
Remove experiment gate for sharepoint and google hyperlink resolve
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 43.1.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
6
|
+
exports.shouldResolveUrl = exports.default = void 0;
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
10
8
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
11
|
-
var
|
|
9
|
+
var allowedHostnames = ['sharepoint.com', 'onedrive.live.com', 'docs.google.com', 'drive.google.com'];
|
|
10
|
+
var shouldResolveUrl = exports.shouldResolveUrl = function shouldResolveUrl(href) {
|
|
12
11
|
try {
|
|
13
12
|
var hostname = new URL(href).hostname.toLowerCase();
|
|
14
|
-
return
|
|
13
|
+
return allowedHostnames.some(function (allowedHostname) {
|
|
14
|
+
return hostname.includes(allowedHostname);
|
|
15
|
+
});
|
|
15
16
|
} catch (_unused) {
|
|
16
17
|
return false;
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
|
-
var isGoogleDomain = exports.isGoogleDomain = function isGoogleDomain(href) {
|
|
20
|
-
try {
|
|
21
|
-
var hostname = new URL(href).hostname.toLowerCase();
|
|
22
|
-
return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
|
|
23
|
-
} catch (_unused2) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
20
|
var useResolveHyperlinkValidator = function useResolveHyperlinkValidator() {
|
|
28
21
|
var href = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
29
22
|
var hasSmartCardProvider = !!(0, _react.useContext)(_linkProvider.SmartCardContext);
|
|
30
|
-
|
|
31
|
-
var isGoogleResolveEnabled = _featureGateJsClient.default.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
|
|
32
|
-
var shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
|
|
33
|
-
var shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
|
|
34
|
-
return hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
|
|
23
|
+
return hasSmartCardProvider && shouldResolveUrl(href);
|
|
35
24
|
};
|
|
36
25
|
var _default = exports.default = useResolveHyperlinkValidator;
|
|
@@ -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: "
|
|
14
|
+
packageVersion: "43.1.0"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -230,7 +230,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
230
230
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
231
231
|
ref: parentSpan
|
|
232
232
|
}, /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, triggerProps, {
|
|
233
|
-
// eslint-disable-next-line
|
|
233
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
234
234
|
onMouseOver: initShowCard
|
|
235
235
|
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
236
236
|
,
|
|
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
22
22
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
23
23
|
var PACKAGE_DATA = {
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "
|
|
25
|
+
packageVersion: "43.1.0",
|
|
26
26
|
componentName: 'linkUrl'
|
|
27
27
|
};
|
|
28
28
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
3
2
|
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
4
|
-
|
|
3
|
+
const allowedHostnames = ['sharepoint.com', 'onedrive.live.com', 'docs.google.com', 'drive.google.com'];
|
|
4
|
+
export const shouldResolveUrl = href => {
|
|
5
5
|
try {
|
|
6
6
|
const hostname = new URL(href).hostname.toLowerCase();
|
|
7
|
-
return
|
|
8
|
-
} catch {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export const isGoogleDomain = href => {
|
|
13
|
-
try {
|
|
14
|
-
const hostname = new URL(href).hostname.toLowerCase();
|
|
15
|
-
return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
|
|
7
|
+
return allowedHostnames.some(allowedHostname => hostname.includes(allowedHostname));
|
|
16
8
|
} catch {
|
|
17
9
|
return false;
|
|
18
10
|
}
|
|
19
11
|
};
|
|
20
12
|
const useResolveHyperlinkValidator = (href = '') => {
|
|
21
13
|
const hasSmartCardProvider = !!useContext(SmartCardContext);
|
|
22
|
-
|
|
23
|
-
const isGoogleResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
|
|
24
|
-
const shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
|
|
25
|
-
const shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
|
|
26
|
-
return hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
|
|
14
|
+
return hasSmartCardProvider && shouldResolveUrl(href);
|
|
27
15
|
};
|
|
28
16
|
export default useResolveHyperlinkValidator;
|
|
@@ -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: "
|
|
5
|
+
packageVersion: "43.1.0"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -207,7 +207,7 @@ export const HoverCardComponent = ({
|
|
|
207
207
|
}) => /*#__PURE__*/React.createElement("span", {
|
|
208
208
|
ref: parentSpan
|
|
209
209
|
}, /*#__PURE__*/React.createElement("span", _extends({}, triggerProps, {
|
|
210
|
-
// eslint-disable-next-line
|
|
210
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
211
211
|
onMouseOver: initShowCard
|
|
212
212
|
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
213
213
|
,
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
const PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "
|
|
15
|
+
packageVersion: "43.1.0",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
3
2
|
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
4
|
-
|
|
3
|
+
var allowedHostnames = ['sharepoint.com', 'onedrive.live.com', 'docs.google.com', 'drive.google.com'];
|
|
4
|
+
export var shouldResolveUrl = function shouldResolveUrl(href) {
|
|
5
5
|
try {
|
|
6
6
|
var hostname = new URL(href).hostname.toLowerCase();
|
|
7
|
-
return
|
|
7
|
+
return allowedHostnames.some(function (allowedHostname) {
|
|
8
|
+
return hostname.includes(allowedHostname);
|
|
9
|
+
});
|
|
8
10
|
} catch (_unused) {
|
|
9
11
|
return false;
|
|
10
12
|
}
|
|
11
13
|
};
|
|
12
|
-
export var isGoogleDomain = function isGoogleDomain(href) {
|
|
13
|
-
try {
|
|
14
|
-
var hostname = new URL(href).hostname.toLowerCase();
|
|
15
|
-
return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
|
|
16
|
-
} catch (_unused2) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
14
|
var useResolveHyperlinkValidator = function useResolveHyperlinkValidator() {
|
|
21
15
|
var href = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
22
16
|
var hasSmartCardProvider = !!useContext(SmartCardContext);
|
|
23
|
-
|
|
24
|
-
var isGoogleResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
|
|
25
|
-
var shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
|
|
26
|
-
var shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
|
|
27
|
-
return hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
|
|
17
|
+
return hasSmartCardProvider && shouldResolveUrl(href);
|
|
28
18
|
};
|
|
29
19
|
export default useResolveHyperlinkValidator;
|
|
@@ -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: "
|
|
7
|
+
packageVersion: "43.1.0"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -221,7 +221,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
221
221
|
return /*#__PURE__*/React.createElement("span", {
|
|
222
222
|
ref: parentSpan
|
|
223
223
|
}, /*#__PURE__*/React.createElement("span", _extends({}, triggerProps, {
|
|
224
|
-
// eslint-disable-next-line
|
|
224
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
225
225
|
onMouseOver: initShowCard
|
|
226
226
|
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
227
227
|
,
|
|
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
15
15
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
16
16
|
var PACKAGE_DATA = {
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "
|
|
18
|
+
packageVersion: "43.1.0",
|
|
19
19
|
componentName: 'linkUrl'
|
|
20
20
|
};
|
|
21
21
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const isGoogleDomain: (href: string) => boolean;
|
|
1
|
+
export declare const shouldResolveUrl: (href: string) => boolean;
|
|
3
2
|
declare const useResolveHyperlinkValidator: (href?: string) => boolean;
|
|
4
3
|
export default useResolveHyperlinkValidator;
|
package/dist/types-ts4.5/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const isGoogleDomain: (href: string) => boolean;
|
|
1
|
+
export declare const shouldResolveUrl: (href: string) => boolean;
|
|
3
2
|
declare const useResolveHyperlinkValidator: (href?: string) => boolean;
|
|
4
3
|
export default useResolveHyperlinkValidator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "43.1.
|
|
3
|
+
"version": "43.1.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@atlaskit/logo": "^19.9.0",
|
|
60
60
|
"@atlaskit/lozenge": "^13.0.0",
|
|
61
61
|
"@atlaskit/menu": "^8.4.0",
|
|
62
|
-
"@atlaskit/modal-dialog": "^14.
|
|
62
|
+
"@atlaskit/modal-dialog": "^14.5.0",
|
|
63
63
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
64
64
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
65
65
|
"@atlaskit/popup": "^4.4.0",
|