@atlaskit/smart-card 43.1.3 → 43.1.4

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b692539d43044`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b692539d43044) -
8
+ [ux] Adjust hyperlink connect button logic to not show if the url is embedded in text
9
+ - Updated dependencies
10
+
3
11
  ## 43.1.3
4
12
 
5
13
  ### 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: "43.1.2"
14
+ packageVersion: "0.0.0-development"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -58,7 +58,27 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
58
58
  var onAuthorize = (0, _react.useCallback)(function () {
59
59
  return actions.authorize('hyperlink');
60
60
  }, [actions]);
61
- if ((state === null || state === void 0 ? void 0 : state.status) === 'unauthorized' && (_featureGateJsClient.default.getExperimentValue('platform_linking_bluelink_connect_confluence', 'isEnabled', false) || _featureGateJsClient.default.getExperimentValue('platform_linking_bluelink_connect_jira', 'isEnabled', false))) {
61
+ var shouldRenderConnectBtn = function shouldRenderConnectBtn() {
62
+ if (!props.children || !Array.isArray(props.children) || props.children.length === 0) {
63
+ return false;
64
+ }
65
+ var firstChild = props.children[0];
66
+ try {
67
+ var _firstChild$props;
68
+ // Check if first child has a string matching href
69
+ if (typeof firstChild === 'string') {
70
+ return props.href === firstChild;
71
+ }
72
+
73
+ // Check if first child has another child object containing matching href. This aligns with the behavior of the TextWrapper component used by editor to render link nodes
74
+ if (firstChild !== null && firstChild !== void 0 && (_firstChild$props = firstChild.props) !== null && _firstChild$props !== void 0 && _firstChild$props.children && typeof firstChild.props.children === 'string') {
75
+ return props.href === firstChild.props.children;
76
+ }
77
+ } catch (_) {
78
+ return false;
79
+ }
80
+ };
81
+ if ((state === null || state === void 0 ? void 0 : state.status) === 'unauthorized' && shouldRenderConnectBtn() && (_featureGateJsClient.default.getExperimentValue('platform_linking_bluelink_connect_confluence', 'isEnabled', false) || _featureGateJsClient.default.getExperimentValue('platform_linking_bluelink_connect_jira', 'isEnabled', false))) {
62
82
  var provider = (0, _linkExtractors.extractSmartLinkProvider)(state === null || state === void 0 ? void 0 : state.details);
63
83
  return /*#__PURE__*/_react.default.createElement(_unauthorizeView.default, (0, _extends2.default)({}, props, {
64
84
  onAuthorize: services !== null && services !== void 0 && services.length ? onAuthorize : undefined,
@@ -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: "43.1.2",
25
+ packageVersion: "0.0.0-development",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  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: "43.1.2"
5
+ packageVersion: "0.0.0-development"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -43,7 +43,27 @@ const HyperlinkWithSmartLinkResolverInner = ({
43
43
  onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(e);
44
44
  }, [onClickCallback, fire3PClickEvent, state === null || state === void 0 ? void 0 : state.status]);
45
45
  const onAuthorize = useCallback(() => actions.authorize('hyperlink'), [actions]);
46
- if ((state === null || state === void 0 ? void 0 : state.status) === 'unauthorized' && (FeatureGates.getExperimentValue('platform_linking_bluelink_connect_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_linking_bluelink_connect_jira', 'isEnabled', false))) {
46
+ const shouldRenderConnectBtn = () => {
47
+ if (!props.children || !Array.isArray(props.children) || props.children.length === 0) {
48
+ return false;
49
+ }
50
+ const firstChild = props.children[0];
51
+ try {
52
+ var _firstChild$props;
53
+ // Check if first child has a string matching href
54
+ if (typeof firstChild === 'string') {
55
+ return props.href === firstChild;
56
+ }
57
+
58
+ // Check if first child has another child object containing matching href. This aligns with the behavior of the TextWrapper component used by editor to render link nodes
59
+ if (firstChild !== null && firstChild !== void 0 && (_firstChild$props = firstChild.props) !== null && _firstChild$props !== void 0 && _firstChild$props.children && typeof firstChild.props.children === 'string') {
60
+ return props.href === firstChild.props.children;
61
+ }
62
+ } catch (_) {
63
+ return false;
64
+ }
65
+ };
66
+ if ((state === null || state === void 0 ? void 0 : state.status) === 'unauthorized' && shouldRenderConnectBtn() && (FeatureGates.getExperimentValue('platform_linking_bluelink_connect_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_linking_bluelink_connect_jira', 'isEnabled', false))) {
47
67
  const provider = extractSmartLinkProvider(state === null || state === void 0 ? void 0 : state.details);
48
68
  return /*#__PURE__*/React.createElement(HyperlinkUnauthorizedView, _extends({}, props, {
49
69
  onAuthorize: services !== null && services !== void 0 && services.length ? onAuthorize : undefined,
@@ -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: "43.1.2",
15
+ packageVersion: "0.0.0-development",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  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: "43.1.2"
7
+ packageVersion: "0.0.0-development"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -49,7 +49,27 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
49
49
  var onAuthorize = useCallback(function () {
50
50
  return actions.authorize('hyperlink');
51
51
  }, [actions]);
52
- if ((state === null || state === void 0 ? void 0 : state.status) === 'unauthorized' && (FeatureGates.getExperimentValue('platform_linking_bluelink_connect_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_linking_bluelink_connect_jira', 'isEnabled', false))) {
52
+ var shouldRenderConnectBtn = function shouldRenderConnectBtn() {
53
+ if (!props.children || !Array.isArray(props.children) || props.children.length === 0) {
54
+ return false;
55
+ }
56
+ var firstChild = props.children[0];
57
+ try {
58
+ var _firstChild$props;
59
+ // Check if first child has a string matching href
60
+ if (typeof firstChild === 'string') {
61
+ return props.href === firstChild;
62
+ }
63
+
64
+ // Check if first child has another child object containing matching href. This aligns with the behavior of the TextWrapper component used by editor to render link nodes
65
+ if (firstChild !== null && firstChild !== void 0 && (_firstChild$props = firstChild.props) !== null && _firstChild$props !== void 0 && _firstChild$props.children && typeof firstChild.props.children === 'string') {
66
+ return props.href === firstChild.props.children;
67
+ }
68
+ } catch (_) {
69
+ return false;
70
+ }
71
+ };
72
+ if ((state === null || state === void 0 ? void 0 : state.status) === 'unauthorized' && shouldRenderConnectBtn() && (FeatureGates.getExperimentValue('platform_linking_bluelink_connect_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_linking_bluelink_connect_jira', 'isEnabled', false))) {
53
73
  var provider = extractSmartLinkProvider(state === null || state === void 0 ? void 0 : state.details);
54
74
  return /*#__PURE__*/React.createElement(HyperlinkUnauthorizedView, _extends({}, props, {
55
75
  onAuthorize: services !== null && services !== void 0 && services.length ? onAuthorize : undefined,
@@ -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: "43.1.2",
18
+ packageVersion: "0.0.0-development",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "43.1.3",
3
+ "version": "43.1.4",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -70,7 +70,7 @@
70
70
  "@atlaskit/textarea": "^8.0.0",
71
71
  "@atlaskit/textfield": "^8.0.0",
72
72
  "@atlaskit/theme": "^21.0.0",
73
- "@atlaskit/tmp-editor-statsig": "^13.6.0",
73
+ "@atlaskit/tmp-editor-statsig": "^13.9.0",
74
74
  "@atlaskit/tokens": "^6.4.0",
75
75
  "@atlaskit/tooltip": "^20.5.0",
76
76
  "@atlaskit/ufo": "^0.4.0",