@atlaskit/smart-card 45.21.0 → 45.21.3
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 +36 -0
- package/dist/cjs/extractors/action/extract-invoke-view-action.js +2 -8
- package/dist/cjs/extractors/flexible/actions/index.js +2 -3
- package/dist/cjs/extractors/flexible/extract-state.js +3 -4
- package/dist/cjs/extractors/flexible/index.js +3 -4
- package/dist/cjs/state/hooks/use-destination-url/index.js +6 -11
- package/dist/cjs/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +49 -10
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -6
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +62 -111
- package/dist/cjs/view/FlexibleCard/index.js +2 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +16 -23
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/action/extract-invoke-view-action.js +3 -7
- package/dist/es2019/extractors/flexible/actions/index.js +1 -3
- package/dist/es2019/extractors/flexible/extract-state.js +2 -4
- package/dist/es2019/extractors/flexible/index.js +2 -4
- package/dist/es2019/state/hooks/use-destination-url/index.js +4 -7
- package/dist/es2019/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +47 -5
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -7
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +64 -113
- package/dist/es2019/view/FlexibleCard/index.js +3 -4
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +16 -20
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/action/extract-invoke-view-action.js +2 -8
- package/dist/esm/extractors/flexible/actions/index.js +2 -3
- package/dist/esm/extractors/flexible/extract-state.js +3 -4
- package/dist/esm/extractors/flexible/index.js +3 -4
- package/dist/esm/state/hooks/use-destination-url/index.js +4 -9
- package/dist/esm/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +47 -9
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +6 -7
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +63 -112
- package/dist/esm/view/FlexibleCard/index.js +3 -4
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +17 -24
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-destination-url/index.d.ts +18 -1
- package/dist/types/state/hooks/use-smart-link-cross-product-url-wrapper/index.d.ts +5 -2
- package/package.json +3 -5
- package/dist/cjs/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.js +0 -54
- package/dist/es2019/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.js +0 -47
- package/dist/esm/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.js +0 -47
- package/dist/types/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.d.ts +0 -5
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { useCrossProductUrlWrapper } from '@atlaskit/analytics-cross-product/useCrossProductUrlWrapper';
|
|
3
|
-
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
4
|
-
import { XPC_CONSTANTS } from './constants';
|
|
5
|
-
import { getIsFirstPartyLink } from './getIsFirstPartyLink';
|
|
6
|
-
export const useSmartLinkCrossProductUrlWrapper = ({
|
|
7
|
-
details
|
|
8
|
-
}) => {
|
|
9
|
-
var _effectiveProduct$toL;
|
|
10
|
-
const {
|
|
11
|
-
product,
|
|
12
|
-
bridgeProduct,
|
|
13
|
-
xpcProduct,
|
|
14
|
-
xpcSubProduct
|
|
15
|
-
} = useSmartLinkContext();
|
|
16
|
-
// xpcProduct takes precedence over product — it identifies the host product for XPC analytics
|
|
17
|
-
// without affecting link resolution (which uses the `product` prop separately).
|
|
18
|
-
const effectiveProduct = xpcProduct !== null && xpcProduct !== void 0 ? xpcProduct : product;
|
|
19
|
-
const effectiveBridge = bridgeProduct !== null && bridgeProduct !== void 0 ? bridgeProduct : XPC_CONSTANTS.SMART_LINKS_XPC_BRIDGE;
|
|
20
|
-
const effectiveProductForWrapper = (_effectiveProduct$toL = effectiveProduct === null || effectiveProduct === void 0 ? void 0 : effectiveProduct.toLowerCase()) !== null && _effectiveProduct$toL !== void 0 ? _effectiveProduct$toL : 'unknown';
|
|
21
|
-
const wrapUrl = useCrossProductUrlWrapper({
|
|
22
|
-
bridge: effectiveBridge,
|
|
23
|
-
product: effectiveProductForWrapper,
|
|
24
|
-
...(xpcSubProduct ? {
|
|
25
|
-
subProduct: xpcSubProduct
|
|
26
|
-
} : {})
|
|
27
|
-
});
|
|
28
|
-
return useCallback(url => {
|
|
29
|
-
if (typeof window === 'undefined' || !getIsFirstPartyLink(details) || !effectiveProduct) {
|
|
30
|
-
return url;
|
|
31
|
-
}
|
|
32
|
-
let parsedUrl;
|
|
33
|
-
try {
|
|
34
|
-
parsedUrl = new URL(url);
|
|
35
|
-
} catch {
|
|
36
|
-
return url;
|
|
37
|
-
}
|
|
38
|
-
if (parsedUrl.searchParams.has(XPC_CONSTANTS.QUERY_PARAM)) {
|
|
39
|
-
return url;
|
|
40
|
-
}
|
|
41
|
-
return wrapUrl(url);
|
|
42
|
-
},
|
|
43
|
-
// Keep bridge/subproduct in the dependency array so consumers that memoize this callback
|
|
44
|
-
// refresh when mini-modal context updates from smartLinks to rovo-chat.
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
[details, effectiveBridge, effectiveProduct, wrapUrl, xpcSubProduct]);
|
|
47
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { useCallback } from 'react';
|
|
5
|
-
import { useCrossProductUrlWrapper } from '@atlaskit/analytics-cross-product/useCrossProductUrlWrapper';
|
|
6
|
-
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
|
-
import { XPC_CONSTANTS } from './constants';
|
|
8
|
-
import { getIsFirstPartyLink } from './getIsFirstPartyLink';
|
|
9
|
-
export var useSmartLinkCrossProductUrlWrapper = function useSmartLinkCrossProductUrlWrapper(_ref) {
|
|
10
|
-
var _effectiveProduct$toL;
|
|
11
|
-
var details = _ref.details;
|
|
12
|
-
var _useSmartLinkContext = useSmartLinkContext(),
|
|
13
|
-
product = _useSmartLinkContext.product,
|
|
14
|
-
bridgeProduct = _useSmartLinkContext.bridgeProduct,
|
|
15
|
-
xpcProduct = _useSmartLinkContext.xpcProduct,
|
|
16
|
-
xpcSubProduct = _useSmartLinkContext.xpcSubProduct;
|
|
17
|
-
// xpcProduct takes precedence over product — it identifies the host product for XPC analytics
|
|
18
|
-
// without affecting link resolution (which uses the `product` prop separately).
|
|
19
|
-
var effectiveProduct = xpcProduct !== null && xpcProduct !== void 0 ? xpcProduct : product;
|
|
20
|
-
var effectiveBridge = bridgeProduct !== null && bridgeProduct !== void 0 ? bridgeProduct : XPC_CONSTANTS.SMART_LINKS_XPC_BRIDGE;
|
|
21
|
-
var effectiveProductForWrapper = (_effectiveProduct$toL = effectiveProduct === null || effectiveProduct === void 0 ? void 0 : effectiveProduct.toLowerCase()) !== null && _effectiveProduct$toL !== void 0 ? _effectiveProduct$toL : 'unknown';
|
|
22
|
-
var wrapUrl = useCrossProductUrlWrapper(_objectSpread({
|
|
23
|
-
bridge: effectiveBridge,
|
|
24
|
-
product: effectiveProductForWrapper
|
|
25
|
-
}, xpcSubProduct ? {
|
|
26
|
-
subProduct: xpcSubProduct
|
|
27
|
-
} : {}));
|
|
28
|
-
return useCallback(function (url) {
|
|
29
|
-
if (typeof window === 'undefined' || !getIsFirstPartyLink(details) || !effectiveProduct) {
|
|
30
|
-
return url;
|
|
31
|
-
}
|
|
32
|
-
var parsedUrl;
|
|
33
|
-
try {
|
|
34
|
-
parsedUrl = new URL(url);
|
|
35
|
-
} catch (_unused) {
|
|
36
|
-
return url;
|
|
37
|
-
}
|
|
38
|
-
if (parsedUrl.searchParams.has(XPC_CONSTANTS.QUERY_PARAM)) {
|
|
39
|
-
return url;
|
|
40
|
-
}
|
|
41
|
-
return wrapUrl(url);
|
|
42
|
-
},
|
|
43
|
-
// Keep bridge/subproduct in the dependency array so consumers that memoize this callback
|
|
44
|
-
// refresh when mini-modal context updates from smartLinks to rovo-chat.
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
[details, effectiveBridge, effectiveProduct, wrapUrl, xpcSubProduct]);
|
|
47
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SmartLinkResponse } from '@atlaskit/linking-types/smart-link';
|
|
2
|
-
export type UseSmartLinkCrossProductUrlWrapperArgs = {
|
|
3
|
-
details?: SmartLinkResponse;
|
|
4
|
-
};
|
|
5
|
-
export declare const useSmartLinkCrossProductUrlWrapper: ({ details, }: UseSmartLinkCrossProductUrlWrapperArgs) => ((url: string) => string);
|