@atlaskit/smart-card 26.5.6 → 26.5.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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/feature-discovery/index.js +13 -5
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/feature-discovery/index.js +14 -8
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/common/lozenge-action/feature-discovery/index.js +14 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.5.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5b5d7b22e80`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5b5d7b22e80) - [ux] Update feature discovery on lozenge action to display for 2s before marking it as discovered
|
|
8
|
+
|
|
3
9
|
## 26.5.6
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/feature-discovery/index.js
CHANGED
|
@@ -12,7 +12,9 @@ var _styled = require("./styled");
|
|
|
12
12
|
|
|
13
13
|
var LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/smart-card';
|
|
14
14
|
var LOCAL_STORAGE_DISCOVERY_KEY = 'action-discovery-status';
|
|
15
|
+
var LOCAL_STORAGE_DISCOVERY_VALUE = 'discovered';
|
|
15
16
|
var LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS = 15552000000; // 180 days
|
|
17
|
+
var LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME = 2000; // 2s
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* This is a hacky solution to help with the feature discovery.
|
|
@@ -24,17 +26,23 @@ var FeatureDiscovery = function FeatureDiscovery(_ref) {
|
|
|
24
26
|
var appearance = _ref.appearance,
|
|
25
27
|
children = _ref.children,
|
|
26
28
|
testId = _ref.testId;
|
|
29
|
+
var renderedTime = (0, _react2.useRef)();
|
|
27
30
|
var storageClient = (0, _react2.useMemo)(function () {
|
|
28
31
|
return new _storageClient.StorageClient(LOCAL_STORAGE_CLIENT_KEY);
|
|
29
32
|
}, []);
|
|
30
33
|
var discovered = (0, _react2.useMemo)(function () {
|
|
31
|
-
|
|
32
|
-
return (_storageClient$getIte = storageClient.getItem(LOCAL_STORAGE_DISCOVERY_KEY)) !== null && _storageClient$getIte !== void 0 ? _storageClient$getIte : false;
|
|
34
|
+
return storageClient.getItem(LOCAL_STORAGE_DISCOVERY_KEY) === LOCAL_STORAGE_DISCOVERY_VALUE;
|
|
33
35
|
}, [storageClient]);
|
|
34
36
|
(0, _react2.useEffect)(function () {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
renderedTime.current = Date.now();
|
|
38
|
+
return function () {
|
|
39
|
+
if (!discovered && renderedTime.current) {
|
|
40
|
+
var duration = Date.now() - renderedTime.current;
|
|
41
|
+
if (duration > LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME) {
|
|
42
|
+
storageClient.setItemWithExpiry(LOCAL_STORAGE_DISCOVERY_KEY, LOCAL_STORAGE_DISCOVERY_VALUE, LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
38
46
|
}, [storageClient, discovered]);
|
|
39
47
|
var component = (0, _react2.useMemo)(function () {
|
|
40
48
|
if (!discovered) {
|
package/dist/es2019/version.json
CHANGED
package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/feature-discovery/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
|
|
5
5
|
import { getPulseStyles } from './styled';
|
|
6
6
|
const LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/smart-card';
|
|
7
7
|
const LOCAL_STORAGE_DISCOVERY_KEY = 'action-discovery-status';
|
|
8
|
+
const LOCAL_STORAGE_DISCOVERY_VALUE = 'discovered';
|
|
8
9
|
const LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS = 15552000000; // 180 days
|
|
10
|
+
const LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME = 2000; // 2s
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* This is a hacky solution to help with the feature discovery.
|
|
@@ -18,15 +20,19 @@ const FeatureDiscovery = ({
|
|
|
18
20
|
children,
|
|
19
21
|
testId
|
|
20
22
|
}) => {
|
|
23
|
+
const renderedTime = useRef();
|
|
21
24
|
const storageClient = useMemo(() => new StorageClient(LOCAL_STORAGE_CLIENT_KEY), []);
|
|
22
|
-
const discovered = useMemo(() =>
|
|
23
|
-
var _storageClient$getIte;
|
|
24
|
-
return (_storageClient$getIte = storageClient.getItem(LOCAL_STORAGE_DISCOVERY_KEY)) !== null && _storageClient$getIte !== void 0 ? _storageClient$getIte : false;
|
|
25
|
-
}, [storageClient]);
|
|
25
|
+
const discovered = useMemo(() => storageClient.getItem(LOCAL_STORAGE_DISCOVERY_KEY) === LOCAL_STORAGE_DISCOVERY_VALUE, [storageClient]);
|
|
26
26
|
useEffect(() => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
renderedTime.current = Date.now();
|
|
28
|
+
return () => {
|
|
29
|
+
if (!discovered && renderedTime.current) {
|
|
30
|
+
const duration = Date.now() - renderedTime.current;
|
|
31
|
+
if (duration > LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME) {
|
|
32
|
+
storageClient.setItemWithExpiry(LOCAL_STORAGE_DISCOVERY_KEY, LOCAL_STORAGE_DISCOVERY_VALUE, LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
30
36
|
}, [storageClient, discovered]);
|
|
31
37
|
const component = useMemo(() => {
|
|
32
38
|
if (!discovered) {
|
package/dist/esm/version.json
CHANGED
package/dist/esm/view/FlexibleCard/components/common/lozenge-action/feature-discovery/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
|
|
5
5
|
import { getPulseStyles } from './styled';
|
|
6
6
|
var LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/smart-card';
|
|
7
7
|
var LOCAL_STORAGE_DISCOVERY_KEY = 'action-discovery-status';
|
|
8
|
+
var LOCAL_STORAGE_DISCOVERY_VALUE = 'discovered';
|
|
8
9
|
var LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS = 15552000000; // 180 days
|
|
10
|
+
var LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME = 2000; // 2s
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* This is a hacky solution to help with the feature discovery.
|
|
@@ -17,17 +19,23 @@ var FeatureDiscovery = function FeatureDiscovery(_ref) {
|
|
|
17
19
|
var appearance = _ref.appearance,
|
|
18
20
|
children = _ref.children,
|
|
19
21
|
testId = _ref.testId;
|
|
22
|
+
var renderedTime = useRef();
|
|
20
23
|
var storageClient = useMemo(function () {
|
|
21
24
|
return new StorageClient(LOCAL_STORAGE_CLIENT_KEY);
|
|
22
25
|
}, []);
|
|
23
26
|
var discovered = useMemo(function () {
|
|
24
|
-
|
|
25
|
-
return (_storageClient$getIte = storageClient.getItem(LOCAL_STORAGE_DISCOVERY_KEY)) !== null && _storageClient$getIte !== void 0 ? _storageClient$getIte : false;
|
|
27
|
+
return storageClient.getItem(LOCAL_STORAGE_DISCOVERY_KEY) === LOCAL_STORAGE_DISCOVERY_VALUE;
|
|
26
28
|
}, [storageClient]);
|
|
27
29
|
useEffect(function () {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
renderedTime.current = Date.now();
|
|
31
|
+
return function () {
|
|
32
|
+
if (!discovered && renderedTime.current) {
|
|
33
|
+
var duration = Date.now() - renderedTime.current;
|
|
34
|
+
if (duration > LOCAL_STORAGE_DISCOVERY_REQUIRED_TIME) {
|
|
35
|
+
storageClient.setItemWithExpiry(LOCAL_STORAGE_DISCOVERY_KEY, LOCAL_STORAGE_DISCOVERY_VALUE, LOCAL_STORAGE_DISCOVERY_EXPIRY_IN_MS);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
31
39
|
}, [storageClient, discovered]);
|
|
32
40
|
var component = useMemo(function () {
|
|
33
41
|
if (!discovered) {
|