@atlaskit/smart-card 23.1.1 → 23.1.2

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,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 23.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5bdea3e4375`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5bdea3e4375) - Re register card when redux store is recreated
8
+
3
9
  ## 23.1.1
4
10
 
5
11
  ### Patch Changes
@@ -31,6 +31,8 @@ var _jsonld = require("../../utils/jsonld");
31
31
 
32
32
  var _analytics = require("../analytics");
33
33
 
34
+ var _constants2 = require("../../constants");
35
+
34
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
37
 
36
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -45,7 +47,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
45
47
  dispatch = store.dispatch;
46
48
 
47
49
  var _ref = getState()[url] || {
48
- status: 'pending',
50
+ status: _constants2.SmartLinkStatus.Pending,
49
51
  details: undefined
50
52
  },
51
53
  details = _ref.details,
@@ -178,7 +180,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
178
180
  })), [url, hasData, connections.client, handleResolvedLinkResponse, handleResolvedLinkError, id]);
179
181
  var register = (0, _react.useCallback)(function () {
180
182
  if (!details) {
181
- dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_PENDING, {
183
+ dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_RESOLVING, {
182
184
  url: url
183
185
  }));
184
186
  setMetadataStatus('pending');
@@ -21,8 +21,14 @@ var _analytics = require("../analytics");
21
21
 
22
22
  var _renderers = require("../renderers");
23
23
 
24
+ var _linkProvider = require("@atlaskit/link-provider");
25
+
24
26
  function useSmartLink(id, url, dispatchAnalytics) {
25
27
  var state = (0, _store.useSmartCardState)(url);
28
+
29
+ var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
30
+ store = _useSmartLinkContext.store;
31
+
26
32
  var analytics = (0, _analytics.useSmartLinkAnalytics)(url, dispatchAnalytics, id);
27
33
  var actions = (0, _actions.useSmartCardActions)(id, url, analytics);
28
34
  var config = (0, _config.useSmartLinkConfig)();
@@ -42,7 +48,7 @@ function useSmartLink(id, url, dispatchAnalytics) {
42
48
  // eslint-disable-next-line react-hooks/exhaustive-deps
43
49
 
44
50
 
45
- (0, _react.useEffect)(register, [url]); // Provide the state and card actions to consumers.
51
+ (0, _react.useEffect)(register, [url, store]); // Provide the state and card actions to consumers.
46
52
 
47
53
  return {
48
54
  state: state,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.1",
3
+ "version": "23.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -121,7 +121,7 @@ function CardWithUrlContent(_ref) {
121
121
  (0, _react.useEffect)(function () {
122
122
  measure.mark(id, state.status);
123
123
 
124
- if (state.status !== 'pending') {
124
+ if (state.status !== 'pending' && state.status !== 'resolving') {
125
125
  measure.create(id, state.status);
126
126
  analytics.operational.instrument({
127
127
  id: id,
@@ -1,12 +1,13 @@
1
1
  import { useMemo, useCallback } from 'react';
2
2
  import { auth } from '@atlaskit/outbound-auth-flow-client';
3
3
  import { useSmartLinkContext } from '@atlaskit/link-provider';
4
- import { ACTION_PENDING, ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError } from '@atlaskit/linking-common';
4
+ import { ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError, ACTION_RESOLVING } from '@atlaskit/linking-common';
5
5
  import { getDefinitionId, getByDefinitionId, getServices, getStatus, getExtensionKey } from '../helpers';
6
6
  import { ERROR_MESSAGE_OAUTH, ERROR_MESSAGE_FATAL, ERROR_MESSAGE_METADATA } from './constants';
7
7
  import * as measure from '../../utils/performance';
8
8
  import { getUnauthorizedJsonLd } from '../../utils/jsonld';
9
9
  import { addMetadataToExperience } from '../analytics';
10
+ import { SmartLinkStatus } from '../../constants';
10
11
  export const useSmartCardActions = (id, url, analytics) => {
11
12
  const {
12
13
  store,
@@ -22,7 +23,7 @@ export const useSmartCardActions = (id, url, analytics) => {
22
23
  status,
23
24
  metadataStatus
24
25
  } = getState()[url] || {
25
- status: 'pending',
26
+ status: SmartLinkStatus.Pending,
26
27
  details: undefined
27
28
  };
28
29
  const hasAuthFlowSupported = config.authFlow !== 'disabled';
@@ -125,7 +126,7 @@ export const useSmartCardActions = (id, url, analytics) => {
125
126
  }, [url, hasData, connections.client, handleResolvedLinkResponse, handleResolvedLinkError, id]);
126
127
  const register = useCallback(() => {
127
128
  if (!details) {
128
- dispatch(cardAction(ACTION_PENDING, {
129
+ dispatch(cardAction(ACTION_RESOLVING, {
129
130
  url
130
131
  }));
131
132
  setMetadataStatus('pending');
@@ -4,8 +4,12 @@ import { useSmartCardActions as useSmartLinkActions } from '../actions';
4
4
  import { useSmartLinkConfig } from '../config';
5
5
  import { useSmartLinkAnalytics } from '../analytics';
6
6
  import { useSmartLinkRenderers } from '../renderers';
7
+ import { useSmartLinkContext } from '@atlaskit/link-provider';
7
8
  export function useSmartLink(id, url, dispatchAnalytics) {
8
9
  const state = useSmartLinkState(url);
10
+ const {
11
+ store
12
+ } = useSmartLinkContext();
9
13
  const analytics = useSmartLinkAnalytics(url, dispatchAnalytics, id);
10
14
  const actions = useSmartLinkActions(id, url, analytics);
11
15
  const config = useSmartLinkConfig();
@@ -19,7 +23,7 @@ export function useSmartLink(id, url, dispatchAnalytics) {
19
23
  // eslint-disable-next-line react-hooks/exhaustive-deps
20
24
 
21
25
 
22
- useEffect(register, [url]); // Provide the state and card actions to consumers.
26
+ useEffect(register, [url, store]); // Provide the state and card actions to consumers.
23
27
 
24
28
  return {
25
29
  state,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.1",
3
+ "version": "23.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -88,7 +88,7 @@ export function CardWithUrlContent({
88
88
  useEffect(() => {
89
89
  measure.mark(id, state.status);
90
90
 
91
- if (state.status !== 'pending') {
91
+ if (state.status !== 'pending' && state.status !== 'resolving') {
92
92
  measure.create(id, state.status);
93
93
  analytics.operational.instrument({
94
94
  id,
@@ -3,12 +3,13 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useMemo, useCallback } from 'react';
4
4
  import { auth } from '@atlaskit/outbound-auth-flow-client';
5
5
  import { useSmartLinkContext } from '@atlaskit/link-provider';
6
- import { ACTION_PENDING, ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError } from '@atlaskit/linking-common';
6
+ import { ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError, ACTION_RESOLVING } from '@atlaskit/linking-common';
7
7
  import { getDefinitionId, getByDefinitionId, getServices, getStatus, getExtensionKey } from '../helpers';
8
8
  import { ERROR_MESSAGE_OAUTH, ERROR_MESSAGE_FATAL, ERROR_MESSAGE_METADATA } from './constants';
9
9
  import * as measure from '../../utils/performance';
10
10
  import { getUnauthorizedJsonLd } from '../../utils/jsonld';
11
11
  import { addMetadataToExperience } from '../analytics';
12
+ import { SmartLinkStatus } from '../../constants';
12
13
  export var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
13
14
  var _useSmartLinkContext = useSmartLinkContext(),
14
15
  store = _useSmartLinkContext.store,
@@ -19,7 +20,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
19
20
  dispatch = store.dispatch;
20
21
 
21
22
  var _ref = getState()[url] || {
22
- status: 'pending',
23
+ status: SmartLinkStatus.Pending,
23
24
  details: undefined
24
25
  },
25
26
  details = _ref.details,
@@ -152,7 +153,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
152
153
  })), [url, hasData, connections.client, handleResolvedLinkResponse, handleResolvedLinkError, id]);
153
154
  var register = useCallback(function () {
154
155
  if (!details) {
155
- dispatch(cardAction(ACTION_PENDING, {
156
+ dispatch(cardAction(ACTION_RESOLVING, {
156
157
  url: url
157
158
  }));
158
159
  setMetadataStatus('pending');
@@ -5,8 +5,13 @@ import { useSmartCardActions as useSmartLinkActions } from '../actions';
5
5
  import { useSmartLinkConfig } from '../config';
6
6
  import { useSmartLinkAnalytics } from '../analytics';
7
7
  import { useSmartLinkRenderers } from '../renderers';
8
+ import { useSmartLinkContext } from '@atlaskit/link-provider';
8
9
  export function useSmartLink(id, url, dispatchAnalytics) {
9
10
  var state = useSmartLinkState(url);
11
+
12
+ var _useSmartLinkContext = useSmartLinkContext(),
13
+ store = _useSmartLinkContext.store;
14
+
10
15
  var analytics = useSmartLinkAnalytics(url, dispatchAnalytics, id);
11
16
  var actions = useSmartLinkActions(id, url, analytics);
12
17
  var config = useSmartLinkConfig();
@@ -26,7 +31,7 @@ export function useSmartLink(id, url, dispatchAnalytics) {
26
31
  // eslint-disable-next-line react-hooks/exhaustive-deps
27
32
 
28
33
 
29
- useEffect(register, [url]); // Provide the state and card actions to consumers.
34
+ useEffect(register, [url, store]); // Provide the state and card actions to consumers.
30
35
 
31
36
  return {
32
37
  state: state,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.1",
3
+ "version": "23.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -94,7 +94,7 @@ export function CardWithUrlContent(_ref) {
94
94
  useEffect(function () {
95
95
  measure.mark(id, state.status);
96
96
 
97
- if (state.status !== 'pending') {
97
+ if (state.status !== 'pending' && state.status !== 'resolving') {
98
98
  measure.create(id, state.status);
99
99
  analytics.operational.instrument({
100
100
  id: id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.1",
3
+ "version": "23.1.2",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,21 +34,21 @@
34
34
  "@atlaskit/analytics-next": "^8.2.0",
35
35
  "@atlaskit/avatar": "^21.1.0",
36
36
  "@atlaskit/avatar-group": "^9.1.0",
37
- "@atlaskit/button": "^16.3.0",
37
+ "@atlaskit/button": "^16.4.0",
38
38
  "@atlaskit/dropdown-menu": "^11.5.0",
39
39
  "@atlaskit/icon": "^21.11.0",
40
40
  "@atlaskit/icon-file-type": "^6.3.0",
41
41
  "@atlaskit/icon-object": "^6.2.0",
42
42
  "@atlaskit/icon-priority": "^6.3.0",
43
43
  "@atlaskit/in-product-testing": "^0.1.0",
44
- "@atlaskit/linking-common": "^1.9.0",
44
+ "@atlaskit/linking-common": "^1.10.0",
45
45
  "@atlaskit/logo": "^13.10.0",
46
- "@atlaskit/lozenge": "^11.2.0",
47
- "@atlaskit/media-common": "^2.16.0",
46
+ "@atlaskit/lozenge": "^11.3.0",
47
+ "@atlaskit/media-common": "^2.17.0",
48
48
  "@atlaskit/modal-dialog": "^12.4.0",
49
49
  "@atlaskit/outbound-auth-flow-client": "^3.3.0",
50
50
  "@atlaskit/popup": "^1.5.0",
51
- "@atlaskit/spinner": "^15.1.0",
51
+ "@atlaskit/spinner": "^15.2.0",
52
52
  "@atlaskit/theme": "^12.2.0",
53
53
  "@atlaskit/tokens": "^0.10.0",
54
54
  "@atlaskit/tooltip": "^17.6.0",
@@ -78,14 +78,14 @@
78
78
  "@atlaskit/css-reset": "^6.3.0",
79
79
  "@atlaskit/docs": "*",
80
80
  "@atlaskit/field-base": "^15.0.6",
81
- "@atlaskit/form": "^8.6.0",
81
+ "@atlaskit/form": "^8.7.0",
82
82
  "@atlaskit/inline-message": "^11.4.0",
83
- "@atlaskit/lozenge": "^11.2.0",
83
+ "@atlaskit/lozenge": "^11.3.0",
84
84
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
85
85
  "@atlaskit/media-test-helpers": "^30.0.0",
86
86
  "@atlaskit/page": "^12.2.0",
87
87
  "@atlaskit/radio": "^5.4.0",
88
- "@atlaskit/range": "^6.1.0",
88
+ "@atlaskit/range": "^7.0.0",
89
89
  "@atlaskit/section-message": "^6.3.0",
90
90
  "@atlaskit/select": "^15.7.0",
91
91
  "@atlaskit/table-tree": "^9.2.0",