@atlaskit/smart-card 25.4.4 → 25.5.0
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/state/analytics/useDispatchAnalytics.js +31 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +4 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/state/analytics/useDispatchAnalytics.js +25 -0
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +5 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/state/analytics/useDispatchAnalytics.js +24 -0
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +4 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/state/analytics/useDispatchAnalytics.d.ts +11 -0
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +1 -1
- package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +4 -1
- package/dist/types/state/hooks-external/useSmartLinkReload.d.ts +4 -1
- package/package.json +1 -1
- package/report.api.md +1 -1
- package/tmp/api-report-tmp.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 25.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5329942b8aa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5329942b8aa) - Deprecates analyticsHandler argument of useSmartLinkActions and useSmartLinkReload hooks.
|
|
8
|
+
|
|
3
9
|
## 25.4.4
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDispatchAnalytics = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
9
|
+
var _analytics = require("../../utils/analytics");
|
|
10
|
+
/**
|
|
11
|
+
* Hook designed to use a handler if provided (ideally not)
|
|
12
|
+
* Use this for the short-term to support deprecating `analyticsHandler`s that are being provided externally,
|
|
13
|
+
* but fallback to the dispatch provided by `useAnalyticsEvents`
|
|
14
|
+
*
|
|
15
|
+
* In future, potentially use this hook to feature flag the channel we are dispatching to
|
|
16
|
+
*/
|
|
17
|
+
var useDispatchAnalytics = function useDispatchAnalytics(handler) {
|
|
18
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
19
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
20
|
+
return {
|
|
21
|
+
dispatchAnalytics: (0, _react.useMemo)(function () {
|
|
22
|
+
if (handler) {
|
|
23
|
+
return handler;
|
|
24
|
+
}
|
|
25
|
+
return function (payload) {
|
|
26
|
+
createAnalyticsEvent(payload).fire(_analytics.ANALYTICS_CHANNEL);
|
|
27
|
+
};
|
|
28
|
+
}, [handler, createAnalyticsEvent])
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.useDispatchAnalytics = useDispatchAnalytics;
|
|
@@ -14,6 +14,7 @@ var _ufoExperiences = require("./ufoExperiences");
|
|
|
14
14
|
var _helpers = require("../helpers");
|
|
15
15
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
16
16
|
var _analytics2 = require("../../utils/analytics/analytics");
|
|
17
|
+
var _useDispatchAnalytics2 = require("./useDispatchAnalytics");
|
|
17
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
20
|
var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
|
|
@@ -44,7 +45,9 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
|
|
|
44
45
|
* @param defaultLocation location attribute to be used
|
|
45
46
|
* @returns
|
|
46
47
|
*/
|
|
47
|
-
var useSmartLinkAnalytics = function useSmartLinkAnalytics(url,
|
|
48
|
+
var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalytics, id, defaultLocation) {
|
|
49
|
+
var _useDispatchAnalytics = (0, _useDispatchAnalytics2.useDispatchAnalytics)(_dispatchAnalytics),
|
|
50
|
+
dispatchAnalytics = _useDispatchAnalytics.dispatchAnalytics;
|
|
48
51
|
var defaultId = id || 'NULL';
|
|
49
52
|
// We don't want to trigger a re-render by using useSmartCardState
|
|
50
53
|
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
|
+
import { ANALYTICS_CHANNEL } from '../../utils/analytics';
|
|
4
|
+
/**
|
|
5
|
+
* Hook designed to use a handler if provided (ideally not)
|
|
6
|
+
* Use this for the short-term to support deprecating `analyticsHandler`s that are being provided externally,
|
|
7
|
+
* but fallback to the dispatch provided by `useAnalyticsEvents`
|
|
8
|
+
*
|
|
9
|
+
* In future, potentially use this hook to feature flag the channel we are dispatching to
|
|
10
|
+
*/
|
|
11
|
+
export const useDispatchAnalytics = handler => {
|
|
12
|
+
const {
|
|
13
|
+
createAnalyticsEvent
|
|
14
|
+
} = useAnalyticsEvents();
|
|
15
|
+
return {
|
|
16
|
+
dispatchAnalytics: useMemo(() => {
|
|
17
|
+
if (handler) {
|
|
18
|
+
return handler;
|
|
19
|
+
}
|
|
20
|
+
return payload => {
|
|
21
|
+
createAnalyticsEvent(payload).fire(ANALYTICS_CHANNEL);
|
|
22
|
+
};
|
|
23
|
+
}, [handler, createAnalyticsEvent])
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -5,6 +5,7 @@ import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './u
|
|
|
5
5
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getSubproduct } from '../helpers';
|
|
6
6
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
7
|
import { trackLinkUpdated, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
|
|
8
|
+
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
8
9
|
const applyCommonAttributes = (event, commonAttributes) => {
|
|
9
10
|
if (event && event.attributes) {
|
|
10
11
|
for (const [key, value] of Object.entries(commonAttributes)) {
|
|
@@ -30,7 +31,10 @@ const applyCommonAttributes = (event, commonAttributes) => {
|
|
|
30
31
|
* @param defaultLocation location attribute to be used
|
|
31
32
|
* @returns
|
|
32
33
|
*/
|
|
33
|
-
export const useSmartLinkAnalytics = (url,
|
|
34
|
+
export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocation) => {
|
|
35
|
+
const {
|
|
36
|
+
dispatchAnalytics
|
|
37
|
+
} = useDispatchAnalytics(_dispatchAnalytics);
|
|
34
38
|
const defaultId = id || 'NULL';
|
|
35
39
|
// We don't want to trigger a re-render by using useSmartCardState
|
|
36
40
|
const {
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
|
+
import { ANALYTICS_CHANNEL } from '../../utils/analytics';
|
|
4
|
+
/**
|
|
5
|
+
* Hook designed to use a handler if provided (ideally not)
|
|
6
|
+
* Use this for the short-term to support deprecating `analyticsHandler`s that are being provided externally,
|
|
7
|
+
* but fallback to the dispatch provided by `useAnalyticsEvents`
|
|
8
|
+
*
|
|
9
|
+
* In future, potentially use this hook to feature flag the channel we are dispatching to
|
|
10
|
+
*/
|
|
11
|
+
export var useDispatchAnalytics = function useDispatchAnalytics(handler) {
|
|
12
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
13
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
14
|
+
return {
|
|
15
|
+
dispatchAnalytics: useMemo(function () {
|
|
16
|
+
if (handler) {
|
|
17
|
+
return handler;
|
|
18
|
+
}
|
|
19
|
+
return function (payload) {
|
|
20
|
+
createAnalyticsEvent(payload).fire(ANALYTICS_CHANNEL);
|
|
21
|
+
};
|
|
22
|
+
}, [handler, createAnalyticsEvent])
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -9,6 +9,7 @@ import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './u
|
|
|
9
9
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getSubproduct } from '../helpers';
|
|
10
10
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
11
11
|
import { trackLinkUpdated, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
|
|
12
|
+
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
12
13
|
var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
|
|
13
14
|
if (event && event.attributes) {
|
|
14
15
|
for (var _i = 0, _Object$entries = Object.entries(commonAttributes); _i < _Object$entries.length; _i++) {
|
|
@@ -37,7 +38,9 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
|
|
|
37
38
|
* @param defaultLocation location attribute to be used
|
|
38
39
|
* @returns
|
|
39
40
|
*/
|
|
40
|
-
export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url,
|
|
41
|
+
export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalytics, id, defaultLocation) {
|
|
42
|
+
var _useDispatchAnalytics = useDispatchAnalytics(_dispatchAnalytics),
|
|
43
|
+
dispatchAnalytics = _useDispatchAnalytics.dispatchAnalytics;
|
|
41
44
|
var defaultId = id || 'NULL';
|
|
42
45
|
// We don't want to trigger a re-render by using useSmartCardState
|
|
43
46
|
var _useSmartLinkContext = useSmartLinkContext(),
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AnalyticsHandler } from '../../';
|
|
2
|
+
/**
|
|
3
|
+
* Hook designed to use a handler if provided (ideally not)
|
|
4
|
+
* Use this for the short-term to support deprecating `analyticsHandler`s that are being provided externally,
|
|
5
|
+
* but fallback to the dispatch provided by `useAnalyticsEvents`
|
|
6
|
+
*
|
|
7
|
+
* In future, potentially use this hook to feature flag the channel we are dispatching to
|
|
8
|
+
*/
|
|
9
|
+
export declare const useDispatchAnalytics: (handler?: AnalyticsHandler | undefined) => {
|
|
10
|
+
dispatchAnalytics: AnalyticsHandler;
|
|
11
|
+
};
|
|
@@ -14,7 +14,7 @@ import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps,
|
|
|
14
14
|
* @param defaultLocation location attribute to be used
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
|
-
export declare const useSmartLinkAnalytics: (url: string,
|
|
17
|
+
export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: AnalyticsHandler | undefined, id?: string | undefined, defaultLocation?: string | undefined) => {
|
|
18
18
|
ui: {
|
|
19
19
|
/**
|
|
20
20
|
* This fires an event that represents when a user clicks on the authentication
|
|
@@ -37,8 +37,11 @@ export interface UseSmartLinkActionsOpts {
|
|
|
37
37
|
/**
|
|
38
38
|
* Callback for sending analytics events.
|
|
39
39
|
* @description Accepts an analytics payload and fires it to a system.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
42
|
+
* Overriding the analytics dispatch method is deprecated. Please omit this property.
|
|
40
43
|
*/
|
|
41
|
-
analyticsHandler
|
|
44
|
+
analyticsHandler?: AnalyticsHandler;
|
|
42
45
|
/**
|
|
43
46
|
* Platform on which actions are being invoked.
|
|
44
47
|
* @default 'web'
|
|
@@ -8,8 +8,11 @@ export interface UseSmartLinkReloadOpts {
|
|
|
8
8
|
/**
|
|
9
9
|
* Callback for sending analytics events.
|
|
10
10
|
* @description Accepts an analytics payload and fires it to a system.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
13
|
+
* Overriding the analytics dispatch method is deprecated. Please omit this property.
|
|
11
14
|
*/
|
|
12
|
-
analyticsHandler
|
|
15
|
+
analyticsHandler?: AnalyticsHandler;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* Exposes a programmatic way to reload the data being used to render a Smart Link.
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -955,7 +955,7 @@ type UiRenderSuccessEventProps = CommonEventProps & {
|
|
|
955
955
|
// @public @deprecated
|
|
956
956
|
export const useSmartLinkAnalytics: (
|
|
957
957
|
url: string,
|
|
958
|
-
|
|
958
|
+
_dispatchAnalytics?: AnalyticsHandler | undefined,
|
|
959
959
|
id?: string | undefined,
|
|
960
960
|
defaultLocation?: string | undefined,
|
|
961
961
|
) => {
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -816,7 +816,7 @@ type UiRenderSuccessEventProps = CommonEventProps & {
|
|
|
816
816
|
};
|
|
817
817
|
|
|
818
818
|
// @public @deprecated
|
|
819
|
-
export const useSmartLinkAnalytics: (url: string,
|
|
819
|
+
export const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: AnalyticsHandler | undefined, id?: string | undefined, defaultLocation?: string | undefined) => {
|
|
820
820
|
ui: {
|
|
821
821
|
authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiAuthEventProps) => void;
|
|
822
822
|
authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiAuthAlternateAccountEventProps) => void;
|