@atlaskit/analytics-next 11.3.0 → 12.0.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/AnalyticsContext/package.json +1 -8
- package/AnalyticsDecorator/package.json +1 -8
- package/AnalyticsDelegate/package.json +1 -8
- package/AnalyticsErrorBoundary/package.json +1 -8
- package/AnalyticsEvent/package.json +1 -8
- package/AnalyticsListener/package.json +1 -8
- package/AnalyticsReactContext/package.json +1 -8
- package/CHANGELOG.md +26 -0
- package/UIAnalyticsEvent/package.json +1 -8
- package/analytics-next.docs.tsx +14 -4
- package/cleanProps/package.json +1 -8
- package/createAndFireEvents/package.json +1 -8
- package/package.json +2 -10
- package/types/package.json +1 -8
- package/useAnalyticsEvents/package.json +1 -8
- package/useCallbackWithAnalytics/package.json +1 -8
- package/usePatchedProps/package.json +1 -8
- package/usePlatformLeafEventHandler/package.json +1 -8
- package/usePlatformLeafSyntheticEventHandler/package.json +1 -8
- package/withAnalytics/package.json +1 -8
- package/withAnalyticsContext/package.json +1 -8
- package/withAnalyticsEvents/package.json +1 -8
- package/dist/types-ts4.5/components/AnalyticsContext/LegacyAnalyticsContext.d.ts +0 -30
- package/dist/types-ts4.5/components/AnalyticsContext/ModernAnalyticsContext.d.ts +0 -3
- package/dist/types-ts4.5/components/AnalyticsContext/index.d.ts +0 -3
- package/dist/types-ts4.5/components/AnalyticsContext/types.d.ts +0 -8
- package/dist/types-ts4.5/components/AnalyticsDecorator/index.d.ts +0 -46
- package/dist/types-ts4.5/components/AnalyticsDelegate/index.d.ts +0 -25
- package/dist/types-ts4.5/components/AnalyticsErrorBoundary.d.ts +0 -25
- package/dist/types-ts4.5/components/AnalyticsListener/LegacyAnalyticsListener.d.ts +0 -34
- package/dist/types-ts4.5/components/AnalyticsListener/ModernAnalyticsListener.d.ts +0 -3
- package/dist/types-ts4.5/components/AnalyticsListener/index.d.ts +0 -3
- package/dist/types-ts4.5/components/AnalyticsListener/types.d.ts +0 -11
- package/dist/types-ts4.5/components/AnalyticsReactContext.d.ts +0 -2
- package/dist/types-ts4.5/components/matchEvent/index.d.ts +0 -3
- package/dist/types-ts4.5/events/AnalyticsEvent.d.ts +0 -15
- package/dist/types-ts4.5/events/UIAnalyticsEvent.d.ts +0 -20
- package/dist/types-ts4.5/hocs/withAnalyticsContext.d.ts +0 -6
- package/dist/types-ts4.5/hocs/withAnalyticsEvents.d.ts +0 -12
- package/dist/types-ts4.5/hooks/useAnalyticsContext.d.ts +0 -2
- package/dist/types-ts4.5/hooks/useAnalyticsEvents.d.ts +0 -5
- package/dist/types-ts4.5/hooks/useCallbackWithAnalytics.d.ts +0 -2
- package/dist/types-ts4.5/hooks/usePatchedProps.d.ts +0 -5
- package/dist/types-ts4.5/hooks/usePlatformLeafEventHandler.d.ts +0 -12
- package/dist/types-ts4.5/hooks/usePlatformLeafSyntheticEventHandler.d.ts +0 -11
- package/dist/types-ts4.5/hooks/useTrackedRef.d.ts +0 -2
- package/dist/types-ts4.5/index.d.ts +0 -28
- package/dist/types-ts4.5/test-utils/useRenderCounter.d.ts +0 -1
- package/dist/types-ts4.5/types.d.ts +0 -6
- package/dist/types-ts4.5/utils/cleanProps.d.ts +0 -3
- package/dist/types-ts4.5/utils/createAndFireEvent.d.ts +0 -5
- package/dist/types-ts4.5/utils/isModernContextEnabledEnv.d.ts +0 -2
- package/dist/types-ts4.5/utils/withAnalytics.d.ts +0 -78
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/components/AnalyticsContext/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/components/AnalyticsContext/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/components/AnalyticsContext/index.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/components/AnalyticsContext/index.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/components/AnalyticsContext/index.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/components/AnalyticsDecorator/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/components/AnalyticsDecorator/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/components/AnalyticsDecorator/index.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/components/AnalyticsDecorator/index.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/components/AnalyticsDecorator/index.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/components/AnalyticsDelegate/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/components/AnalyticsDelegate/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/components/AnalyticsDelegate/index.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/components/AnalyticsDelegate/index.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/components/AnalyticsDelegate/index.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/components/AnalyticsErrorBoundary.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/components/AnalyticsErrorBoundary.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/components/AnalyticsErrorBoundary.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/components/AnalyticsErrorBoundary.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/components/AnalyticsErrorBoundary.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/events/AnalyticsEvent.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/events/AnalyticsEvent.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/events/AnalyticsEvent.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/events/AnalyticsEvent.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/events/AnalyticsEvent.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/components/AnalyticsListener/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/components/AnalyticsListener/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/components/AnalyticsListener/index.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/components/AnalyticsListener/index.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/components/AnalyticsListener/index.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/components/AnalyticsReactContext.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/components/AnalyticsReactContext.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/components/AnalyticsReactContext.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/components/AnalyticsReactContext.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/components/AnalyticsReactContext.d.ts"
|
|
15
8
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/analytics-next
|
|
2
2
|
|
|
3
|
+
## 12.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
|
|
8
|
+
Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
|
|
9
|
+
|
|
10
|
+
Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
|
|
11
|
+
|
|
12
|
+
Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
|
|
13
|
+
|
|
14
|
+
```diff
|
|
15
|
+
- "typesVersions": {
|
|
16
|
+
- ">=4.5 <4.9": {
|
|
17
|
+
- "*": [
|
|
18
|
+
- "dist/types-ts4.5/*",
|
|
19
|
+
- "dist/types-ts4.5/index.d.ts"
|
|
20
|
+
- ]
|
|
21
|
+
- }
|
|
22
|
+
- },
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 11.3.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/events/UIAnalyticsEvent.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/events/UIAnalyticsEvent.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/events/UIAnalyticsEvent.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/events/UIAnalyticsEvent.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/events/UIAnalyticsEvent.d.ts"
|
|
15
8
|
}
|
package/analytics-next.docs.tsx
CHANGED
|
@@ -102,8 +102,12 @@ const documentation: StructuredContentSource = {
|
|
|
102
102
|
examples: [
|
|
103
103
|
{
|
|
104
104
|
name: 'Error boundary with fallback',
|
|
105
|
-
description:
|
|
106
|
-
|
|
105
|
+
description:
|
|
106
|
+
'Render a fallback component and fire an analytics event when a child throws.',
|
|
107
|
+
source: path.resolve(
|
|
108
|
+
packagePath,
|
|
109
|
+
'./examples/11-error-boundary-with-error-component.tsx',
|
|
110
|
+
),
|
|
107
111
|
},
|
|
108
112
|
],
|
|
109
113
|
},
|
|
@@ -145,7 +149,12 @@ const documentation: StructuredContentSource = {
|
|
|
145
149
|
signature:
|
|
146
150
|
'(channel?: string) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent',
|
|
147
151
|
parameters: [
|
|
148
|
-
{
|
|
152
|
+
{
|
|
153
|
+
name: 'channel',
|
|
154
|
+
type: 'string',
|
|
155
|
+
description: 'Optional channel to fire on.',
|
|
156
|
+
isOptional: true,
|
|
157
|
+
},
|
|
149
158
|
{ name: 'payload', type: 'AnalyticsEventPayload' },
|
|
150
159
|
{
|
|
151
160
|
name: 'createAnalyticsEvent',
|
|
@@ -155,7 +164,8 @@ const documentation: StructuredContentSource = {
|
|
|
155
164
|
],
|
|
156
165
|
returns: {
|
|
157
166
|
type: 'UIAnalyticsEvent',
|
|
158
|
-
description:
|
|
167
|
+
description:
|
|
168
|
+
'The original (un-cloned) consumer event so callers can attach further context.',
|
|
159
169
|
},
|
|
160
170
|
usageGuidelines: [
|
|
161
171
|
'Reach for `createAndFireEvent` when you want a one-liner inside an event handler. For more complex flows, build and fire the event explicitly.',
|
package/cleanProps/package.json
CHANGED
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/utils/cleanProps.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/utils/cleanProps.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/utils/cleanProps.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/utils/cleanProps.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/utils/cleanProps.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/utils/createAndFireEvent.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/utils/createAndFireEvent.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/utils/createAndFireEvent.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/utils/createAndFireEvent.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/utils/createAndFireEvent.d.ts"
|
|
15
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/analytics-next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "React components, HOCs and hooks to assist with tracking user activity with React components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.5 <4.9": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.5/*",
|
|
19
|
-
"dist/types-ts4.5/index.d.ts"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
15
|
"sideEffects": false,
|
|
24
16
|
"atlaskit:src": "src/index.ts",
|
|
25
17
|
"atlassian": {
|
|
@@ -38,7 +30,7 @@
|
|
|
38
30
|
"./types": "./src/types.ts",
|
|
39
31
|
"dependencies": {
|
|
40
32
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
41
|
-
"@atlaskit/platform-feature-flags": "^
|
|
33
|
+
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
42
34
|
"@babel/runtime": "^7.0.0",
|
|
43
35
|
"prop-types": "^15.5.10",
|
|
44
36
|
"use-memo-one": "^1.1.1"
|
package/types/package.json
CHANGED
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/types.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/types.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/types.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/types.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/types.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/hooks/useAnalyticsEvents.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/hooks/useAnalyticsEvents.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/hooks/useAnalyticsEvents.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/hooks/useAnalyticsEvents.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/hooks/useAnalyticsEvents.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/hooks/useCallbackWithAnalytics.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/hooks/useCallbackWithAnalytics.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/hooks/useCallbackWithAnalytics.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/hooks/useCallbackWithAnalytics.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/hooks/useCallbackWithAnalytics.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/hooks/usePatchedProps.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/hooks/usePatchedProps.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/hooks/usePatchedProps.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/hooks/usePatchedProps.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/hooks/usePatchedProps.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/hooks/usePlatformLeafEventHandler.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/hooks/usePlatformLeafEventHandler.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/hooks/usePlatformLeafEventHandler.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/hooks/usePlatformLeafEventHandler.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/hooks/usePlatformLeafEventHandler.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/hooks/usePlatformLeafSyntheticEventHandler.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/hooks/usePlatformLeafSyntheticEventHandler.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/hooks/usePlatformLeafSyntheticEventHandler.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/hooks/usePlatformLeafSyntheticEventHandler.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/hooks/usePlatformLeafSyntheticEventHandler.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/utils/withAnalytics.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/utils/withAnalytics.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/utils/withAnalytics.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/utils/withAnalytics.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/utils/withAnalytics.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/hocs/withAnalyticsContext.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/hocs/withAnalyticsContext.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/hocs/withAnalyticsContext.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/hocs/withAnalyticsContext.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/hocs/withAnalyticsContext.d.ts"
|
|
15
8
|
}
|
|
@@ -4,12 +4,5 @@
|
|
|
4
4
|
"module": "../dist/esm/hocs/withAnalyticsEvents.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/hocs/withAnalyticsEvents.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/hocs/withAnalyticsEvents.d.ts"
|
|
8
|
-
"typesVersions": {
|
|
9
|
-
">=4.5 <5.9": {
|
|
10
|
-
"*": [
|
|
11
|
-
"../dist/types-ts4.5/hocs/withAnalyticsEvents.d.ts"
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
7
|
+
"types": "../dist/types/hocs/withAnalyticsEvents.d.ts"
|
|
15
8
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { type AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
|
|
4
|
-
interface Props {
|
|
5
|
-
/** Children! */
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
/** Arbitrary data. Any events created below this component in the tree will
|
|
8
|
-
* have this added as an item in their context array. */
|
|
9
|
-
data: Object;
|
|
10
|
-
}
|
|
11
|
-
declare class AnalyticsContext extends Component<Props, AnalyticsReactContextInterface> {
|
|
12
|
-
context: any;
|
|
13
|
-
static contextTypes: {
|
|
14
|
-
getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
};
|
|
17
|
-
static childContextTypes: {
|
|
18
|
-
getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
};
|
|
21
|
-
contextValue: AnalyticsReactContextInterface;
|
|
22
|
-
constructor(props: Props);
|
|
23
|
-
getChildContext: () => {
|
|
24
|
-
getAtlaskitAnalyticsContext: () => any[];
|
|
25
|
-
};
|
|
26
|
-
getAnalyticsContext: () => any[];
|
|
27
|
-
getAnalyticsEventHandlers: () => any;
|
|
28
|
-
render(): React.JSX.Element;
|
|
29
|
-
}
|
|
30
|
-
export default AnalyticsContext;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
|
|
2
|
-
export type AnalyticsContextFunction = (props: {
|
|
3
|
-
/** Children! */
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
/** Arbitrary data. Any events created below this component in the tree will
|
|
6
|
-
* have this added as an item in their context array. */
|
|
7
|
-
data: Object;
|
|
8
|
-
}, context?: AnalyticsReactContextInterface) => JSX.Element;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { type Matcher } from '../matchEvent';
|
|
4
|
-
type AnalyticsData = {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
};
|
|
7
|
-
type AnalyticsDecoratorProps = {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
data?: AnalyticsData;
|
|
10
|
-
getData?: (name: string, data: AnalyticsData) => AnalyticsData;
|
|
11
|
-
match: Matcher;
|
|
12
|
-
matchPrivate: boolean;
|
|
13
|
-
};
|
|
14
|
-
type AnalyticsDecoratorContext = {
|
|
15
|
-
getParentAnalyticsData?: (name: string, isPrivate: boolean) => AnalyticsData;
|
|
16
|
-
onAnalyticsEvent?: (name: string, data: AnalyticsData, isPrivate: boolean) => void;
|
|
17
|
-
};
|
|
18
|
-
export declare const ContextTypes: {
|
|
19
|
-
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
getParentAnalyticsData: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* The Decorator component extends analytics event data
|
|
24
|
-
* for any events fired by its descendents,
|
|
25
|
-
* then passes the event up the hierarchy
|
|
26
|
-
*/
|
|
27
|
-
export declare class AnalyticsDecorator extends Component<AnalyticsDecoratorProps> {
|
|
28
|
-
static defaultProps: {
|
|
29
|
-
match: string;
|
|
30
|
-
matchPrivate: boolean;
|
|
31
|
-
};
|
|
32
|
-
static contextTypes: {
|
|
33
|
-
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
-
getParentAnalyticsData: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
-
};
|
|
36
|
-
static childContextTypes: {
|
|
37
|
-
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
|
-
getParentAnalyticsData: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
-
};
|
|
40
|
-
getChildContext(): AnalyticsDecoratorContext;
|
|
41
|
-
getDecoratedAnalyticsData: (name: string, srcData: AnalyticsData, isPrivate: boolean) => AnalyticsData;
|
|
42
|
-
onAnalyticsEvent: (name: string, srcData: AnalyticsData, isPrivate: boolean) => void;
|
|
43
|
-
getParentAnalyticsData: (name: string, isPrivate: boolean) => AnalyticsData;
|
|
44
|
-
render(): React.ReactNode;
|
|
45
|
-
}
|
|
46
|
-
export default AnalyticsDecorator;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
type AnalyticsDelegateProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
delegateAnalyticsEvent?: (name: string, data: any, isPrivate: boolean) => void;
|
|
6
|
-
};
|
|
7
|
-
type AnalyticsDelegateContext = {
|
|
8
|
-
onAnalyticsEvent?: (name: string, data: any, isPrivate: boolean) => void;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Listens to public and private events and delegates to an analytics
|
|
12
|
-
* stack in a different React root.
|
|
13
|
-
*/
|
|
14
|
-
declare class AnalyticsDelegate extends Component<AnalyticsDelegateProps> {
|
|
15
|
-
static contextTypes: {
|
|
16
|
-
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
-
};
|
|
18
|
-
static childContextTypes: {
|
|
19
|
-
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
};
|
|
21
|
-
getChildContext(): AnalyticsDelegateContext;
|
|
22
|
-
onAnalyticsEvent: (name: string, data: any, isPrivate: boolean) => void;
|
|
23
|
-
render(): React.ReactNode;
|
|
24
|
-
}
|
|
25
|
-
export default AnalyticsDelegate;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { Component, type ReactNode } from 'react';
|
|
2
|
-
type AnalyticsErrorBoundaryErrorInfo = {
|
|
3
|
-
componentStack: string;
|
|
4
|
-
};
|
|
5
|
-
export interface AnalyticsErrorBoundaryProps {
|
|
6
|
-
channel: string;
|
|
7
|
-
/** React component to be wrapped */
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
data: {};
|
|
10
|
-
ErrorComponent?: React.ComponentType;
|
|
11
|
-
onError?: (error: Error, info?: AnalyticsErrorBoundaryErrorInfo) => void;
|
|
12
|
-
}
|
|
13
|
-
type AnalyticsErrorBoundaryState = {
|
|
14
|
-
hasError: boolean;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @private https://product-fabric.atlassian.net/browse/AFO-815
|
|
18
|
-
* @deprecated
|
|
19
|
-
*/
|
|
20
|
-
export default class AnalyticsErrorBoundary extends Component<AnalyticsErrorBoundaryProps, AnalyticsErrorBoundaryState> {
|
|
21
|
-
constructor(props: AnalyticsErrorBoundaryProps);
|
|
22
|
-
componentDidCatch(error: Error, info: AnalyticsErrorBoundaryErrorInfo): void;
|
|
23
|
-
render(): React.JSX.Element | null;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { type AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
|
|
4
|
-
import type { default as UIAnalyticsEvent } from '../../events/UIAnalyticsEvent';
|
|
5
|
-
type Props = {
|
|
6
|
-
/** The channel to listen for events on. */
|
|
7
|
-
channel?: string;
|
|
8
|
-
/** Children! */
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
/** A function which will be called when an event is fired on this Listener's
|
|
11
|
-
* channel. It is passed the event and the channel as arguments. */
|
|
12
|
-
onEvent: (event: UIAnalyticsEvent, channel?: string) => void;
|
|
13
|
-
};
|
|
14
|
-
declare class AnalyticsListener extends Component<Props> {
|
|
15
|
-
context: any;
|
|
16
|
-
static contextTypes: {
|
|
17
|
-
getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
-
getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
};
|
|
20
|
-
static childContextTypes: {
|
|
21
|
-
getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
-
getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
-
};
|
|
24
|
-
contextValue: AnalyticsReactContextInterface;
|
|
25
|
-
constructor(props: Props);
|
|
26
|
-
getChildContext: () => {
|
|
27
|
-
getAtlaskitAnalyticsContext: () => any;
|
|
28
|
-
getAtlaskitAnalyticsEventHandlers: () => any[];
|
|
29
|
-
};
|
|
30
|
-
getAnalyticsEventHandlers: () => any[];
|
|
31
|
-
getAtlaskitAnalyticsContext: () => any;
|
|
32
|
-
render(): React.JSX.Element;
|
|
33
|
-
}
|
|
34
|
-
export default AnalyticsListener;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
|
|
2
|
-
import type UIAnalyticsEvent from '../../events/UIAnalyticsEvent';
|
|
3
|
-
export type AnalyticsListenerFunction = (props: {
|
|
4
|
-
/** The channel to listen for events on. */
|
|
5
|
-
channel?: string;
|
|
6
|
-
/** Children! */
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
/** A function which will be called when an event is fired on this Listener's
|
|
9
|
-
* channel. It is passed the event and the channel as arguments. */
|
|
10
|
-
onEvent: (event: UIAnalyticsEvent, channel?: string) => void;
|
|
11
|
-
}, context?: AnalyticsReactContextInterface) => JSX.Element;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type AnalyticsEventPayload = Record<string, any>;
|
|
2
|
-
type AnalyticsEventCallback = (payload: AnalyticsEventPayload) => AnalyticsEventPayload;
|
|
3
|
-
type AnalyticsEventUpdater = AnalyticsEventPayload | AnalyticsEventCallback;
|
|
4
|
-
export type AnalyticsEventProps = {
|
|
5
|
-
payload: AnalyticsEventPayload;
|
|
6
|
-
};
|
|
7
|
-
export declare const isAnalyticsEvent: (obj: any) => boolean;
|
|
8
|
-
export default class AnalyticsEvent {
|
|
9
|
-
payload: AnalyticsEventPayload;
|
|
10
|
-
_isAnalyticsEvent: boolean;
|
|
11
|
-
constructor(props: AnalyticsEventProps);
|
|
12
|
-
clone: () => AnalyticsEvent | null;
|
|
13
|
-
update(updater: AnalyticsEventUpdater): this;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import AnalyticsEvent, { type AnalyticsEventPayload, type AnalyticsEventProps } from './AnalyticsEvent';
|
|
2
|
-
type ChannelIdentifier = string;
|
|
3
|
-
type Context = Record<string, any>[];
|
|
4
|
-
export type UIAnalyticsEventHandler = (event: UIAnalyticsEvent, channel?: ChannelIdentifier) => void;
|
|
5
|
-
export type UIAnalyticsEventProps = AnalyticsEventProps & {
|
|
6
|
-
context?: Context;
|
|
7
|
-
handlers?: UIAnalyticsEventHandler[];
|
|
8
|
-
};
|
|
9
|
-
export declare const isUIAnalyticsEvent: (obj: any) => obj is UIAnalyticsEvent;
|
|
10
|
-
export default class UIAnalyticsEvent extends AnalyticsEvent {
|
|
11
|
-
context: Context;
|
|
12
|
-
handlers: UIAnalyticsEventHandler[];
|
|
13
|
-
hasFired: boolean;
|
|
14
|
-
_isUIAnalyticsEvent: boolean;
|
|
15
|
-
constructor(props: UIAnalyticsEventProps);
|
|
16
|
-
clone: () => UIAnalyticsEvent | null;
|
|
17
|
-
fire: (channel?: string) => void;
|
|
18
|
-
update(updater: Record<string, any> | ((payload: AnalyticsEventPayload) => AnalyticsEventPayload)): this;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface WithContextProps {
|
|
3
|
-
analyticsContext?: Record<string, any>;
|
|
4
|
-
}
|
|
5
|
-
declare const withAnalyticsContext: (defaultData?: any) => <Props, Component>(WrappedComponent: React.ComponentType<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props & WithContextProps>> & React.RefAttributes<any>>;
|
|
6
|
-
export default withAnalyticsContext;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { CreateEventMap, CreateUIAnalyticsEvent } from '../types';
|
|
3
|
-
export interface WithAnalyticsEventsProps {
|
|
4
|
-
/**
|
|
5
|
-
* You should not be accessing this prop under any circumstances.
|
|
6
|
-
* It is provided by `@atlaskit/analytics-next` and integrated in the component
|
|
7
|
-
*/
|
|
8
|
-
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
9
|
-
ref?: React.Ref<any>;
|
|
10
|
-
}
|
|
11
|
-
declare const withAnalyticsEvents: (createEventMap?: CreateEventMap) => <Props, Component>(WrappedComponent: (React.ComponentType<WithAnalyticsEventsProps & Props> | React.ForwardRefExoticComponent<Omit<WithAnalyticsEventsProps, "ref"> & Props>) & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Omit<Props, keyof WithAnalyticsEventsProps>>> & React.RefAttributes<any>>;
|
|
12
|
-
export default withAnalyticsEvents;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CreateEventMap } from '../types';
|
|
2
|
-
export type PatchedPropsHook = {
|
|
3
|
-
patchedEventProps: CreateEventMap;
|
|
4
|
-
};
|
|
5
|
-
export declare function usePatchedProps<Props extends Record<string, any>>(createEventMap: CreateEventMap | undefined, wrappedComponentProps: Props): PatchedPropsHook;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type UIAnalyticsEvent from '../events/UIAnalyticsEvent';
|
|
2
|
-
export type UsePlatformLeafEventHandlerHookArgs<T> = {
|
|
3
|
-
action: string;
|
|
4
|
-
actionSubject?: string;
|
|
5
|
-
analyticsData?: Record<string, any>;
|
|
6
|
-
componentName: string;
|
|
7
|
-
fn: (value: T, analyticsEvent: UIAnalyticsEvent) => void;
|
|
8
|
-
packageName: string;
|
|
9
|
-
packageVersion: string;
|
|
10
|
-
};
|
|
11
|
-
export type UsePlatformLeafEventHandlerHook<T> = (value: T) => void;
|
|
12
|
-
export declare function usePlatformLeafEventHandler<T>({ fn, action, componentName, actionSubject, packageName, packageVersion, analyticsData, }: UsePlatformLeafEventHandlerHookArgs<T>): (value: T) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type UIAnalyticsEvent from '../events/UIAnalyticsEvent';
|
|
2
|
-
export type UsePlatformLeafSyntheticEventHandlerHookArgs = {
|
|
3
|
-
action: string;
|
|
4
|
-
analyticsData?: Record<string, any>;
|
|
5
|
-
componentName: string;
|
|
6
|
-
fn: (analyticsEvent: UIAnalyticsEvent) => void;
|
|
7
|
-
packageName: string;
|
|
8
|
-
packageVersion: string;
|
|
9
|
-
};
|
|
10
|
-
export type UsePlatformLeafSyntheticEventHandlerHook = () => void;
|
|
11
|
-
export declare function usePlatformLeafSyntheticEventHandler({ fn, action, componentName, packageName, packageVersion, analyticsData, }: UsePlatformLeafSyntheticEventHandlerHookArgs): () => void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type { CreateUIAnalyticsEvent } from './types';
|
|
2
|
-
export { default as AnalyticsEvent, isAnalyticsEvent } from './events/AnalyticsEvent';
|
|
3
|
-
export type { AnalyticsEventPayload, AnalyticsEventProps } from './events/AnalyticsEvent';
|
|
4
|
-
export { default as UIAnalyticsEvent, isUIAnalyticsEvent } from './events/UIAnalyticsEvent';
|
|
5
|
-
export type { UIAnalyticsEventProps, UIAnalyticsEventHandler } from './events/UIAnalyticsEvent';
|
|
6
|
-
export { default as AnalyticsListener } from './components/AnalyticsListener/index';
|
|
7
|
-
export { default as AnalyticsContext } from './components/AnalyticsContext/index';
|
|
8
|
-
export { default as withAnalyticsContext } from './hocs/withAnalyticsContext';
|
|
9
|
-
export type { WithContextProps } from './hocs/withAnalyticsContext';
|
|
10
|
-
export { default as AnalyticsErrorBoundary } from './components/AnalyticsErrorBoundary';
|
|
11
|
-
export type { AnalyticsErrorBoundaryProps } from './components/AnalyticsErrorBoundary';
|
|
12
|
-
export { default as withAnalyticsEvents } from './hocs/withAnalyticsEvents';
|
|
13
|
-
export type { WithAnalyticsEventsProps } from './hocs/withAnalyticsEvents';
|
|
14
|
-
export { default as AnalyticsReactContext } from './components/AnalyticsReactContext';
|
|
15
|
-
export type { AnalyticsReactContextInterface } from './components/AnalyticsReactContext';
|
|
16
|
-
export { useAnalyticsEvents } from './hooks/useAnalyticsEvents';
|
|
17
|
-
export type { UseAnalyticsEventsHook } from './hooks/useAnalyticsEvents';
|
|
18
|
-
export { useCallbackWithAnalytics } from './hooks/useCallbackWithAnalytics';
|
|
19
|
-
export type { UseCallbackWithAnalyticsHook } from './hooks/useCallbackWithAnalytics';
|
|
20
|
-
export { usePlatformLeafEventHandler } from './hooks/usePlatformLeafEventHandler';
|
|
21
|
-
export type { UsePlatformLeafEventHandlerHookArgs, UsePlatformLeafEventHandlerHook, } from './hooks/usePlatformLeafEventHandler';
|
|
22
|
-
export { usePlatformLeafSyntheticEventHandler } from './hooks/usePlatformLeafSyntheticEventHandler';
|
|
23
|
-
export type { UsePlatformLeafSyntheticEventHandlerHookArgs, UsePlatformLeafSyntheticEventHandlerHook, } from './hooks/usePlatformLeafSyntheticEventHandler';
|
|
24
|
-
export { default as createAndFireEvent } from './utils/createAndFireEvent';
|
|
25
|
-
export { default as cleanProps } from './utils/cleanProps';
|
|
26
|
-
export { default as AnalyticsDecorator } from './components/AnalyticsDecorator';
|
|
27
|
-
export { default as AnalyticsDelegate } from './components/AnalyticsDelegate';
|
|
28
|
-
export { default as withAnalytics } from './utils/withAnalytics';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useRenderCounter: () => number;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsEventPayload } from './events/AnalyticsEvent';
|
|
2
|
-
import type UIAnalyticsEvent from './events/UIAnalyticsEvent';
|
|
3
|
-
export type CreateUIAnalyticsEvent = (payload: AnalyticsEventPayload) => UIAnalyticsEvent;
|
|
4
|
-
export type AnalyticsEventCreator = (create: CreateUIAnalyticsEvent, props: Record<string, any>) => UIAnalyticsEvent | undefined;
|
|
5
|
-
export type CreateEventMapValue = AnalyticsEventPayload | AnalyticsEventCreator;
|
|
6
|
-
export type CreateEventMap = Record<string, CreateEventMapValue>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsEventPayload } from '../events/AnalyticsEvent';
|
|
2
|
-
import type UIAnalyticsEvent from '../events/UIAnalyticsEvent';
|
|
3
|
-
import type { CreateUIAnalyticsEvent } from '../types';
|
|
4
|
-
declare const _default: (channel?: string) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent;
|
|
5
|
-
export default _default;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
type AnalyticsData = {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
};
|
|
6
|
-
type WithAnalyticsProps = {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
analyticsData?: AnalyticsData;
|
|
9
|
-
analyticsId?: string;
|
|
10
|
-
delegateAnalyticsEvent?: (analyticsId: string, data: any, isPrivate: boolean) => void;
|
|
11
|
-
fireAnalyticsEvent?: (name: string, data?: AnalyticsData) => void;
|
|
12
|
-
firePrivateAnalyticsEvent?: (name: string, data?: AnalyticsData) => void;
|
|
13
|
-
getParentAnalyticsData?: (name: string) => AnalyticsData;
|
|
14
|
-
innerRef?: React.Ref<any>;
|
|
15
|
-
};
|
|
16
|
-
type WithAnalyticsState = {
|
|
17
|
-
evaluatedMap: {
|
|
18
|
-
[key: string]: string | ((...args: any[]) => void);
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* The withAnalytics HOC wraps a component and provides the `fireAnalyticsEvent`
|
|
23
|
-
* and `firePrivateAnalyticsEvent` methods to it as props. It contains the logic
|
|
24
|
-
* for how to fire events, including handling the analyticsId and analyticsData
|
|
25
|
-
* props. The `map` argument may be an object or a function that returns an object.
|
|
26
|
-
* The properties of the `map` object/result can be strings (the name of the event
|
|
27
|
-
* that will be fired) or functions (which are responsible for firing the event).
|
|
28
|
-
* You can specify a default `analyticsId` and `analyticsData` with the `defaultProps`
|
|
29
|
-
* param. Please be aware that specifying a default `analyticsId` will cause public
|
|
30
|
-
* events to always fire for your component unless it has been set to a falsy by
|
|
31
|
-
* the component consumer.
|
|
32
|
-
*
|
|
33
|
-
* @param WrappedComponent
|
|
34
|
-
* @param map
|
|
35
|
-
* @param defaultProps
|
|
36
|
-
* @param withDelegation
|
|
37
|
-
*/
|
|
38
|
-
declare const withAnalytics: (WrappedComponent: React.ComponentType<any>, map?: {
|
|
39
|
-
[key: string]: string | ((...args: any[]) => void);
|
|
40
|
-
} | ((fireAnalyticsEvent: (name: string, data?: AnalyticsData) => void) => {
|
|
41
|
-
[key: string]: string | ((...args: any[]) => void);
|
|
42
|
-
}), defaultProps?: Partial<WithAnalyticsProps>, withDelegation?: boolean) => {
|
|
43
|
-
new (props: WithAnalyticsProps): {
|
|
44
|
-
componentDidMount(): void;
|
|
45
|
-
delegateAnalyticsEvent: (analyticsId: string, data: any, isPrivate: boolean) => void;
|
|
46
|
-
fireAnalyticsEvent: (name: string, data?: AnalyticsData) => void;
|
|
47
|
-
privateAnalyticsEvent: (name: string, data?: AnalyticsData) => void;
|
|
48
|
-
getParentAnalyticsData: (name: string) => AnalyticsData;
|
|
49
|
-
render(): React.JSX.Element;
|
|
50
|
-
context: unknown;
|
|
51
|
-
setState<K extends "evaluatedMap">(state: WithAnalyticsState | ((prevState: Readonly<WithAnalyticsState>, props: Readonly<WithAnalyticsProps>) => WithAnalyticsState | Pick<WithAnalyticsState, K> | null) | Pick<WithAnalyticsState, K> | null, callback?: (() => void) | undefined): void;
|
|
52
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
53
|
-
readonly props: Readonly<WithAnalyticsProps>;
|
|
54
|
-
state: Readonly<WithAnalyticsState>;
|
|
55
|
-
refs: {
|
|
56
|
-
[key: string]: React.ReactInstance;
|
|
57
|
-
};
|
|
58
|
-
shouldComponentUpdate?(nextProps: Readonly<WithAnalyticsProps>, nextState: Readonly<WithAnalyticsState>, nextContext: any): boolean;
|
|
59
|
-
componentWillUnmount?(): void;
|
|
60
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
61
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<WithAnalyticsProps>, prevState: Readonly<WithAnalyticsState>): any;
|
|
62
|
-
componentDidUpdate?(prevProps: Readonly<WithAnalyticsProps>, prevState: Readonly<WithAnalyticsState>, snapshot?: any): void;
|
|
63
|
-
componentWillMount?(): void;
|
|
64
|
-
UNSAFE_componentWillMount?(): void;
|
|
65
|
-
componentWillReceiveProps?(nextProps: Readonly<WithAnalyticsProps>, nextContext: any): void;
|
|
66
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<WithAnalyticsProps>, nextContext: any): void;
|
|
67
|
-
componentWillUpdate?(nextProps: Readonly<WithAnalyticsProps>, nextState: Readonly<WithAnalyticsState>, nextContext: any): void;
|
|
68
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<WithAnalyticsProps>, nextState: Readonly<WithAnalyticsState>, nextContext: any): void;
|
|
69
|
-
};
|
|
70
|
-
displayName: string;
|
|
71
|
-
contextTypes: {
|
|
72
|
-
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
73
|
-
getParentAnalyticsData: PropTypes.Requireable<(...args: any[]) => any>;
|
|
74
|
-
};
|
|
75
|
-
defaultProps: Partial<WithAnalyticsProps>;
|
|
76
|
-
contextType?: React.Context<any> | undefined;
|
|
77
|
-
};
|
|
78
|
-
export default withAnalytics;
|