@atlaskit/analytics-next 11.2.2 → 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.
Files changed (53) hide show
  1. package/AnalyticsContext/package.json +1 -8
  2. package/AnalyticsDecorator/package.json +1 -8
  3. package/AnalyticsDelegate/package.json +1 -8
  4. package/AnalyticsErrorBoundary/package.json +1 -8
  5. package/AnalyticsEvent/package.json +1 -8
  6. package/AnalyticsListener/package.json +1 -8
  7. package/AnalyticsReactContext/package.json +1 -8
  8. package/CHANGELOG.md +47 -0
  9. package/UIAnalyticsEvent/package.json +1 -8
  10. package/analytics-next.docs.tsx +210 -0
  11. package/cleanProps/package.json +1 -8
  12. package/createAndFireEvents/package.json +1 -8
  13. package/package.json +5 -10
  14. package/types/package.json +1 -8
  15. package/useAnalyticsEvents/package.json +1 -8
  16. package/useCallbackWithAnalytics/package.json +1 -8
  17. package/usePatchedProps/package.json +1 -8
  18. package/usePlatformLeafEventHandler/package.json +1 -8
  19. package/usePlatformLeafSyntheticEventHandler/package.json +1 -8
  20. package/withAnalytics/package.json +1 -8
  21. package/withAnalyticsContext/package.json +1 -8
  22. package/withAnalyticsEvents/package.json +1 -8
  23. package/dist/types-ts4.5/components/AnalyticsContext/LegacyAnalyticsContext.d.ts +0 -30
  24. package/dist/types-ts4.5/components/AnalyticsContext/ModernAnalyticsContext.d.ts +0 -3
  25. package/dist/types-ts4.5/components/AnalyticsContext/index.d.ts +0 -3
  26. package/dist/types-ts4.5/components/AnalyticsContext/types.d.ts +0 -8
  27. package/dist/types-ts4.5/components/AnalyticsDecorator/index.d.ts +0 -46
  28. package/dist/types-ts4.5/components/AnalyticsDelegate/index.d.ts +0 -25
  29. package/dist/types-ts4.5/components/AnalyticsErrorBoundary.d.ts +0 -25
  30. package/dist/types-ts4.5/components/AnalyticsListener/LegacyAnalyticsListener.d.ts +0 -34
  31. package/dist/types-ts4.5/components/AnalyticsListener/ModernAnalyticsListener.d.ts +0 -3
  32. package/dist/types-ts4.5/components/AnalyticsListener/index.d.ts +0 -3
  33. package/dist/types-ts4.5/components/AnalyticsListener/types.d.ts +0 -11
  34. package/dist/types-ts4.5/components/AnalyticsReactContext.d.ts +0 -2
  35. package/dist/types-ts4.5/components/matchEvent/index.d.ts +0 -3
  36. package/dist/types-ts4.5/events/AnalyticsEvent.d.ts +0 -15
  37. package/dist/types-ts4.5/events/UIAnalyticsEvent.d.ts +0 -20
  38. package/dist/types-ts4.5/hocs/withAnalyticsContext.d.ts +0 -6
  39. package/dist/types-ts4.5/hocs/withAnalyticsEvents.d.ts +0 -12
  40. package/dist/types-ts4.5/hooks/useAnalyticsContext.d.ts +0 -2
  41. package/dist/types-ts4.5/hooks/useAnalyticsEvents.d.ts +0 -5
  42. package/dist/types-ts4.5/hooks/useCallbackWithAnalytics.d.ts +0 -2
  43. package/dist/types-ts4.5/hooks/usePatchedProps.d.ts +0 -5
  44. package/dist/types-ts4.5/hooks/usePlatformLeafEventHandler.d.ts +0 -12
  45. package/dist/types-ts4.5/hooks/usePlatformLeafSyntheticEventHandler.d.ts +0 -11
  46. package/dist/types-ts4.5/hooks/useTrackedRef.d.ts +0 -2
  47. package/dist/types-ts4.5/index.d.ts +0 -28
  48. package/dist/types-ts4.5/test-utils/useRenderCounter.d.ts +0 -1
  49. package/dist/types-ts4.5/types.d.ts +0 -6
  50. package/dist/types-ts4.5/utils/cleanProps.d.ts +0 -3
  51. package/dist/types-ts4.5/utils/createAndFireEvent.d.ts +0 -5
  52. package/dist/types-ts4.5/utils/isModernContextEnabledEnv.d.ts +0 -2
  53. 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,52 @@
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
+
29
+ ## 11.3.0
30
+
31
+ ### Minor Changes
32
+
33
+ - [`f8b3089961cdf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f8b3089961cdf) -
34
+ Extend `StructuredContentSource` so `*.docs.tsx` files can describe packages whose exports are not
35
+ all renderable React components. The container now accepts optional `package`, `hooks`, and
36
+ `utilities` (function / constant / type) keys alongside the existing `components` key. New
37
+ per-kind schemas: `hookDocsSourceSchema`, `utilityDocsSourceSchema`, plus `packageMetadataSchema`
38
+ for shared package-level metadata.
39
+
40
+ All new fields are optional, so existing components-only `*.docs.tsx` files continue to work
41
+ unchanged — this is an additive, non-breaking extension.
42
+
43
+ Pilots the new shape with `docs.tsx` files for `@atlaskit/analytics-next`, `@atlaskit/layering`,
44
+ `@af/accessibility-testing`, `@af/react-unit-testing`, `@atlaskit/pragmatic-drag-and-drop-hitbox`,
45
+ `@atlaskit/pragmatic-drag-and-drop-live-region`, `@atlaskit/feature-flag-client`,
46
+ `@atlaskit/frontend-utilities`, and `@atlaskit/linking-common`. The last two are non-ADS pilots
47
+ that exercise the new `hooks` and `utilities` kinds in `helpers/` and `linking-platform/`. These
48
+ pilot files are explicitly marked as non-final in their file-level JSDoc.
49
+
3
50
  ## 11.2.2
4
51
 
5
52
  ### Patch 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
  }
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Structured MCP docs for `@atlaskit/analytics-next`.
3
+ *
4
+ * ⚠️ Pilot / not yet final. This file is part of the libraries-content pilot
5
+ * for the "Libraries, hooks, utilities in structured content" RFC. The
6
+ * container schema and per-kind shapes are still in review — expect breaking
7
+ * changes before this is rolled out broadly. Do not depend on the format yet.
8
+ *
9
+ * This is the canonical mixed-kind example: the package exports React
10
+ * components (`AnalyticsListener`), hooks (`useAnalyticsEvents`), and utility
11
+ * functions (`createAndFireEvent`). Each kind lands in the matching top-level
12
+ * key of the container schema.
13
+ *
14
+ * Contact #dst-structured-content in Slack with questions.
15
+ */
16
+
17
+ import path from 'path';
18
+
19
+ import type { StructuredContentSource } from '@atlassian/structured-docs-types';
20
+
21
+ import packageJson from './package.json';
22
+
23
+ const packagePath = path.resolve(__dirname);
24
+
25
+ const documentation: StructuredContentSource = {
26
+ package: {
27
+ package: '@atlaskit/analytics-next',
28
+ packagePath,
29
+ packageJson,
30
+ overview:
31
+ 'React components, hooks, and helpers for instrumenting user activity. Wrap your app in an `AnalyticsListener` to subscribe to events on a channel, fire events from your components with `useAnalyticsEvents`, and decorate child events with `AnalyticsContext`.',
32
+ },
33
+ components: [
34
+ {
35
+ name: 'AnalyticsListener',
36
+ description:
37
+ 'Subscribes to analytics events fired on a given channel from anywhere in its subtree. Mount once near the app root per channel you want to listen on.',
38
+ status: 'general-availability',
39
+ import: {
40
+ name: 'AnalyticsListener',
41
+ package: '@atlaskit/analytics-next',
42
+ type: 'named',
43
+ packagePath,
44
+ packageJson,
45
+ },
46
+ usageGuidelines: [
47
+ 'Mount one listener per channel near the app root. Use `channel="*"` to listen to every channel.',
48
+ 'Forward received events to your downstream analytics SDK (Segment, GASv3, etc.) inside `onEvent`.',
49
+ ],
50
+ keywords: ['analytics', 'listener', 'events', 'analytics-next'],
51
+ categories: ['analytics'],
52
+ examples: [
53
+ {
54
+ name: 'Basic listener',
55
+ description: 'Subscribe to an entire app and log events.',
56
+ source: path.resolve(packagePath, './examples/10-basic-create-and-fire.tsx'),
57
+ },
58
+ ],
59
+ },
60
+ {
61
+ name: 'AnalyticsContext',
62
+ description:
63
+ 'Decorates every analytics event fired in its subtree with extra context data (e.g. the current page or feature area).',
64
+ status: 'general-availability',
65
+ import: {
66
+ name: 'AnalyticsContext',
67
+ package: '@atlaskit/analytics-next',
68
+ type: 'named',
69
+ packagePath,
70
+ packageJson,
71
+ },
72
+ usageGuidelines: [
73
+ 'Nest `AnalyticsContext` providers — context from each one is appended in order, so the closest provider is last in the resulting array.',
74
+ ],
75
+ keywords: ['analytics', 'context', 'analytics-next'],
76
+ categories: ['analytics'],
77
+ examples: [
78
+ {
79
+ name: 'Adding context',
80
+ description: 'Attach feature area context to all child events.',
81
+ source: path.resolve(packagePath, './examples/20-adding-analytics-context.tsx'),
82
+ },
83
+ ],
84
+ },
85
+ {
86
+ name: 'AnalyticsErrorBoundary',
87
+ description:
88
+ 'Error boundary that fires an analytics event when a render error is caught, then optionally renders a fallback UI.',
89
+ status: 'general-availability',
90
+ import: {
91
+ name: 'AnalyticsErrorBoundary',
92
+ package: '@atlaskit/analytics-next',
93
+ type: 'named',
94
+ packagePath,
95
+ packageJson,
96
+ },
97
+ usageGuidelines: [
98
+ 'Wrap experiences whose render failures you want to instrument. Provide `ErrorComponent` for a graceful fallback.',
99
+ ],
100
+ keywords: ['analytics', 'error-boundary', 'analytics-next'],
101
+ categories: ['analytics', 'error-handling'],
102
+ examples: [
103
+ {
104
+ name: 'Error boundary with fallback',
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
+ ),
111
+ },
112
+ ],
113
+ },
114
+ ],
115
+ hooks: [
116
+ {
117
+ name: 'useAnalyticsEvents',
118
+ description:
119
+ 'Returns `createAnalyticsEvent`, a stable callback that produces a `UIAnalyticsEvent` pre-wired with the surrounding analytics context and handlers. Call `.fire(channel)` on the returned event to dispatch it.',
120
+ status: 'general-availability',
121
+ parameters: [],
122
+ returns: {
123
+ type: '{ createAnalyticsEvent: (payload: AnalyticsEventPayload) => UIAnalyticsEvent }',
124
+ description:
125
+ '`createAnalyticsEvent` is referentially stable per nearest `AnalyticsContext`, so it is safe to put in dependency arrays.',
126
+ },
127
+ usageGuidelines: [
128
+ 'Use inside any component that needs to fire events. Always pair with a parent `AnalyticsListener`, otherwise events fire into the void.',
129
+ 'Build the payload with the smallest information the listener needs — heavy serialisation belongs in the handler, not the call site.',
130
+ ],
131
+ keywords: ['analytics', 'hook', 'useAnalyticsEvents', 'analytics-next'],
132
+ categories: ['analytics', 'hooks'],
133
+ examples: [
134
+ {
135
+ name: 'Fire on click',
136
+ description: 'Create and fire a click event from a button handler.',
137
+ source: path.resolve(packagePath, './examples/10-basic-create-and-fire.tsx'),
138
+ },
139
+ ],
140
+ },
141
+ ],
142
+ utilities: [
143
+ {
144
+ kind: 'function',
145
+ name: 'createAndFireEvent',
146
+ description:
147
+ 'Curried helper that builds a `UIAnalyticsEvent` for a payload and fires it on a channel in one go. The original event is also returned so the call site can keep working with it.',
148
+ status: 'general-availability',
149
+ signature:
150
+ '(channel?: string) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent',
151
+ parameters: [
152
+ {
153
+ name: 'channel',
154
+ type: 'string',
155
+ description: 'Optional channel to fire on.',
156
+ isOptional: true,
157
+ },
158
+ { name: 'payload', type: 'AnalyticsEventPayload' },
159
+ {
160
+ name: 'createAnalyticsEvent',
161
+ type: 'CreateUIAnalyticsEvent',
162
+ description: 'The factory from `useAnalyticsEvents()` or `withAnalyticsEvents`.',
163
+ },
164
+ ],
165
+ returns: {
166
+ type: 'UIAnalyticsEvent',
167
+ description:
168
+ 'The original (un-cloned) consumer event so callers can attach further context.',
169
+ },
170
+ usageGuidelines: [
171
+ 'Reach for `createAndFireEvent` when you want a one-liner inside an event handler. For more complex flows, build and fire the event explicitly.',
172
+ ],
173
+ keywords: ['analytics', 'utility', 'createAndFireEvent', 'analytics-next'],
174
+ categories: ['analytics', 'utilities'],
175
+ examples: [],
176
+ },
177
+ {
178
+ kind: 'function',
179
+ name: 'isUIAnalyticsEvent',
180
+ description:
181
+ 'Type-guard that returns true if the given value is a `UIAnalyticsEvent` (including instances from older copies of `analytics-next`).',
182
+ status: 'general-availability',
183
+ signature: '(obj: unknown) => obj is UIAnalyticsEvent',
184
+ parameters: [{ name: 'obj', type: 'unknown' }],
185
+ returns: { type: 'boolean' },
186
+ usageGuidelines: [
187
+ 'Use in listener handlers when you receive events from third-party code and need to narrow before reading `.payload`.',
188
+ ],
189
+ keywords: ['analytics', 'guard', 'isUIAnalyticsEvent', 'analytics-next'],
190
+ categories: ['analytics', 'utilities'],
191
+ examples: [],
192
+ },
193
+ {
194
+ kind: 'type',
195
+ name: 'UIAnalyticsEventHandler',
196
+ description:
197
+ 'Signature for any function that receives events from an `AnalyticsListener`. Implement to forward events to your analytics SDK.',
198
+ status: 'general-availability',
199
+ definition: '(event: UIAnalyticsEvent, channel?: string) => void',
200
+ usageGuidelines: [
201
+ 'Handlers must not throw — analytics must never crash product UI. The runtime swallows handler errors in production and logs them in development.',
202
+ ],
203
+ keywords: ['analytics', 'type', 'handler', 'UIAnalyticsEventHandler', 'analytics-next'],
204
+ categories: ['analytics', 'types'],
205
+ examples: [],
206
+ },
207
+ ],
208
+ };
209
+
210
+ export default documentation;
@@ -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": "11.2.2",
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": "^1.1.0",
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"
@@ -51,7 +43,10 @@
51
43
  "@atlassian/feature-flags-test-utils": "^1.1.0",
52
44
  "@atlassian/react-compiler-gating": "workspace:^",
53
45
  "@atlassian/ssr-tests": "workspace:^",
46
+ "@atlassian/structured-docs-types": "workspace:^",
54
47
  "@testing-library/react": "^16.3.0",
48
+ "react": "^18.2.0",
49
+ "react-dom": "^18.2.0",
55
50
  "storybook-addon-performance": "^0.17.3"
56
51
  },
57
52
  "overrides": {
@@ -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,3 +0,0 @@
1
- import type { AnalyticsContextFunction } from './types';
2
- declare const AnalyticsContext: AnalyticsContextFunction;
3
- export default AnalyticsContext;
@@ -1,3 +0,0 @@
1
- import type { AnalyticsContextFunction } from './types';
2
- declare const AnalyticsContext: AnalyticsContextFunction;
3
- 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,3 +0,0 @@
1
- import type { AnalyticsListenerFunction } from './types';
2
- declare const AnalyticsListener: AnalyticsListenerFunction;
3
- export default AnalyticsListener;
@@ -1,3 +0,0 @@
1
- import type { AnalyticsListenerFunction } from './types';
2
- declare const AnalyticsListener: AnalyticsListenerFunction;
3
- 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,2 +0,0 @@
1
- export { default } from '@atlaskit/analytics-next-stable-react-context';
2
- export type { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
@@ -1,3 +0,0 @@
1
- export type Matcher = string | RegExp | ((name: string) => boolean) | '*';
2
- declare function matchEvent(matcher: Matcher, name: string): boolean;
3
- export default matchEvent;
@@ -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,2 +0,0 @@
1
- import { type AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
2
- export declare const useAnalyticsContext: () => AnalyticsReactContextInterface;
@@ -1,5 +0,0 @@
1
- import type { CreateUIAnalyticsEvent } from '../types';
2
- export type UseAnalyticsEventsHook = {
3
- createAnalyticsEvent: CreateUIAnalyticsEvent;
4
- };
5
- export declare function useAnalyticsEvents(): UseAnalyticsEventsHook;
@@ -1,2 +0,0 @@
1
- export type UseCallbackWithAnalyticsHook = (method: (...args: any[]) => void, payload: Record<string, any> | ((...args: any[]) => void), channel?: string) => (...args: any[]) => void;
2
- export declare const useCallbackWithAnalytics: UseCallbackWithAnalyticsHook;
@@ -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,2 +0,0 @@
1
- import { type MutableRefObject } from 'react';
2
- export declare const useTrackedRef: <T>(value: T) => MutableRefObject<T>;
@@ -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,3 +0,0 @@
1
- export default function cleanProps(props: Record<string, any>): {
2
- [x: string]: any;
3
- };
@@ -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,2 +0,0 @@
1
- declare const _default_1: string | false | undefined;
2
- export default _default_1;
@@ -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;