@atlaskit/smart-card 46.19.6 → 46.19.7
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 +9 -0
- package/dist/cjs/state/hooks/use-hydration-safe-content/index.js +6 -7
- package/dist/cjs/state/hooks/use-social-proof/index.js +2 -3
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/hooks/use-hydration-safe-content/index.js +6 -7
- package/dist/es2019/state/hooks/use-social-proof/index.js +2 -3
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/hooks/use-hydration-safe-content/index.js +7 -8
- package/dist/esm/state/hooks/use-social-proof/index.js +2 -3
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-hydration-safe-content/index.d.ts +1 -1
- package/dist/types/state/hooks/use-social-proof/index.d.ts +2 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 46.19.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`24eb3c80a0aec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/24eb3c80a0aec) -
|
|
8
|
+
Cleanup experiment `platform_sl_hydration_safe_content`. Smart Link dates and social proof use
|
|
9
|
+
hydration-safe content during SSR and hydration only when the Smart Card provider's product is
|
|
10
|
+
Confluence. Other products and standalone elements retain the control behavior.
|
|
11
|
+
|
|
3
12
|
## 46.19.6
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useHydrationSafeContent;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
8
|
+
var _context = require("@atlaskit/link-provider/context");
|
|
9
9
|
var subscribe = function subscribe() {
|
|
10
10
|
return function () {};
|
|
11
11
|
};
|
|
@@ -13,13 +13,12 @@ var getClientSnapshot = function getClientSnapshot() {
|
|
|
13
13
|
return false;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
/** Use deterministic content
|
|
16
|
+
/** Use deterministic content during SSR/hydration in Confluence only. */
|
|
17
17
|
function useHydrationSafeContent() {
|
|
18
|
+
var _useContext;
|
|
18
19
|
var isEligible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function () {
|
|
23
|
-
return isEligible && (0, _isExperimentEnabled.isExperimentEnabled)('platform_sl_hydration_safe_content');
|
|
20
|
+
var product = (_useContext = (0, _react.useContext)(_context.SmartCardContext)) === null || _useContext === void 0 ? void 0 : _useContext.product;
|
|
21
|
+
return (0, _react.useSyncExternalStore)(subscribe, getClientSnapshot, function () {
|
|
22
|
+
return isEligible && product === 'CONFLUENCE';
|
|
24
23
|
});
|
|
25
24
|
}
|
|
@@ -32,9 +32,8 @@ var NOT_ENABLED_RESULT = {
|
|
|
32
32
|
* This means:
|
|
33
33
|
* - First page visit (cold): no social proof rendered, no experiment exposure fired.
|
|
34
34
|
* Background fetch populates localStorage for next time.
|
|
35
|
-
* - Second page visit (warm): social proof renders from localStorage
|
|
36
|
-
*
|
|
37
|
-
* Background refresh keeps localStorage fresh.
|
|
35
|
+
* - Second page visit (warm): social proof renders from localStorage after hydration in Confluence
|
|
36
|
+
* (immediately in other apps and on client-only mounts). Background refresh keeps localStorage fresh.
|
|
38
37
|
*
|
|
39
38
|
* Callers decide separately (e.g. via Statsig experiment) whether to surface the data.
|
|
40
39
|
*/
|
|
@@ -25,7 +25,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
25
25
|
var context = exports.context = {
|
|
26
26
|
componentName: 'smart-cards',
|
|
27
27
|
packageName: "@atlaskit/smart-card" || '',
|
|
28
|
-
packageVersion: "46.19.
|
|
28
|
+
packageVersion: "46.19.6" || ''
|
|
29
29
|
};
|
|
30
30
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
31
31
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
19
19
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
20
20
|
var PACKAGE_DATA = {
|
|
21
21
|
packageName: "@atlaskit/smart-card",
|
|
22
|
-
packageVersion: "46.19.
|
|
22
|
+
packageVersion: "46.19.6",
|
|
23
23
|
componentName: 'linkUrl'
|
|
24
24
|
};
|
|
25
25
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { useSyncExternalStore } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { useContext, useSyncExternalStore } from 'react';
|
|
2
|
+
import { SmartCardContext } from '@atlaskit/link-provider/context';
|
|
3
3
|
const subscribe = () => () => {};
|
|
4
4
|
const getClientSnapshot = () => false;
|
|
5
5
|
|
|
6
|
-
/** Use deterministic content
|
|
6
|
+
/** Use deterministic content during SSR/hydration in Confluence only. */
|
|
7
7
|
export default function useHydrationSafeContent(isEligible = true) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
() => isEligible && isExperimentEnabled('platform_sl_hydration_safe_content'));
|
|
8
|
+
var _useContext;
|
|
9
|
+
const product = (_useContext = useContext(SmartCardContext)) === null || _useContext === void 0 ? void 0 : _useContext.product;
|
|
10
|
+
return useSyncExternalStore(subscribe, getClientSnapshot, () => isEligible && product === 'CONFLUENCE');
|
|
12
11
|
}
|
|
@@ -24,9 +24,8 @@ const NOT_ENABLED_RESULT = {
|
|
|
24
24
|
* This means:
|
|
25
25
|
* - First page visit (cold): no social proof rendered, no experiment exposure fired.
|
|
26
26
|
* Background fetch populates localStorage for next time.
|
|
27
|
-
* - Second page visit (warm): social proof renders from localStorage
|
|
28
|
-
*
|
|
29
|
-
* Background refresh keeps localStorage fresh.
|
|
27
|
+
* - Second page visit (warm): social proof renders from localStorage after hydration in Confluence
|
|
28
|
+
* (immediately in other apps and on client-only mounts). Background refresh keeps localStorage fresh.
|
|
30
29
|
*
|
|
31
30
|
* Callers decide separately (e.g. via Statsig experiment) whether to surface the data.
|
|
32
31
|
*/
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card" || '',
|
|
7
|
-
packageVersion: "46.19.
|
|
7
|
+
packageVersion: "46.19.6" || ''
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
9
9
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
10
10
|
const PACKAGE_DATA = {
|
|
11
11
|
packageName: "@atlaskit/smart-card",
|
|
12
|
-
packageVersion: "46.19.
|
|
12
|
+
packageVersion: "46.19.6",
|
|
13
13
|
componentName: 'linkUrl'
|
|
14
14
|
};
|
|
15
15
|
const LinkUrl = ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useSyncExternalStore } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { useContext, useSyncExternalStore } from 'react';
|
|
2
|
+
import { SmartCardContext } from '@atlaskit/link-provider/context';
|
|
3
3
|
var subscribe = function subscribe() {
|
|
4
4
|
return function () {};
|
|
5
5
|
};
|
|
@@ -7,13 +7,12 @@ var getClientSnapshot = function getClientSnapshot() {
|
|
|
7
7
|
return false;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
/** Use deterministic content
|
|
10
|
+
/** Use deterministic content during SSR/hydration in Confluence only. */
|
|
11
11
|
export default function useHydrationSafeContent() {
|
|
12
|
+
var _useContext;
|
|
12
13
|
var isEligible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function () {
|
|
17
|
-
return isEligible && isExperimentEnabled('platform_sl_hydration_safe_content');
|
|
14
|
+
var product = (_useContext = useContext(SmartCardContext)) === null || _useContext === void 0 ? void 0 : _useContext.product;
|
|
15
|
+
return useSyncExternalStore(subscribe, getClientSnapshot, function () {
|
|
16
|
+
return isEligible && product === 'CONFLUENCE';
|
|
18
17
|
});
|
|
19
18
|
}
|
|
@@ -25,9 +25,8 @@ var NOT_ENABLED_RESULT = {
|
|
|
25
25
|
* This means:
|
|
26
26
|
* - First page visit (cold): no social proof rendered, no experiment exposure fired.
|
|
27
27
|
* Background fetch populates localStorage for next time.
|
|
28
|
-
* - Second page visit (warm): social proof renders from localStorage
|
|
29
|
-
*
|
|
30
|
-
* Background refresh keeps localStorage fresh.
|
|
28
|
+
* - Second page visit (warm): social proof renders from localStorage after hydration in Confluence
|
|
29
|
+
* (immediately in other apps and on client-only mounts). Background refresh keeps localStorage fresh.
|
|
31
30
|
*
|
|
32
31
|
* Callers decide separately (e.g. via Statsig experiment) whether to surface the data.
|
|
33
32
|
*/
|
|
@@ -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: "46.19.
|
|
7
|
+
packageVersion: "46.19.6" || ''
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
var PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "46.19.
|
|
15
|
+
packageVersion: "46.19.6",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** Use deterministic content
|
|
1
|
+
/** Use deterministic content during SSR/hydration in Confluence only. */
|
|
2
2
|
export default function useHydrationSafeContent(isEligible?: boolean): boolean;
|
|
@@ -17,9 +17,8 @@ export interface SocialProof {
|
|
|
17
17
|
* This means:
|
|
18
18
|
* - First page visit (cold): no social proof rendered, no experiment exposure fired.
|
|
19
19
|
* Background fetch populates localStorage for next time.
|
|
20
|
-
* - Second page visit (warm): social proof renders from localStorage
|
|
21
|
-
*
|
|
22
|
-
* Background refresh keeps localStorage fresh.
|
|
20
|
+
* - Second page visit (warm): social proof renders from localStorage after hydration in Confluence
|
|
21
|
+
* (immediately in other apps and on client-only mounts). Background refresh keeps localStorage fresh.
|
|
23
22
|
*
|
|
24
23
|
* Callers decide separately (e.g. via Statsig experiment) whether to surface the data.
|
|
25
24
|
*/
|