@atlaskit/smart-card 42.3.3 → 42.3.5
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/dist/cjs/messages.js +0 -10
- package/dist/cjs/state/actions/index.js +6 -8
- package/dist/cjs/state/hooks/useSmartLink.js +3 -3
- package/dist/cjs/state/store/index.js +1 -5
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +15 -14
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/index.js +13 -5
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/index.js +3 -26
- package/dist/cjs/view/LinkUrl/index.js +23 -30
- package/dist/es2019/messages.js +0 -10
- package/dist/es2019/state/actions/index.js +4 -6
- package/dist/es2019/state/hooks/useSmartLink.js +3 -3
- package/dist/es2019/state/store/index.js +1 -5
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +15 -14
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/index.js +12 -5
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/index.js +3 -27
- package/dist/es2019/view/LinkUrl/index.js +23 -28
- package/dist/esm/messages.js +0 -10
- package/dist/esm/state/actions/index.js +6 -8
- package/dist/esm/state/hooks/useSmartLink.js +3 -3
- package/dist/esm/state/store/index.js +1 -5
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +15 -14
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +1 -1
- package/dist/esm/view/FlexibleCard/index.js +12 -5
- package/dist/esm/view/LinkUrl/HyperlinkResolver/index.js +3 -26
- package/dist/esm/view/LinkUrl/index.js +23 -28
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/actions/index.d.ts +1 -2
- package/dist/types/state/hooks/useSmartLink.d.ts +2 -3
- package/dist/types/state/store/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/index.d.ts +13 -1
- package/dist/types/view/LinkUrl/HyperlinkResolver/index.d.ts +0 -5
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/actions/index.d.ts +1 -2
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +2 -3
- package/dist/types-ts4.5/state/store/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/index.d.ts +13 -1
- package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/index.d.ts +0 -5
- package/package.json +5 -8
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/error-boundary.js +0 -18
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.js +0 -70
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/error-boundary.js +0 -9
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.js +0 -60
- package/dist/esm/view/LinkUrl/HyperlinkResolver/error-boundary.js +0 -11
- package/dist/esm/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.js +0 -62
- package/dist/types/view/LinkUrl/HyperlinkResolver/error-boundary.d.ts +0 -4
- package/dist/types/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.d.ts +0 -3
- package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/error-boundary.d.ts +0 -4
- package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.d.ts +0 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { CardState } from '@atlaskit/linking-common';
|
|
2
3
|
import { type FlexibleCardProps } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* This represents a Flexible Card: a link represented by a card with metadata.
|
|
@@ -6,5 +7,16 @@ import { type FlexibleCardProps } from './types';
|
|
|
6
7
|
* Note: TitleBlock is mandatory for a Flexible Card to render.
|
|
7
8
|
* @see Container
|
|
8
9
|
*/
|
|
9
|
-
declare const FlexibleCard: ({ appearance, cardState, children, id, onAuthorize, onClick, onError, onResolve, origin, renderers, showHoverPreview, hoverPreviewOptions, actionOptions, testId, ui, url, }: FlexibleCardProps
|
|
10
|
+
declare const FlexibleCard: ({ appearance, cardState, placeholderData, children, id, onAuthorize, onClick, onError, onResolve, origin, renderers, showHoverPreview, hoverPreviewOptions, actionOptions, testId, ui, url, }: FlexibleCardProps & {
|
|
11
|
+
/**
|
|
12
|
+
* @experimental
|
|
13
|
+
* This is a new prop that is not part of the public API - DO NOT USE.
|
|
14
|
+
* If provided, the card will display using the respective object for the first render (particularly useful for SSR),
|
|
15
|
+
* while still resolving `url` in the background.
|
|
16
|
+
* Placeholder data should be considered a transient state - in the sense that it will not persisted to the main store -
|
|
17
|
+
* and it will be replaced by the actual data when the given `url` is resolved.
|
|
18
|
+
* ANIP-288: Expose this prop to the public API
|
|
19
|
+
*/
|
|
20
|
+
placeholderData?: CardState;
|
|
21
|
+
}) => React.JSX.Element;
|
|
10
22
|
export default FlexibleCard;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { LinkUrlProps } from '../types';
|
|
3
3
|
export declare const HyperlinkWithSmartLinkResolver: React.ForwardRefExoticComponent<LinkUrlProps & React.RefAttributes<any>>;
|
|
4
|
-
export interface HyperlinkResolverProps {
|
|
5
|
-
href: string;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: (props: HyperlinkResolverProps) => React.JSX.Element;
|
|
8
|
-
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MessageDescriptor } from 'react-intl-next';
|
|
2
2
|
export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_title' | 'request_access_pending_description' | 'request_denied_description' | 'default_no_access_title' | 'direct_access_title' | 'direct_access_description' | 'direct_access' | 'access_exists_description' | 'not_found_description' | 'not_found_title';
|
|
3
|
-
export type MessageKey = 'assigned_to' | 'ai_summarize' | 'ai_summarized' | 'ai_summarized_abbreviation' | 'ai_summarized_info' | 'ai_summarized_info_short' | 'ai_summarizing' | 'ai_summary_error_generic' | 'ai_summary_error_acceptable_use_violation' | 'ai_summary_error_hipaa_content_detected' | 'ai_summary_error_exceeding_context_length_error' | 'ai_summary_action' | 'ai_summary_action_description' | 'automation_action_title' | 'automation_action_tooltip' | 'automation_action_icon_label' | 'automation_action_confluence_page_modal_title' | 'automation_action_confluence_page_modal_description' | 'copy_summary_action' | 'copy_summary_action_description' | 'copied_summary_action_description' | 'beta' | 'cannot_find_link' | 'compass_applied_components_count' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'copied_url_to_clipboard' | 'could_not_load_link' | 'download' | 'download_description' | 'download_file' | 'follow' | 'follow_project_description' | 'follow_project_descriptionGalaxia' | 'follow_project' | '
|
|
3
|
+
export type MessageKey = 'assigned_to' | 'ai_summarize' | 'ai_summarized' | 'ai_summarized_abbreviation' | 'ai_summarized_info' | 'ai_summarized_info_short' | 'ai_summarizing' | 'ai_summary_error_generic' | 'ai_summary_error_acceptable_use_violation' | 'ai_summary_error_hipaa_content_detected' | 'ai_summary_error_exceeding_context_length_error' | 'ai_summary_action' | 'ai_summary_action_description' | 'automation_action_title' | 'automation_action_tooltip' | 'automation_action_icon_label' | 'automation_action_confluence_page_modal_title' | 'automation_action_confluence_page_modal_description' | 'copy_summary_action' | 'copy_summary_action_description' | 'copied_summary_action_description' | 'beta' | 'cannot_find_link' | 'compass_applied_components_count' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'copied_url_to_clipboard' | 'could_not_load_link' | 'download' | 'download_description' | 'download_file' | 'follow' | 'follow_project_description' | 'follow_project_descriptionGalaxia' | 'follow_project' | 'follow_goal' | 'follow_goal_description' | 'follow_project_error' | 'follow_project_errorGalaxia' | 'follow_goal_error' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'learn_more_about_connecting_account' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'owned_by_override' | 'preview_description' | 'preview_improved' | 'preview_modal' | 'preview_panel' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'unfollow_project_description' | 'unfollow_project_descriptionGalaxia' | 'unfollow_project' | 'unfollow_project_error' | 'unfollow_project_errorGalaxia' | 'unfollow_goal' | 'unfollow_goal_description' | 'unfollow_goal_error' | 'user_attributes' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related' | 'generic_error_message' | 'related_links_modal_error_title' | 'related_links_modal_error_description' | 'related_links_modal_unavailable_title' | 'related_links_modal_unavailable_description' | 'related_links_modal_title' | 'related_links_view_related_urls' | 'related_links_view_related_links' | 'related_links_found_in' | 'related_links_includes_links_to' | 'related_links_not_found' | 'join_to_viewIssueTermRefresh' | 'open_issue_in_jiraIssueTermRefresh' | 'request_access_to_viewIssueTermRefresh' | 'team_members_count' | 'status_change_permission_errorIssueTermRefresh' | 'connect_unauthorised_account_description_appify' | 'connect_unauthorised_account_description_no_provider_appify' | 'learn_more_about_connecting_account_appify';
|
|
4
4
|
type Messages = {
|
|
5
5
|
[K in MessageKey]: MessageDescriptor;
|
|
6
6
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type JsonLd } from '@atlaskit/json-ld-types';
|
|
2
|
-
import { type CardState } from '@atlaskit/linking-common';
|
|
3
2
|
import { type InvokeClientOpts, type InvokeServerOpts } from '../../model/invoke-opts';
|
|
4
3
|
import { type CardInnerAppearance } from '../../view/Card/types';
|
|
5
|
-
export declare const useSmartCardActions: (id: string, url: string
|
|
4
|
+
export declare const useSmartCardActions: (id: string, url: string) => {
|
|
6
5
|
register: () => Promise<void>;
|
|
7
6
|
reload: () => void;
|
|
8
7
|
authorize: (appearance: CardInnerAppearance) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
state: CardState;
|
|
1
|
+
export declare function useSmartLink(id: string, url: string): {
|
|
2
|
+
state: import("@atlaskit/linking-common").CardState;
|
|
4
3
|
actions: {
|
|
5
4
|
register: () => Promise<void>;
|
|
6
5
|
reload: () => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type CardState } from '@atlaskit/linking-common';
|
|
2
2
|
export type { CardType } from '@atlaskit/linking-common';
|
|
3
|
-
export declare function useSmartCardState(url: string
|
|
3
|
+
export declare function useSmartCardState(url: string): CardState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { CardState } from '@atlaskit/linking-common';
|
|
2
3
|
import { type FlexibleCardProps } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* This represents a Flexible Card: a link represented by a card with metadata.
|
|
@@ -6,5 +7,16 @@ import { type FlexibleCardProps } from './types';
|
|
|
6
7
|
* Note: TitleBlock is mandatory for a Flexible Card to render.
|
|
7
8
|
* @see Container
|
|
8
9
|
*/
|
|
9
|
-
declare const FlexibleCard: ({ appearance, cardState, children, id, onAuthorize, onClick, onError, onResolve, origin, renderers, showHoverPreview, hoverPreviewOptions, actionOptions, testId, ui, url, }: FlexibleCardProps
|
|
10
|
+
declare const FlexibleCard: ({ appearance, cardState, placeholderData, children, id, onAuthorize, onClick, onError, onResolve, origin, renderers, showHoverPreview, hoverPreviewOptions, actionOptions, testId, ui, url, }: FlexibleCardProps & {
|
|
11
|
+
/**
|
|
12
|
+
* @experimental
|
|
13
|
+
* This is a new prop that is not part of the public API - DO NOT USE.
|
|
14
|
+
* If provided, the card will display using the respective object for the first render (particularly useful for SSR),
|
|
15
|
+
* while still resolving `url` in the background.
|
|
16
|
+
* Placeholder data should be considered a transient state - in the sense that it will not persisted to the main store -
|
|
17
|
+
* and it will be replaced by the actual data when the given `url` is resolved.
|
|
18
|
+
* ANIP-288: Expose this prop to the public API
|
|
19
|
+
*/
|
|
20
|
+
placeholderData?: CardState;
|
|
21
|
+
}) => React.JSX.Element;
|
|
10
22
|
export default FlexibleCard;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { LinkUrlProps } from '../types';
|
|
3
3
|
export declare const HyperlinkWithSmartLinkResolver: React.ForwardRefExoticComponent<LinkUrlProps & React.RefAttributes<any>>;
|
|
4
|
-
export interface HyperlinkResolverProps {
|
|
5
|
-
href: string;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: (props: HyperlinkResolverProps) => React.JSX.Element;
|
|
8
|
-
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "42.3.
|
|
3
|
+
"version": "42.3.5",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@atlaskit/afm-i18n-platform-linking-platform-smart-card": "2.6.0",
|
|
30
30
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
31
31
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
32
|
-
"@atlaskit/avatar": "^25.
|
|
33
|
-
"@atlaskit/avatar-group": "^12.
|
|
32
|
+
"@atlaskit/avatar": "^25.3.0",
|
|
33
|
+
"@atlaskit/avatar-group": "^12.3.0",
|
|
34
34
|
"@atlaskit/badge": "^18.2.0",
|
|
35
|
-
"@atlaskit/button": "^23.
|
|
35
|
+
"@atlaskit/button": "^23.5.0",
|
|
36
36
|
"@atlaskit/checkbox": "^17.1.0",
|
|
37
37
|
"@atlaskit/css": "^0.14.0",
|
|
38
38
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/textarea": "^8.0.0",
|
|
71
71
|
"@atlaskit/textfield": "^8.0.0",
|
|
72
72
|
"@atlaskit/theme": "^21.0.0",
|
|
73
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
73
|
+
"@atlaskit/tmp-editor-statsig": "^13.2.0",
|
|
74
74
|
"@atlaskit/tokens": "^6.4.0",
|
|
75
75
|
"@atlaskit/tooltip": "^20.5.0",
|
|
76
76
|
"@atlaskit/ufo": "^0.4.0",
|
|
@@ -220,9 +220,6 @@
|
|
|
220
220
|
"platform_deprecate_lp_cc_embed": {
|
|
221
221
|
"type": "boolean"
|
|
222
222
|
},
|
|
223
|
-
"navx-1834-refactor-resolved-hyperlink": {
|
|
224
|
-
"type": "boolean"
|
|
225
|
-
},
|
|
226
223
|
"platform_linking_plain_hyperlink_connect_button": {
|
|
227
224
|
"type": "boolean"
|
|
228
225
|
},
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactErrorBoundary = require("react-error-boundary");
|
|
10
|
-
// Remove on navx-1834-refactor-resolved-hyperlink cleanup
|
|
11
|
-
var withErrorBoundary = function withErrorBoundary(Component) {
|
|
12
|
-
return function (props) {
|
|
13
|
-
return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
14
|
-
fallback: null
|
|
15
|
-
}, /*#__PURE__*/_react.default.createElement(Component, props));
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
var _default = exports.default = withErrorBoundary;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.ResolveHyperlink = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
12
|
-
var _useAnalyticsEvents2 = require("../../../common/analytics/generated/use-analytics-events");
|
|
13
|
-
var _actions = require("../../../state/actions");
|
|
14
|
-
var _helpers = require("../../../state/helpers");
|
|
15
|
-
var _useScheduledRegister = require("../../../state/hooks/use-resolve-hyperlink/useScheduledRegister");
|
|
16
|
-
var _store = require("../../../state/store");
|
|
17
|
-
var measure = _interopRequireWildcard(require("../../../utils/performance"));
|
|
18
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
-
// Remove on navx-1834-refactor-resolved-hyperlink cleanup
|
|
20
|
-
var ResolveHyperlink = exports.ResolveHyperlink = function ResolveHyperlink(_ref) {
|
|
21
|
-
var href = _ref.href;
|
|
22
|
-
var _useState = (0, _react.useState)(function () {
|
|
23
|
-
return (0, _uuid.default)();
|
|
24
|
-
}),
|
|
25
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 1),
|
|
26
|
-
id = _useState2[0];
|
|
27
|
-
var state = (0, _store.useSmartCardState)(href);
|
|
28
|
-
var definitionId = (0, _helpers.getDefinitionId)(state.details);
|
|
29
|
-
var extensionKey = (0, _helpers.getExtensionKey)(state.details);
|
|
30
|
-
var resourceType = (0, _helpers.getResourceType)(state.details);
|
|
31
|
-
var _useSmartCardActions = (0, _actions.useSmartCardActions)(id, href),
|
|
32
|
-
register = _useSmartCardActions.register;
|
|
33
|
-
var scheduledRegister = (0, _useScheduledRegister.useScheduledRegister)(href, register);
|
|
34
|
-
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
35
|
-
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
36
|
-
(0, _react.useEffect)(function () {
|
|
37
|
-
scheduledRegister().catch(function (error) {
|
|
38
|
-
throw error;
|
|
39
|
-
});
|
|
40
|
-
}, [scheduledRegister]);
|
|
41
|
-
(0, _react.useEffect)(function () {
|
|
42
|
-
measure.mark(id, state.status);
|
|
43
|
-
if (state.status !== 'pending' && state.status !== 'resolving') {
|
|
44
|
-
var _state$error, _state$error2;
|
|
45
|
-
measure.create(id, state.status);
|
|
46
|
-
if (state.status === 'resolved') {
|
|
47
|
-
var _measure$getMeasure$d, _measure$getMeasure;
|
|
48
|
-
fireEvent('operational.hyperlink.resolved', {
|
|
49
|
-
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
50
|
-
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
|
|
51
|
-
resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
|
|
52
|
-
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(id, state.status)) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null
|
|
53
|
-
});
|
|
54
|
-
} else if (((_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.type) !== 'ResolveUnsupportedError' && ((_state$error2 = state.error) === null || _state$error2 === void 0 ? void 0 : _state$error2.type) !== 'UnsupportedError') {
|
|
55
|
-
fireEvent('operational.hyperlink.unresolved', {
|
|
56
|
-
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
57
|
-
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
|
|
58
|
-
resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
|
|
59
|
-
reason: state.status,
|
|
60
|
-
error: state.error === undefined ? null : {
|
|
61
|
-
name: state.error.name,
|
|
62
|
-
kind: state.error.kind,
|
|
63
|
-
type: state.error.type
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, [id, state.status, state.error, definitionId, extensionKey, resourceType, fireEvent]);
|
|
69
|
-
return null;
|
|
70
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
3
|
-
// Remove on navx-1834-refactor-resolved-hyperlink cleanup
|
|
4
|
-
const withErrorBoundary = Component => props => {
|
|
5
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
6
|
-
fallback: null
|
|
7
|
-
}, /*#__PURE__*/React.createElement(Component, props));
|
|
8
|
-
};
|
|
9
|
-
export default withErrorBoundary;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import uuid from 'uuid';
|
|
3
|
-
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
4
|
-
import { useSmartCardActions } from '../../../state/actions';
|
|
5
|
-
import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
|
|
6
|
-
import { useScheduledRegister } from '../../../state/hooks/use-resolve-hyperlink/useScheduledRegister';
|
|
7
|
-
import { useSmartCardState } from '../../../state/store';
|
|
8
|
-
import * as measure from '../../../utils/performance';
|
|
9
|
-
|
|
10
|
-
// Remove on navx-1834-refactor-resolved-hyperlink cleanup
|
|
11
|
-
export const ResolveHyperlink = ({
|
|
12
|
-
href
|
|
13
|
-
}) => {
|
|
14
|
-
const [id] = useState(() => uuid());
|
|
15
|
-
const state = useSmartCardState(href);
|
|
16
|
-
const definitionId = getDefinitionId(state.details);
|
|
17
|
-
const extensionKey = getExtensionKey(state.details);
|
|
18
|
-
const resourceType = getResourceType(state.details);
|
|
19
|
-
const {
|
|
20
|
-
register
|
|
21
|
-
} = useSmartCardActions(id, href);
|
|
22
|
-
const scheduledRegister = useScheduledRegister(href, register);
|
|
23
|
-
const {
|
|
24
|
-
fireEvent
|
|
25
|
-
} = useAnalyticsEvents();
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
scheduledRegister().catch(error => {
|
|
28
|
-
throw error;
|
|
29
|
-
});
|
|
30
|
-
}, [scheduledRegister]);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
measure.mark(id, state.status);
|
|
33
|
-
if (state.status !== 'pending' && state.status !== 'resolving') {
|
|
34
|
-
var _state$error, _state$error2;
|
|
35
|
-
measure.create(id, state.status);
|
|
36
|
-
if (state.status === 'resolved') {
|
|
37
|
-
var _measure$getMeasure$d, _measure$getMeasure;
|
|
38
|
-
fireEvent('operational.hyperlink.resolved', {
|
|
39
|
-
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
40
|
-
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
|
|
41
|
-
resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
|
|
42
|
-
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(id, state.status)) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null
|
|
43
|
-
});
|
|
44
|
-
} else if (((_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.type) !== 'ResolveUnsupportedError' && ((_state$error2 = state.error) === null || _state$error2 === void 0 ? void 0 : _state$error2.type) !== 'UnsupportedError') {
|
|
45
|
-
fireEvent('operational.hyperlink.unresolved', {
|
|
46
|
-
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
47
|
-
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
|
|
48
|
-
resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
|
|
49
|
-
reason: state.status,
|
|
50
|
-
error: state.error === undefined ? null : {
|
|
51
|
-
name: state.error.name,
|
|
52
|
-
kind: state.error.kind,
|
|
53
|
-
type: state.error.type
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, [id, state.status, state.error, definitionId, extensionKey, resourceType, fireEvent]);
|
|
59
|
-
return null;
|
|
60
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
3
|
-
// Remove on navx-1834-refactor-resolved-hyperlink cleanup
|
|
4
|
-
var withErrorBoundary = function withErrorBoundary(Component) {
|
|
5
|
-
return function (props) {
|
|
6
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
7
|
-
fallback: null
|
|
8
|
-
}, /*#__PURE__*/React.createElement(Component, props));
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default withErrorBoundary;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import uuid from 'uuid';
|
|
4
|
-
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
5
|
-
import { useSmartCardActions } from '../../../state/actions';
|
|
6
|
-
import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
|
|
7
|
-
import { useScheduledRegister } from '../../../state/hooks/use-resolve-hyperlink/useScheduledRegister';
|
|
8
|
-
import { useSmartCardState } from '../../../state/store';
|
|
9
|
-
import * as measure from '../../../utils/performance';
|
|
10
|
-
|
|
11
|
-
// Remove on navx-1834-refactor-resolved-hyperlink cleanup
|
|
12
|
-
export var ResolveHyperlink = function ResolveHyperlink(_ref) {
|
|
13
|
-
var href = _ref.href;
|
|
14
|
-
var _useState = useState(function () {
|
|
15
|
-
return uuid();
|
|
16
|
-
}),
|
|
17
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
18
|
-
id = _useState2[0];
|
|
19
|
-
var state = useSmartCardState(href);
|
|
20
|
-
var definitionId = getDefinitionId(state.details);
|
|
21
|
-
var extensionKey = getExtensionKey(state.details);
|
|
22
|
-
var resourceType = getResourceType(state.details);
|
|
23
|
-
var _useSmartCardActions = useSmartCardActions(id, href),
|
|
24
|
-
register = _useSmartCardActions.register;
|
|
25
|
-
var scheduledRegister = useScheduledRegister(href, register);
|
|
26
|
-
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
27
|
-
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
28
|
-
useEffect(function () {
|
|
29
|
-
scheduledRegister().catch(function (error) {
|
|
30
|
-
throw error;
|
|
31
|
-
});
|
|
32
|
-
}, [scheduledRegister]);
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
measure.mark(id, state.status);
|
|
35
|
-
if (state.status !== 'pending' && state.status !== 'resolving') {
|
|
36
|
-
var _state$error, _state$error2;
|
|
37
|
-
measure.create(id, state.status);
|
|
38
|
-
if (state.status === 'resolved') {
|
|
39
|
-
var _measure$getMeasure$d, _measure$getMeasure;
|
|
40
|
-
fireEvent('operational.hyperlink.resolved', {
|
|
41
|
-
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
42
|
-
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
|
|
43
|
-
resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
|
|
44
|
-
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(id, state.status)) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null
|
|
45
|
-
});
|
|
46
|
-
} else if (((_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.type) !== 'ResolveUnsupportedError' && ((_state$error2 = state.error) === null || _state$error2 === void 0 ? void 0 : _state$error2.type) !== 'UnsupportedError') {
|
|
47
|
-
fireEvent('operational.hyperlink.unresolved', {
|
|
48
|
-
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
|
|
49
|
-
extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
|
|
50
|
-
resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
|
|
51
|
-
reason: state.status,
|
|
52
|
-
error: state.error === undefined ? null : {
|
|
53
|
-
name: state.error.name,
|
|
54
|
-
kind: state.error.kind,
|
|
55
|
-
type: state.error.type
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}, [id, state.status, state.error, definitionId, extensionKey, resourceType, fireEvent]);
|
|
61
|
-
return null;
|
|
62
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React, { type ComponentType } from 'react';
|
|
2
|
-
import type { HyperlinkResolverProps } from './index';
|
|
3
|
-
declare const withErrorBoundary: (Component: ComponentType<HyperlinkResolverProps>) => (props: HyperlinkResolverProps) => React.JSX.Element;
|
|
4
|
-
export default withErrorBoundary;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React, { type ComponentType } from 'react';
|
|
2
|
-
import type { HyperlinkResolverProps } from './index';
|
|
3
|
-
declare const withErrorBoundary: (Component: ComponentType<HyperlinkResolverProps>) => (props: HyperlinkResolverProps) => React.JSX.Element;
|
|
4
|
-
export default withErrorBoundary;
|