@atlaskit/smart-card 44.9.9 → 44.9.11
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 +18 -0
- package/analytics.spec.yaml +0 -8
- package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-with-all-card-examples-in-text--default--jfp-magma-platform-lozenge-jump-fix-false.png +0 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-with-all-card-examples-in-text--default--jfp-magma-platform-lozenge-jump-fix-true.png +0 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-default-state--default.png +0 -0
- package/dist/cjs/state/hooks/use-intersection-observer/index.js +2 -1
- package/dist/cjs/state/hooks/use-smart-link-seen-event/index.js +66 -0
- package/dist/cjs/state/hooks/use-social-proof-experiment/index.js +3 -41
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +31 -8
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +9 -18
- package/dist/cjs/view/CardWithUrl/card-intersection-observer/index.js +25 -20
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +24 -4
- package/dist/cjs/view/CardWithUrl/component.js +4 -47
- package/dist/cjs/view/InlineCard/Frame/index.js +3 -2
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/index.js +0 -41
- package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-with-all-card-examples-in-text--default--jfp-magma-platform-lozenge-jump-fix-false.png +0 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-with-all-card-examples-in-text--default--jfp-magma-platform-lozenge-jump-fix-true.png +0 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-default-state--default.png +0 -0
- package/dist/es2019/state/hooks/use-intersection-observer/index.js +2 -1
- package/dist/es2019/state/hooks/use-smart-link-seen-event/index.js +60 -0
- package/dist/es2019/state/hooks/use-social-proof-experiment/index.js +2 -38
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +28 -6
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +9 -18
- package/dist/es2019/view/CardWithUrl/card-intersection-observer/index.js +28 -11
- package/dist/es2019/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +25 -4
- package/dist/es2019/view/CardWithUrl/component.js +3 -48
- package/dist/es2019/view/InlineCard/Frame/index.js +3 -2
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/index.js +1 -40
- package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-with-all-card-examples-in-text--default--jfp-magma-platform-lozenge-jump-fix-false.png +0 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-with-all-card-examples-in-text--default--jfp-magma-platform-lozenge-jump-fix-true.png +0 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-default-state--default.png +0 -0
- package/dist/esm/state/hooks/use-intersection-observer/index.js +2 -1
- package/dist/esm/state/hooks/use-smart-link-seen-event/index.js +60 -0
- package/dist/esm/state/hooks/use-social-proof-experiment/index.js +2 -40
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +31 -8
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +9 -18
- package/dist/esm/view/CardWithUrl/card-intersection-observer/index.js +26 -21
- package/dist/esm/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +24 -4
- package/dist/esm/view/CardWithUrl/component.js +5 -48
- package/dist/esm/view/InlineCard/Frame/index.js +3 -2
- package/dist/esm/view/LinkUrl/HyperlinkResolver/index.js +1 -42
- package/dist/types/common/analytics/generated/analytics.types.d.ts +0 -1
- package/dist/types/state/hooks/use-smart-link-seen-event/index.d.ts +14 -0
- package/dist/types/state/hooks/use-social-proof-experiment/index.d.ts +0 -22
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +10 -0
- package/dist/types/view/CardWithUrl/card-intersection-observer/index.d.ts +3 -5
- package/dist/types/view/CardWithUrl/types.d.ts +0 -1
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +0 -1
- package/dist/types-ts4.5/state/hooks/use-smart-link-seen-event/index.d.ts +14 -0
- package/dist/types-ts4.5/state/hooks/use-social-proof-experiment/index.d.ts +0 -22
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +10 -0
- package/dist/types-ts4.5/view/CardWithUrl/card-intersection-observer/index.d.ts +3 -5
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +0 -1
- package/package.json +8 -5
- package/dist/cjs/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-default-state-without-connect-button-functionality--default.png +0 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-resolved-state-with-feature-flag-enabled-should-show-no-connect-button---default--platform-editor-resolve-hyperlinks-killswitch-false.png +0 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-resolved-state-with-feature-flag-enabled-should-show-no-connect-button---default--platform-editor-resolve-hyperlinks-killswitch-true.png +0 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-unauthorized-state-with-connect-button-direct-render---always-visible---default.png +0 -0
- package/dist/cjs/view/CardWithUrl/experiment-meta-event-attributes/index.js +0 -39
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/unauthorize-view.js +0 -30
- package/dist/es2019/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-default-state-without-connect-button-functionality--default.png +0 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-resolved-state-with-feature-flag-enabled-should-show-no-connect-button---default--platform-editor-resolve-hyperlinks-killswitch-false.png +0 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-resolved-state-with-feature-flag-enabled-should-show-no-connect-button---default--platform-editor-resolve-hyperlinks-killswitch-true.png +0 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-unauthorized-state-with-connect-button-direct-render---always-visible---default.png +0 -0
- package/dist/es2019/view/CardWithUrl/experiment-meta-event-attributes/index.js +0 -40
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/unauthorize-view.js +0 -22
- package/dist/esm/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-default-state-without-connect-button-functionality--default.png +0 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-resolved-state-with-feature-flag-enabled-should-show-no-connect-button---default--platform-editor-resolve-hyperlinks-killswitch-false.png +0 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-resolved-state-with-feature-flag-enabled-should-show-no-connect-button---default--platform-editor-resolve-hyperlinks-killswitch-true.png +0 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/link-url-connect-button/linkurl-unauthorized-state-with-connect-button-direct-render---always-visible---default.png +0 -0
- package/dist/esm/view/CardWithUrl/experiment-meta-event-attributes/index.js +0 -32
- package/dist/esm/view/LinkUrl/HyperlinkResolver/unauthorize-view.js +0 -23
- package/dist/types/view/CardWithUrl/experiment-meta-event-attributes/index.d.ts +0 -9
- package/dist/types/view/LinkUrl/HyperlinkResolver/unauthorize-view.d.ts +0 -10
- package/dist/types-ts4.5/view/CardWithUrl/experiment-meta-event-attributes/index.d.ts +0 -9
- package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/unauthorize-view.d.ts +0 -10
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
3
|
+
import { useSmartLinkAnalyticsUtils } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
4
|
+
import { isFlexibleUiCard } from '../../../utils/flexible';
|
|
5
|
+
/**
|
|
6
|
+
* Fires `ui.smartLink.seen` once when a smart link with status `unauthorized`
|
|
7
|
+
* enters the viewport. Uses refs internally so it never causes re-renders,
|
|
8
|
+
* which is important for SSR.
|
|
9
|
+
*/
|
|
10
|
+
export function useSmartLinkSeenEvent(_ref) {
|
|
11
|
+
var appearance = _ref.appearance,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
id = _ref.id,
|
|
14
|
+
ui = _ref.ui,
|
|
15
|
+
_ref$url = _ref.url,
|
|
16
|
+
url = _ref$url === void 0 ? '' : _ref$url;
|
|
17
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
18
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
19
|
+
var _useSmartLinkAnalytic = useSmartLinkAnalyticsUtils(),
|
|
20
|
+
getByUrl = _useSmartLinkAnalytic.getByUrl;
|
|
21
|
+
var getAnalyticsProps = useCallback(function () {
|
|
22
|
+
var isFlexibleUi = isFlexibleUiCard(children, ui);
|
|
23
|
+
var display = isFlexibleUi ? 'flexible' : appearance;
|
|
24
|
+
return {
|
|
25
|
+
display: display,
|
|
26
|
+
id: id
|
|
27
|
+
};
|
|
28
|
+
}, [appearance, children, id, ui]);
|
|
29
|
+
var statusRef = useRef();
|
|
30
|
+
var analyticsPropsRef = useRef(null);
|
|
31
|
+
var hasIntersectedRef = useRef(false);
|
|
32
|
+
var hasFiredSeenRef = useRef(false);
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
analyticsPropsRef.current = getAnalyticsProps();
|
|
35
|
+
}, [getAnalyticsProps]);
|
|
36
|
+
var maybeFireSeenEvent = useCallback(function () {
|
|
37
|
+
if (!hasFiredSeenRef.current && hasIntersectedRef.current && statusRef.current === 'unauthorized') {
|
|
38
|
+
var payload = getByUrl(url, analyticsPropsRef.current);
|
|
39
|
+
fireEvent('ui.smartLink.seen', payload === null || payload === void 0 ? void 0 : payload.attributes);
|
|
40
|
+
hasFiredSeenRef.current = true;
|
|
41
|
+
}
|
|
42
|
+
}, [fireEvent, getByUrl, url]);
|
|
43
|
+
var onIntersecting = useCallback(function () {
|
|
44
|
+
if (hasIntersectedRef.current) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
hasIntersectedRef.current = true;
|
|
48
|
+
maybeFireSeenEvent();
|
|
49
|
+
}, [maybeFireSeenEvent]);
|
|
50
|
+
var onStatusSettled = useCallback(function (status) {
|
|
51
|
+
statusRef.current = status;
|
|
52
|
+
maybeFireSeenEvent();
|
|
53
|
+
}, [maybeFireSeenEvent]);
|
|
54
|
+
return useMemo(function () {
|
|
55
|
+
return {
|
|
56
|
+
onIntersecting: onIntersecting,
|
|
57
|
+
onStatusSettled: onStatusSettled
|
|
58
|
+
};
|
|
59
|
+
}, [onIntersecting, onStatusSettled]);
|
|
60
|
+
}
|
|
@@ -1,44 +1,7 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
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) { _defineProperty(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; }
|
|
4
1
|
import { useMemo } from 'react';
|
|
5
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
|
-
import { getCurrentSiteCloudIdSync } from '../../services/current-site-cloud-id';
|
|
7
|
-
import { getProviderPctMapSync, SOCIAL_PROOF_TRAIT_NAME } from '../../services/personalization';
|
|
8
3
|
import useSocialProof from '../use-social-proof';
|
|
9
|
-
|
|
10
|
-
export var INLINE_SOCIAL_PROOF_EXPERIMENT_KEY = 'platform_sl_3p_preauth_social_proof_inline_cta';
|
|
11
|
-
export var SOCIAL_PROOF_TIER_THRESHOLD = 30;
|
|
12
|
-
export var getSocialProofTier = function getSocialProofTier(connectedPct) {
|
|
13
|
-
if (connectedPct === undefined) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
return connectedPct >= SOCIAL_PROOF_TIER_THRESHOLD ? 'not-low' : 'low';
|
|
17
|
-
};
|
|
18
|
-
var getSocialProofExperimentMetadata = function getSocialProofExperimentMetadata(_ref) {
|
|
19
|
-
var extensionKey = _ref.extensionKey,
|
|
20
|
-
_ref$baseUriWithNoTra = _ref.baseUriWithNoTrailingSlash,
|
|
21
|
-
baseUriWithNoTrailingSlash = _ref$baseUriWithNoTra === void 0 ? '' : _ref$baseUriWithNoTra;
|
|
22
|
-
if (!extensionKey) {
|
|
23
|
-
return {
|
|
24
|
-
isEligible: false
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
var cloudId = getCurrentSiteCloudIdSync(baseUriWithNoTrailingSlash);
|
|
28
|
-
var providerPctMap = getProviderPctMapSync(cloudId, SOCIAL_PROOF_TRAIT_NAME);
|
|
29
|
-
var tier = getSocialProofTier(providerPctMap === null || providerPctMap === void 0 ? void 0 : providerPctMap[extensionKey]);
|
|
30
|
-
return _objectSpread({
|
|
31
|
-
isEligible: tier !== undefined
|
|
32
|
-
}, tier ? {
|
|
33
|
-
tier: tier
|
|
34
|
-
} : {});
|
|
35
|
-
};
|
|
36
|
-
export var getSocialProofExperimentMeta = function getSocialProofExperimentMeta(params) {
|
|
37
|
-
return _defineProperty({}, SOCIAL_PROOF_3P_UNAUTH_BLOCK_EXPERIMENT_KEY, getSocialProofExperimentMetadata(params));
|
|
38
|
-
};
|
|
39
|
-
export var getInlineSocialProofExperimentMeta = function getInlineSocialProofExperimentMeta(params) {
|
|
40
|
-
return _defineProperty({}, INLINE_SOCIAL_PROOF_EXPERIMENT_KEY, getSocialProofExperimentMetadata(params));
|
|
41
|
-
};
|
|
4
|
+
var TIER_THRESHOLD = 30;
|
|
42
5
|
|
|
43
6
|
/**
|
|
44
7
|
* Returns enrollment and treatment state for the social proof unauth block card experiment.
|
|
@@ -62,12 +25,11 @@ var useSocialProofExperiment = function useSocialProofExperiment(extensionKey) {
|
|
|
62
25
|
isEnabled = _useSocialProof.isEnabled,
|
|
63
26
|
isLoading = _useSocialProof.isLoading;
|
|
64
27
|
return useMemo(function () {
|
|
65
|
-
var _getSocialProofTier;
|
|
66
28
|
var hasSocialProofData = connectedPct !== undefined;
|
|
67
29
|
|
|
68
30
|
// Only fire exposure when data has loaded (prevents exposure inflation)
|
|
69
31
|
var isTreatment = isEnabled && !isLoading && hasSocialProofData ? editorExperiment('social_proof_3p_unauth_block_exp', true) : false;
|
|
70
|
-
var tier =
|
|
32
|
+
var tier = connectedPct !== undefined && connectedPct >= TIER_THRESHOLD ? 'not-low' : 'low';
|
|
71
33
|
return {
|
|
72
34
|
isTreatment: isTreatment,
|
|
73
35
|
tier: tier,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
-
import React, { useMemo } from 'react';
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
5
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
7
6
|
import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
8
7
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
9
8
|
import { getUrl } from '@atlaskit/linking-common';
|
|
@@ -25,12 +24,9 @@ var getSmartLinkAnalyticsContext = function getSmartLinkAnalyticsContext(_ref) {
|
|
|
25
24
|
status = _ref.status,
|
|
26
25
|
url = _ref.url,
|
|
27
26
|
error = _ref.error;
|
|
28
|
-
var
|
|
29
|
-
var resolvedAttributes = isHyperlinkConnectExperimentEnabled ? getExtendedResolvedAttributes({
|
|
27
|
+
var resolvedAttributes = getExtendedResolvedAttributes({
|
|
30
28
|
url: url,
|
|
31
29
|
displayCategory: display === 'url' ? 'link' : 'smartLink'
|
|
32
|
-
}, response, status, error) : getExtendedResolvedAttributes({
|
|
33
|
-
url: url
|
|
34
30
|
}, response, status, error);
|
|
35
31
|
return {
|
|
36
32
|
source: source,
|
|
@@ -44,13 +40,40 @@ var getSmartLinkAnalyticsContext = function getSmartLinkAnalyticsContext(_ref) {
|
|
|
44
40
|
* Provides an analytics context data to supply attributes to events based on a URL
|
|
45
41
|
* and the link state in the store
|
|
46
42
|
*/
|
|
43
|
+
export var useSmartLinkAnalyticsUtils = function useSmartLinkAnalyticsUtils() {
|
|
44
|
+
var _useSmartLinkContext = useSmartLinkContext(),
|
|
45
|
+
store = _useSmartLinkContext.store;
|
|
46
|
+
var getByUrl = useCallback(function (url, props) {
|
|
47
|
+
var state = store ? getUrl(store, url) : undefined;
|
|
48
|
+
return getSmartLinkAnalyticsContext({
|
|
49
|
+
display: props === null || props === void 0 ? void 0 : props.display,
|
|
50
|
+
id: props === null || props === void 0 ? void 0 : props.id,
|
|
51
|
+
response: state === null || state === void 0 ? void 0 : state.details,
|
|
52
|
+
source: props === null || props === void 0 ? void 0 : props.source,
|
|
53
|
+
status: state === null || state === void 0 ? void 0 : state.status,
|
|
54
|
+
url: url,
|
|
55
|
+
error: state === null || state === void 0 ? void 0 : state.error
|
|
56
|
+
});
|
|
57
|
+
}, [store]);
|
|
58
|
+
return useMemo(function () {
|
|
59
|
+
return {
|
|
60
|
+
getByUrl: getByUrl
|
|
61
|
+
};
|
|
62
|
+
}, [getByUrl]);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Provides an analytics context data to supply attributes to events based on a URL
|
|
67
|
+
* and the link state in the store
|
|
68
|
+
* @deprecated Use useSmartLinkAnalyticsUtils instead
|
|
69
|
+
*/
|
|
47
70
|
export var useSmartLinkAnalyticsContext = function useSmartLinkAnalyticsContext(_ref2) {
|
|
48
71
|
var display = _ref2.display,
|
|
49
72
|
id = _ref2.id,
|
|
50
73
|
source = _ref2.source,
|
|
51
74
|
url = _ref2.url;
|
|
52
|
-
var
|
|
53
|
-
store =
|
|
75
|
+
var _useSmartLinkContext2 = useSmartLinkContext(),
|
|
76
|
+
store = _useSmartLinkContext2.store;
|
|
54
77
|
var state = store ? getUrl(store, url) : undefined;
|
|
55
78
|
return useMemo(function () {
|
|
56
79
|
return getSmartLinkAnalyticsContext({
|
|
@@ -20,7 +20,7 @@ import { ElementName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '
|
|
|
20
20
|
import { messages } from '../../../messages';
|
|
21
21
|
import { useFlexibleCardContext } from '../../../state/flexible-ui-context';
|
|
22
22
|
import { hasAuthScopeOverrides } from '../../../state/helpers';
|
|
23
|
-
import useSocialProofExperiment
|
|
23
|
+
import useSocialProofExperiment from '../../../state/hooks/use-social-proof-experiment';
|
|
24
24
|
import UnauthorisedViewContent from '../../common/UnauthorisedViewContent';
|
|
25
25
|
import FlexibleCard from '../../FlexibleCard';
|
|
26
26
|
import ActionGroup from '../../FlexibleCard/components/blocks/action-group';
|
|
@@ -247,28 +247,19 @@ var UnauthorisedViewWithExperiment = function UnauthorisedViewWithExperiment(_re
|
|
|
247
247
|
isTreatment = _useSocialProofExperi.isTreatment,
|
|
248
248
|
tier = _useSocialProofExperi.tier,
|
|
249
249
|
connectedPct = _useSocialProofExperi.connectedPct;
|
|
250
|
-
var socialProofExperimentMeta = getSocialProofExperimentMeta({
|
|
251
|
-
extensionKey: extensionKey,
|
|
252
|
-
baseUriWithNoTrailingSlash: connections.client.baseUrlOverride
|
|
253
|
-
});
|
|
254
|
-
var analyticsContextData = {
|
|
255
|
-
attributes: {
|
|
256
|
-
experiment: 'social_proof_3p_unauth_block_exp',
|
|
257
|
-
cohort: isTreatment ? 'treatment' : 'control',
|
|
258
|
-
tier: tier,
|
|
259
|
-
experimentMeta: socialProofExperimentMeta
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
250
|
if (!isTreatment || !providerName) {
|
|
263
|
-
|
|
251
|
+
return /*#__PURE__*/React.createElement(UnauthorisedViewBase, _extends({}, props, {
|
|
264
252
|
testId: testId
|
|
265
253
|
}));
|
|
266
|
-
return connectedPct !== undefined ? /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
267
|
-
data: analyticsContextData
|
|
268
|
-
}, fallbackView) : fallbackView;
|
|
269
254
|
}
|
|
270
255
|
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
271
|
-
data:
|
|
256
|
+
data: {
|
|
257
|
+
attributes: {
|
|
258
|
+
experiment: 'social_proof_3p_unauth_block_exp',
|
|
259
|
+
cohort: 'treatment',
|
|
260
|
+
tier: tier
|
|
261
|
+
}
|
|
262
|
+
}
|
|
272
263
|
}, /*#__PURE__*/React.createElement(UnauthorisedViewFrame, _extends({}, props, {
|
|
273
264
|
content: /*#__PURE__*/React.createElement(SocialProofMessage, {
|
|
274
265
|
tier: tier,
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
4
3
|
import useIntersectionObserver from '../../../state/hooks/use-intersection-observer';
|
|
5
|
-
import {
|
|
4
|
+
import { useSmartLinkSeenEvent } from '../../../state/hooks/use-smart-link-seen-event';
|
|
6
5
|
import CardLoaderWrapper from '../card-loader-wrapper';
|
|
7
6
|
var withCardIntersectionObserver = function withCardIntersectionObserver(Component) {
|
|
8
7
|
return function (props) {
|
|
9
8
|
// TODO: NAVX-4682: Add feature parity to LazyIntersectionObserverCard for no lazy loading
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
var appearance = props.appearance,
|
|
10
|
+
children = props.children,
|
|
11
|
+
id = props.id,
|
|
12
|
+
onErrorCallback = props.onError,
|
|
13
|
+
ui = props.ui,
|
|
14
|
+
_props$url = props.url,
|
|
15
|
+
url = _props$url === void 0 ? '' : _props$url;
|
|
16
|
+
var _useSmartLinkSeenEven = useSmartLinkSeenEvent({
|
|
17
|
+
appearance: appearance,
|
|
18
|
+
children: children,
|
|
19
|
+
id: id,
|
|
20
|
+
ui: ui,
|
|
21
|
+
url: url
|
|
22
|
+
}),
|
|
23
|
+
onIntersecting = _useSmartLinkSeenEven.onIntersecting,
|
|
24
|
+
onStatusSettled = _useSmartLinkSeenEven.onStatusSettled;
|
|
25
|
+
var onError = useCallback(function (data) {
|
|
26
|
+
if (data !== null && data !== void 0 && data.status) {
|
|
27
|
+
onStatusSettled(data.status);
|
|
28
|
+
}
|
|
29
|
+
onErrorCallback === null || onErrorCallback === void 0 || onErrorCallback(data);
|
|
30
|
+
}, [onStatusSettled, onErrorCallback]);
|
|
17
31
|
var ref = useIntersectionObserver({
|
|
18
32
|
onIntersecting: onIntersecting
|
|
19
33
|
});
|
|
@@ -21,17 +35,8 @@ var withCardIntersectionObserver = function withCardIntersectionObserver(Compone
|
|
|
21
35
|
appearance: props.appearance,
|
|
22
36
|
ref: ref
|
|
23
37
|
}, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
24
|
-
|
|
38
|
+
onError: onError
|
|
25
39
|
})));
|
|
26
40
|
};
|
|
27
41
|
};
|
|
28
|
-
|
|
29
|
-
return function (props) {
|
|
30
|
-
return /*#__PURE__*/React.createElement(CardLoaderWrapper, {
|
|
31
|
-
appearance: props.appearance
|
|
32
|
-
}, /*#__PURE__*/React.createElement(Component, props));
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export default (function (Component) {
|
|
36
|
-
return isIntersectionObserverSupported() ? withCardIntersectionObserver(Component) : withCardIntersectionObserverFallback(Component);
|
|
37
|
-
});
|
|
42
|
+
export default withCardIntersectionObserver;
|
|
@@ -5,6 +5,7 @@ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
|
5
5
|
import { usePrefetch } from '../../../state';
|
|
6
6
|
import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
|
|
7
7
|
import useIntersectionObserver from '../../../state/hooks/use-intersection-observer';
|
|
8
|
+
import { useSmartLinkSeenEvent } from '../../../state/hooks/use-smart-link-seen-event';
|
|
8
9
|
import { shouldSample } from '../../../utils/shouldSample';
|
|
9
10
|
import CardLoaderWrapper from '../card-loader-wrapper';
|
|
10
11
|
import { CardWithUrlContent } from '../component';
|
|
@@ -74,25 +75,44 @@ var LazyIntersectionObserverCardNew = function LazyIntersectionObserverCardNew(p
|
|
|
74
75
|
_useState8 = _slicedToArray(_useState7, 1),
|
|
75
76
|
shouldSendRenderedUFOEvent = _useState8[0];
|
|
76
77
|
var appearance = props.appearance,
|
|
77
|
-
|
|
78
|
-
id = props.id
|
|
78
|
+
children = props.children,
|
|
79
|
+
id = props.id,
|
|
80
|
+
onErrorCallback = props.onError,
|
|
81
|
+
ui = props.ui,
|
|
82
|
+
url = props.url;
|
|
79
83
|
var prefetch = usePrefetch(url);
|
|
80
84
|
var ComponentObserver = appearance === 'inline' ? 'span' : 'div';
|
|
85
|
+
var _useSmartLinkSeenEven = useSmartLinkSeenEvent({
|
|
86
|
+
appearance: appearance,
|
|
87
|
+
children: children,
|
|
88
|
+
id: id,
|
|
89
|
+
ui: ui,
|
|
90
|
+
url: url
|
|
91
|
+
}),
|
|
92
|
+
onSeenIntersecting = _useSmartLinkSeenEven.onIntersecting,
|
|
93
|
+
onStatusSettled = _useSmartLinkSeenEven.onStatusSettled;
|
|
94
|
+
var onError = useCallback(function (data) {
|
|
95
|
+
if (data !== null && data !== void 0 && data.status) {
|
|
96
|
+
onStatusSettled(data.status);
|
|
97
|
+
}
|
|
98
|
+
onErrorCallback === null || onErrorCallback === void 0 || onErrorCallback(data);
|
|
99
|
+
}, [onStatusSettled, onErrorCallback]);
|
|
81
100
|
var onIntersection = useCallback(function (isIntersecting) {
|
|
82
101
|
if (isIntersecting) {
|
|
83
102
|
if (shouldSendRenderedUFOEvent) {
|
|
84
103
|
startUfoExperience('smart-link-rendered', id);
|
|
85
104
|
}
|
|
105
|
+
onSeenIntersecting();
|
|
86
106
|
setIsIntersected(true);
|
|
87
107
|
} else {
|
|
88
108
|
prefetch();
|
|
89
109
|
}
|
|
90
|
-
}, [id, prefetch, shouldSendRenderedUFOEvent]);
|
|
110
|
+
}, [id, onSeenIntersecting, prefetch, shouldSendRenderedUFOEvent]);
|
|
91
111
|
var ref = useIntersectionObserver({
|
|
92
112
|
onIntersection: onIntersection
|
|
93
113
|
});
|
|
94
114
|
var content = isIntersected ? /*#__PURE__*/React.createElement(CardWithUrlContent, _extends({}, props, {
|
|
95
|
-
|
|
115
|
+
onError: onError
|
|
96
116
|
})) : /*#__PURE__*/React.createElement(ComponentObserver, {
|
|
97
117
|
ref: ref
|
|
98
118
|
}, /*#__PURE__*/React.createElement(LoadingCardLink, props));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
-
import React, { useCallback, useEffect, useMemo
|
|
4
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
5
5
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
6
6
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -27,7 +27,6 @@ import FlexibleCard from '../FlexibleCard';
|
|
|
27
27
|
import { InlineCard } from '../InlineCard';
|
|
28
28
|
import { useFire3PWorkflowsClickEvent } from '../SmartLinkEvents/useSmartLinkEvents';
|
|
29
29
|
import withCardIntersectionObserver from './card-intersection-observer';
|
|
30
|
-
import useExperimentMetaEventAttributes from './experiment-meta-event-attributes';
|
|
31
30
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
32
31
|
var EmbedCardComponent = componentWithFG('rovo_chat_embed_card_dwell_and_hover_metrics', EmbedCardUpdated, EmbedCard);
|
|
33
32
|
function Component(_ref) {
|
|
@@ -35,7 +34,6 @@ function Component(_ref) {
|
|
|
35
34
|
url = _ref.url,
|
|
36
35
|
isSelected = _ref.isSelected,
|
|
37
36
|
isHovered = _ref.isHovered,
|
|
38
|
-
isIntersected = _ref.isIntersected,
|
|
39
37
|
frameStyle = _ref.frameStyle,
|
|
40
38
|
platform = _ref.platform,
|
|
41
39
|
onClick = _ref.onClick,
|
|
@@ -63,7 +61,6 @@ function Component(_ref) {
|
|
|
63
61
|
createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
|
|
64
62
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
65
63
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
66
|
-
var hasFiredSeenRef = useRef(false);
|
|
67
64
|
var isFlexibleUi = useMemo(function () {
|
|
68
65
|
return isFlexibleUiCard(children, ui);
|
|
69
66
|
}, [children, ui]);
|
|
@@ -171,10 +168,6 @@ function Component(_ref) {
|
|
|
171
168
|
var handleInvoke = useCallback(function (opts) {
|
|
172
169
|
return actions.invoke(opts, appearance);
|
|
173
170
|
}, [actions, appearance]);
|
|
174
|
-
var experimentMetaEventAttributes = useExperimentMetaEventAttributes({
|
|
175
|
-
appearance: appearance,
|
|
176
|
-
state: state
|
|
177
|
-
});
|
|
178
171
|
|
|
179
172
|
// NB: for each status change in a Smart Link, a performance mark is created.
|
|
180
173
|
// Measures are sent relative to the first mark, matching what a user sees.
|
|
@@ -218,28 +211,13 @@ function Component(_ref) {
|
|
|
218
211
|
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
219
212
|
display: isFlexibleUi ? 'flexible' : appearance
|
|
220
213
|
});
|
|
221
|
-
fireEvent('ui.smartLink.renderSuccess', _objectSpread(
|
|
214
|
+
fireEvent('ui.smartLink.renderSuccess', _objectSpread({
|
|
222
215
|
display: isFlexibleUi ? 'flexible' : appearance
|
|
223
216
|
}, appearance === 'inline' && {
|
|
224
217
|
rovoActionsCtaShown: rovoActionsCtaShown
|
|
225
|
-
}), experimentMetaEventAttributes && {
|
|
226
|
-
experimentMeta: experimentMetaEventAttributes
|
|
227
218
|
}));
|
|
228
219
|
}
|
|
229
|
-
}, [appearance, extensionKey, fireEvent, id, isFlexibleUi, rovoActionsCtaShown, state.status
|
|
230
|
-
|
|
231
|
-
// Fire smartLink seen event once on a successful render card is in the viewport
|
|
232
|
-
useEffect(function () {
|
|
233
|
-
if (fg('platform_sl_event_ui_seen')) {
|
|
234
|
-
if (state.status !== 'unauthorized') return;
|
|
235
|
-
if (isIntersected && !hasFiredSeenRef.current) {
|
|
236
|
-
fireEvent('ui.smartLink.seen', {
|
|
237
|
-
display: appearance
|
|
238
|
-
});
|
|
239
|
-
hasFiredSeenRef.current = true;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}, [state.status, isIntersected, fireEvent, appearance]);
|
|
220
|
+
}, [appearance, extensionKey, fireEvent, id, isFlexibleUi, rovoActionsCtaShown, state.status]);
|
|
243
221
|
var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
|
|
244
222
|
fireEvent('ui.smartLinkIframe.dwelled', {
|
|
245
223
|
id: id,
|
|
@@ -362,7 +340,6 @@ function ComponentUpdated(_ref2) {
|
|
|
362
340
|
url = _ref2.url,
|
|
363
341
|
isSelected = _ref2.isSelected,
|
|
364
342
|
isHovered = _ref2.isHovered,
|
|
365
|
-
isIntersected = _ref2.isIntersected,
|
|
366
343
|
frameStyle = _ref2.frameStyle,
|
|
367
344
|
platform = _ref2.platform,
|
|
368
345
|
onClick = _ref2.onClick,
|
|
@@ -390,7 +367,6 @@ function ComponentUpdated(_ref2) {
|
|
|
390
367
|
createAnalyticsEvent = _useAnalyticsEventsNe2.createAnalyticsEvent;
|
|
391
368
|
var _useAnalyticsEvents2 = useAnalyticsEvents(),
|
|
392
369
|
fireEvent = _useAnalyticsEvents2.fireEvent;
|
|
393
|
-
var hasFiredSeenRef = useRef(false);
|
|
394
370
|
var isFlexibleUi = useMemo(function () {
|
|
395
371
|
return isFlexibleUiCard(children, ui);
|
|
396
372
|
}, [children, ui]);
|
|
@@ -498,10 +474,6 @@ function ComponentUpdated(_ref2) {
|
|
|
498
474
|
var handleInvoke = useCallback(function (opts) {
|
|
499
475
|
return actions.invoke(opts, appearance);
|
|
500
476
|
}, [actions, appearance]);
|
|
501
|
-
var experimentMetaEventAttributes = useExperimentMetaEventAttributes({
|
|
502
|
-
appearance: appearance,
|
|
503
|
-
state: state
|
|
504
|
-
});
|
|
505
477
|
|
|
506
478
|
// NB: for each status change in a Smart Link, a performance mark is created.
|
|
507
479
|
// Measures are sent relative to the first mark, matching what a user sees.
|
|
@@ -545,28 +517,13 @@ function ComponentUpdated(_ref2) {
|
|
|
545
517
|
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
546
518
|
display: isFlexibleUi ? 'flexible' : appearance
|
|
547
519
|
});
|
|
548
|
-
fireEvent('ui.smartLink.renderSuccess', _objectSpread(
|
|
520
|
+
fireEvent('ui.smartLink.renderSuccess', _objectSpread({
|
|
549
521
|
display: isFlexibleUi ? 'flexible' : appearance
|
|
550
522
|
}, appearance === 'inline' && {
|
|
551
523
|
rovoActionsCtaShown: rovoActionsCtaShown
|
|
552
|
-
}), experimentMetaEventAttributes && {
|
|
553
|
-
experimentMeta: experimentMetaEventAttributes
|
|
554
524
|
}));
|
|
555
525
|
}
|
|
556
|
-
}, [appearance, extensionKey, fireEvent, id, isFlexibleUi, rovoActionsCtaShown, state.status
|
|
557
|
-
|
|
558
|
-
// Fire smartLink seen event once on a successful render card is in the viewport
|
|
559
|
-
useEffect(function () {
|
|
560
|
-
if (fg('platform_sl_event_ui_seen')) {
|
|
561
|
-
if (state.status !== 'unauthorized') return;
|
|
562
|
-
if (isIntersected && !hasFiredSeenRef.current) {
|
|
563
|
-
fireEvent('ui.smartLink.seen', {
|
|
564
|
-
display: appearance
|
|
565
|
-
});
|
|
566
|
-
hasFiredSeenRef.current = true;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}, [state.status, isIntersected, fireEvent, appearance]);
|
|
526
|
+
}, [appearance, extensionKey, fireEvent, id, isFlexibleUi, rovoActionsCtaShown, state.status]);
|
|
570
527
|
var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
|
|
571
528
|
fireEvent('ui.smartLinkIframe.dwelled', {
|
|
572
529
|
id: id,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { useMouseDownEvent } from '../../../state/analytics/useLinkClicked';
|
|
3
4
|
import { WrapperAnchor, WrapperSpan } from './styled';
|
|
4
5
|
export var Frame = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -40,8 +41,8 @@ export var Frame = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
40
41
|
withoutBackground: withoutBackground,
|
|
41
42
|
isSelected: isSelected,
|
|
42
43
|
isInteractive: isInteractive,
|
|
43
|
-
tabIndex: isInteractive ? 0 : undefined,
|
|
44
|
-
role: isInteractive ? 'button' : undefined,
|
|
44
|
+
tabIndex: isInteractive && (fg('navx-3611-inline-card-a11y-role-fix') ? !link : true) ? 0 : undefined,
|
|
45
|
+
role: isInteractive && (fg('navx-3611-inline-card-a11y-role-fix') ? !link : true) ? 'button' : undefined,
|
|
45
46
|
onClick: handleClick,
|
|
46
47
|
onMouseDown: handleMouseDown,
|
|
47
48
|
onKeyPress: handleKeyPress,
|
|
@@ -4,17 +4,14 @@ var _excluded = ["onClick"];
|
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
5
|
import { withErrorBoundary as withReactErrorBoundary } from 'react-error-boundary';
|
|
6
6
|
import { injectIntl } from 'react-intl';
|
|
7
|
-
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
8
|
-
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
9
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { getFirstPartyIdentifier,
|
|
8
|
+
import { getFirstPartyIdentifier, getThirdPartyARI } from '../../../state/helpers';
|
|
11
9
|
import useResolveHyperlink from '../../../state/hooks/use-resolve-hyperlink';
|
|
12
10
|
import useResolveHyperlinkValidator from '../../../state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator';
|
|
13
11
|
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
14
12
|
import withIntlProvider from '../../common/intl-provider';
|
|
15
13
|
import { useFire3PWorkflowsClickEvent } from '../../SmartLinkEvents/useSmartLinkEvents';
|
|
16
14
|
import Hyperlink from '../Hyperlink';
|
|
17
|
-
import HyperlinkUnauthorizedView from './unauthorize-view';
|
|
18
15
|
var HyperlinkFallbackComponent = function HyperlinkFallbackComponent() {
|
|
19
16
|
return null;
|
|
20
17
|
};
|
|
@@ -33,9 +30,7 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
|
|
|
33
30
|
var _useResolveHyperlink = useResolveHyperlink({
|
|
34
31
|
href: props.href || ''
|
|
35
32
|
}),
|
|
36
|
-
actions = _useResolveHyperlink.actions,
|
|
37
33
|
state = _useResolveHyperlink.state;
|
|
38
|
-
var services = getServices(state === null || state === void 0 ? void 0 : state.details);
|
|
39
34
|
var thirdPartyARI = getThirdPartyARI(state === null || state === void 0 ? void 0 : state.details);
|
|
40
35
|
var firstPartyIdentifier = getFirstPartyIdentifier();
|
|
41
36
|
var fire3PClickEvent = fg('platform_smartlink_3pclick_analytics') ?
|
|
@@ -50,42 +45,6 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
|
|
|
50
45
|
}
|
|
51
46
|
onClickCallback === null || onClickCallback === void 0 || onClickCallback(e);
|
|
52
47
|
}, [onClickCallback, fire3PClickEvent, state === null || state === void 0 ? void 0 : state.status]);
|
|
53
|
-
var onAuthorize = useCallback(function () {
|
|
54
|
-
return actions.authorize('url');
|
|
55
|
-
}, [actions]);
|
|
56
|
-
var shouldRenderConnectBtn = function shouldRenderConnectBtn() {
|
|
57
|
-
if (!props.children || !Array.isArray(props.children) || props.children.length === 0) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
var firstChild = props.children[0];
|
|
61
|
-
try {
|
|
62
|
-
var _firstChild$props;
|
|
63
|
-
// Check if first child has a string matching href
|
|
64
|
-
if (typeof firstChild === 'string') {
|
|
65
|
-
return props.href === firstChild;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// 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
|
|
69
|
-
if (firstChild !== null && firstChild !== void 0 && (_firstChild$props = firstChild.props) !== null && _firstChild$props !== void 0 && _firstChild$props.children && typeof firstChild.props.children === 'string') {
|
|
70
|
-
return props.href === firstChild.props.children;
|
|
71
|
-
}
|
|
72
|
-
} catch (_) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
if ((state === null || state === void 0 ? void 0 : state.status) === 'unauthorized' && shouldRenderConnectBtn() && (
|
|
77
|
-
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils -- Statsig migration pending for Bluelink connect experiments
|
|
78
|
-
FeatureGates.getExperimentValue('platform_linking_bluelink_connect_confluence', 'isEnabled', false) ||
|
|
79
|
-
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils -- Statsig migration pending for Bluelink connect experiments
|
|
80
|
-
FeatureGates.getExperimentValue('platform_linking_bluelink_connect_jira', 'isEnabled', false))) {
|
|
81
|
-
var provider = extractSmartLinkProvider(state === null || state === void 0 ? void 0 : state.details);
|
|
82
|
-
return /*#__PURE__*/React.createElement(HyperlinkUnauthorizedView, _extends({}, props, {
|
|
83
|
-
onAuthorize: services !== null && services !== void 0 && services.length ? onAuthorize : undefined,
|
|
84
|
-
onClick: onClick,
|
|
85
|
-
showConnectBtn: (services === null || services === void 0 ? void 0 : services.length) > 0,
|
|
86
|
-
provider: provider
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
48
|
return /*#__PURE__*/React.createElement(Hyperlink, _extends({}, props, {
|
|
90
49
|
onClick: onClick
|
|
91
50
|
}));
|
|
@@ -261,7 +261,6 @@ export type ButtonClickedEmbedPreviewResizeAttributesType = {
|
|
|
261
261
|
export type SmartLinkRenderSuccessAttributesType = {
|
|
262
262
|
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
|
|
263
263
|
rovoActionsCtaShown?: boolean | null;
|
|
264
|
-
experimentMeta?: Record<string, unknown> | null;
|
|
265
264
|
};
|
|
266
265
|
export type SmartLinkRenderFailedAttributesType = {
|
|
267
266
|
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CardType } from '@atlaskit/linking-common';
|
|
2
|
+
import type { CardProps } from '../../../view/Card';
|
|
3
|
+
type UseSmartLinkSeenEventProps = Pick<CardProps, 'appearance' | 'children' | 'id' | 'ui' | 'url'>;
|
|
4
|
+
type UseSmartLinkSeenEventReturn = {
|
|
5
|
+
onIntersecting: () => void;
|
|
6
|
+
onStatusSettled: (status: CardType) => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Fires `ui.smartLink.seen` once when a smart link with status `unauthorized`
|
|
10
|
+
* enters the viewport. Uses refs internally so it never causes re-renders,
|
|
11
|
+
* which is important for SSR.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSmartLinkSeenEvent({ appearance, children, id, ui, url, }: UseSmartLinkSeenEventProps): UseSmartLinkSeenEventReturn;
|
|
14
|
+
export {};
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
export type SocialProofTier = 'low' | 'not-low';
|
|
2
|
-
export declare const SOCIAL_PROOF_3P_UNAUTH_BLOCK_EXPERIMENT_KEY = "social_proof_3p_unauth_block_exp";
|
|
3
|
-
export declare const INLINE_SOCIAL_PROOF_EXPERIMENT_KEY = "platform_sl_3p_preauth_social_proof_inline_cta";
|
|
4
|
-
type SocialProofExperimentMetadata = {
|
|
5
|
-
isEligible: boolean;
|
|
6
|
-
tier?: SocialProofTier;
|
|
7
|
-
};
|
|
8
|
-
export type BlockCardSocialProofExperimentMeta = {
|
|
9
|
-
[SOCIAL_PROOF_3P_UNAUTH_BLOCK_EXPERIMENT_KEY]: SocialProofExperimentMetadata;
|
|
10
|
-
};
|
|
11
|
-
export type InlineSocialProofExperimentMeta = {
|
|
12
|
-
[INLINE_SOCIAL_PROOF_EXPERIMENT_KEY]: SocialProofExperimentMetadata;
|
|
13
|
-
};
|
|
14
2
|
export interface SocialProofExperiment {
|
|
15
3
|
/**
|
|
16
4
|
* The raw connected users percentage for the current provider, or undefined if not loaded/available.
|
|
@@ -32,16 +20,6 @@ export interface SocialProofExperiment {
|
|
|
32
20
|
*/
|
|
33
21
|
tier: SocialProofTier;
|
|
34
22
|
}
|
|
35
|
-
export declare const SOCIAL_PROOF_TIER_THRESHOLD = 30;
|
|
36
|
-
export declare const getSocialProofTier: (connectedPct?: number) => SocialProofTier | undefined;
|
|
37
|
-
export declare const getSocialProofExperimentMeta: (params: {
|
|
38
|
-
baseUriWithNoTrailingSlash?: string;
|
|
39
|
-
extensionKey?: string;
|
|
40
|
-
}) => BlockCardSocialProofExperimentMeta;
|
|
41
|
-
export declare const getInlineSocialProofExperimentMeta: (params: {
|
|
42
|
-
baseUriWithNoTrailingSlash?: string;
|
|
43
|
-
extensionKey?: string;
|
|
44
|
-
}) => InlineSocialProofExperimentMeta;
|
|
45
23
|
/**
|
|
46
24
|
* Returns enrollment and treatment state for the social proof unauth block card experiment.
|
|
47
25
|
*
|
|
@@ -15,9 +15,19 @@ type SmartLinkAnalyticsContextType = {
|
|
|
15
15
|
};
|
|
16
16
|
source?: string;
|
|
17
17
|
};
|
|
18
|
+
type GetByUrlFn = (url: string, props: Omit<SmartLinkAnalyticsContextProps, 'children' | 'url'>) => SmartLinkAnalyticsContextType;
|
|
19
|
+
type UseSmartLinkAnalyticsUtilsReturn = {
|
|
20
|
+
getByUrl: GetByUrlFn;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Provides an analytics context data to supply attributes to events based on a URL
|
|
24
|
+
* and the link state in the store
|
|
25
|
+
*/
|
|
26
|
+
export declare const useSmartLinkAnalyticsUtils: () => UseSmartLinkAnalyticsUtilsReturn;
|
|
18
27
|
/**
|
|
19
28
|
* Provides an analytics context data to supply attributes to events based on a URL
|
|
20
29
|
* and the link state in the store
|
|
30
|
+
* @deprecated Use useSmartLinkAnalyticsUtils instead
|
|
21
31
|
*/
|
|
22
32
|
export declare const useSmartLinkAnalyticsContext: ({ display, id, source, url, }: Exclude<SmartLinkAnalyticsContextProps, "children">) => SmartLinkAnalyticsContextType | undefined;
|
|
23
33
|
/**
|