@atlaskit/smart-card 23.1.0 → 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,18 @@
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
+
9
+ ## 23.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`d2cde0ebdfd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2cde0ebdfd) - fix editor cypress tests and delete media cypress tests
14
+ - [`8f95d913495`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8f95d913495) - Smart Link: Add default view to inline/block/embed appearance
15
+
3
16
  ## 23.1.0
4
17
 
5
18
  ### Minor Changes
@@ -10,15 +10,13 @@ var _inProductTesting = require("@atlaskit/in-product-testing");
10
10
  var _EmbedCard = require("../page-objects/EmbedCard");
11
11
 
12
12
  var embedSmartLinkRendersTestCase = function embedSmartLinkRendersTestCase(_ref) {
13
- var url = _ref.url,
14
- _ref$status = _ref.status,
13
+ var _ref$status = _ref.status,
15
14
  status = _ref$status === void 0 ? 'resolved' : _ref$status;
16
15
  return new _inProductTesting.InProductTestCase({
17
16
  title: 'Embed Smart Link is visible in the resolved state',
18
17
  id: 'embed-smart-link-resolved',
19
18
  assertions: function assertions(cy) {
20
19
  var embedCard = new _EmbedCard.EmbedCardPageObject(cy);
21
- embedCard.assertHrefRendered(url);
22
20
  embedCard.expectCardReady(1, status);
23
21
  }
24
22
  });
@@ -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.0",
3
+ "version": "23.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -214,6 +214,7 @@ var BlockCard = function BlockCard(_ref) {
214
214
 
215
215
  case 'fallback':
216
216
  case 'errored':
217
+ default:
217
218
  if (onError) {
218
219
  onError({
219
220
  url: url,
@@ -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,
@@ -182,6 +182,7 @@ var EmbedCard = /*#__PURE__*/_react.default.forwardRef(function (_ref, iframeRef
182
182
 
183
183
  case 'fallback':
184
184
  case 'errored':
185
+ default:
185
186
  if (onError) {
186
187
  onError({
187
188
  url: url,
@@ -175,6 +175,7 @@ var InlineCard = function InlineCard(_ref) {
175
175
 
176
176
  case 'fallback':
177
177
  case 'errored':
178
+ default:
178
179
  if (onError) {
179
180
  onError({
180
181
  url: url,
@@ -1,14 +1,12 @@
1
1
  import { InProductTestCase } from '@atlaskit/in-product-testing';
2
2
  import { EmbedCardPageObject } from '../page-objects/EmbedCard';
3
3
  export const embedSmartLinkRendersTestCase = ({
4
- url,
5
4
  status = 'resolved'
6
5
  }) => new InProductTestCase({
7
6
  title: 'Embed Smart Link is visible in the resolved state',
8
7
  id: 'embed-smart-link-resolved',
9
8
  assertions: cy => {
10
9
  const embedCard = new EmbedCardPageObject(cy);
11
- embedCard.assertHrefRendered(url);
12
10
  embedCard.expectCardReady(1, status);
13
11
  }
14
12
  });
@@ -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.0",
3
+ "version": "23.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -137,6 +137,7 @@ export const BlockCard = ({
137
137
 
138
138
  case 'fallback':
139
139
  case 'errored':
140
+ default:
140
141
  if (onError) {
141
142
  onError({
142
143
  url,
@@ -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,
@@ -160,6 +160,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
160
160
 
161
161
  case 'fallback':
162
162
  case 'errored':
163
+ default:
163
164
  if (onError) {
164
165
  onError({
165
166
  url,
@@ -128,6 +128,7 @@ export const InlineCard = ({
128
128
 
129
129
  case 'fallback':
130
130
  case 'errored':
131
+ default:
131
132
  if (onError) {
132
133
  onError({
133
134
  url,
@@ -1,15 +1,13 @@
1
1
  import { InProductTestCase } from '@atlaskit/in-product-testing';
2
2
  import { EmbedCardPageObject } from '../page-objects/EmbedCard';
3
3
  export var embedSmartLinkRendersTestCase = function embedSmartLinkRendersTestCase(_ref) {
4
- var url = _ref.url,
5
- _ref$status = _ref.status,
4
+ var _ref$status = _ref.status,
6
5
  status = _ref$status === void 0 ? 'resolved' : _ref$status;
7
6
  return new InProductTestCase({
8
7
  title: 'Embed Smart Link is visible in the resolved state',
9
8
  id: 'embed-smart-link-resolved',
10
9
  assertions: function assertions(cy) {
11
10
  var embedCard = new EmbedCardPageObject(cy);
12
- embedCard.assertHrefRendered(url);
13
11
  embedCard.expectCardReady(1, status);
14
12
  }
15
13
  });
@@ -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.0",
3
+ "version": "23.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -135,6 +135,7 @@ export var BlockCard = function BlockCard(_ref) {
135
135
 
136
136
  case 'fallback':
137
137
  case 'errored':
138
+ default:
138
139
  if (onError) {
139
140
  onError({
140
141
  url: url,
@@ -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,
@@ -158,6 +158,7 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
158
158
 
159
159
  case 'fallback':
160
160
  case 'errored':
161
+ default:
161
162
  if (onError) {
162
163
  onError({
163
164
  url: url,
@@ -125,6 +125,7 @@ export var InlineCard = function InlineCard(_ref) {
125
125
 
126
126
  case 'fallback':
127
127
  case 'errored':
128
+ default:
128
129
  if (onError) {
129
130
  onError({
130
131
  url: url,
@@ -1,3 +1,3 @@
1
1
  import { InProductTestCase } from '@atlaskit/in-product-testing';
2
2
  import { SmartLinkTestCaseOpts } from './types';
3
- export declare const embedSmartLinkRendersTestCase: ({ url, status, }: SmartLinkTestCaseOpts) => InProductTestCase;
3
+ export declare const embedSmartLinkRendersTestCase: ({ status, }: SmartLinkTestCaseOpts) => InProductTestCase;
@@ -1,3 +1,3 @@
1
1
  import { InProductTestCase } from '@atlaskit/in-product-testing';
2
2
  import { SmartLinkTestCaseOpts } from './types';
3
- export declare const embedSmartLinkRendersTestCase: ({ url, status, }: SmartLinkTestCaseOpts) => InProductTestCase;
3
+ export declare const embedSmartLinkRendersTestCase: ({ status, }: SmartLinkTestCaseOpts) => InProductTestCase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.0",
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",