@atlaskit/smart-card 43.1.2 → 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,20 @@
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
+
11
+ ## 43.1.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [`2c3e300807c81`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2c3e300807c81) -
16
+ NAVX-1902 cleaning up `navx-1842-sl-unnecessary-textual-description-for-decorative-images`
17
+
3
18
  ## 43.1.2
4
19
 
5
20
  ### Patch Changes
@@ -98,15 +98,14 @@ var LozengeActionTrigger = function LozengeActionTrigger(_ref) {
98
98
  }, /*#__PURE__*/React.createElement("span", null, text), /*#__PURE__*/React.createElement(_compiled.Box, {
99
99
  as: "span",
100
100
  xcss: styles.chevronDown
101
- }, /*#__PURE__*/React.createElement(_chevronDown.default, (0, _extends2.default)({
101
+ }, /*#__PURE__*/React.createElement(_chevronDown.default, {
102
102
  color: "currentColor",
103
103
  label: "options",
104
104
  LEGACY_size: "medium",
105
105
  LEGACY_margin: "-4px -8px -4px -7px",
106
- size: "small"
107
- }, (0, _platformFeatureFlags.fg)('navx-1842-hiding-unnecessary-image-descriptions') ? {
108
- 'aria-hidden': true
109
- } : {}))))));
106
+ size: "small",
107
+ "aria-hidden": true
108
+ })))));
110
109
  }, [appearance, isHovering, isPressing, text, isOpen, lozengeBackgroundColor, lozengeForegroundColor]);
111
110
  return /*#__PURE__*/React.createElement("button", (0, _extends2.default)({
112
111
  type: "button"
@@ -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,
@@ -68,15 +68,14 @@ const LozengeActionTrigger = ({
68
68
  }, /*#__PURE__*/React.createElement("span", null, text), /*#__PURE__*/React.createElement(Box, {
69
69
  as: "span",
70
70
  xcss: styles.chevronDown
71
- }, /*#__PURE__*/React.createElement(ChevronDownIcon, _extends({
71
+ }, /*#__PURE__*/React.createElement(ChevronDownIcon, {
72
72
  color: "currentColor",
73
73
  label: "options",
74
74
  LEGACY_size: "medium",
75
75
  LEGACY_margin: "-4px -8px -4px -7px",
76
- size: "small"
77
- }, fg('navx-1842-hiding-unnecessary-image-descriptions') ? {
78
- 'aria-hidden': true
79
- } : {}))))));
76
+ size: "small",
77
+ "aria-hidden": true
78
+ })))));
80
79
  }, [appearance, isHovering, isPressing, text, isOpen, lozengeBackgroundColor, lozengeForegroundColor]);
81
80
  return /*#__PURE__*/React.createElement("button", _extends({
82
81
  type: "button"
@@ -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,
@@ -90,15 +90,14 @@ var LozengeActionTrigger = function LozengeActionTrigger(_ref) {
90
90
  }, /*#__PURE__*/React.createElement("span", null, text), /*#__PURE__*/React.createElement(Box, {
91
91
  as: "span",
92
92
  xcss: styles.chevronDown
93
- }, /*#__PURE__*/React.createElement(ChevronDownIcon, _extends({
93
+ }, /*#__PURE__*/React.createElement(ChevronDownIcon, {
94
94
  color: "currentColor",
95
95
  label: "options",
96
96
  LEGACY_size: "medium",
97
97
  LEGACY_margin: "-4px -8px -4px -7px",
98
- size: "small"
99
- }, fg('navx-1842-hiding-unnecessary-image-descriptions') ? {
100
- 'aria-hidden': true
101
- } : {}))))));
98
+ size: "small",
99
+ "aria-hidden": true
100
+ })))));
102
101
  }, [appearance, isHovering, isPressing, text, isOpen, lozengeBackgroundColor, lozengeForegroundColor]);
103
102
  return /*#__PURE__*/React.createElement("button", _extends({
104
103
  type: "button"
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "43.1.2",
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",
@@ -226,9 +226,6 @@
226
226
  "navx-1706-smart-link-layered-link-a11y-update": {
227
227
  "type": "boolean"
228
228
  },
229
- "navx-1842-hiding-unnecessary-image-descriptions": {
230
- "type": "boolean"
231
- },
232
229
  "hover-card-on-visibility-change-callback": {
233
230
  "type": "boolean"
234
231
  },