@availity/mui-event-tracker 2.0.6 → 3.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/CHANGELOG.md +32 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +11 -40
- package/package.json +20 -21
- package/project.json +5 -6
- package/src/lib/EventTracker.test.tsx +4 -4
- package/src/lib/EventTracker.tsx +2 -2
- package/dist/index.d.mts +0 -35
- package/dist/index.mjs +0 -39
- package/jest.config.js +0 -7
- package/tsconfig.spec.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [3.0.0](https://github.com/Availity/element/compare/@availity/mui-event-tracker@2.0.6...@availity/mui-event-tracker@3.0.0) (2026-06-16)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-button` updated to version `2.0.6`
|
|
10
|
+
* `mui-form-utils` updated to version `2.0.6`
|
|
11
|
+
* `mui-layout` updated to version `2.0.6`
|
|
12
|
+
* `mui-menu` updated to version `2.0.6`
|
|
13
|
+
* `mui-textfield` updated to version `2.0.6`
|
|
14
|
+
* `mui-typography` updated to version `2.0.6`
|
|
15
|
+
|
|
16
|
+
### ⚠ BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* CJS builds removed, packages are ESM-only.
|
|
19
|
+
|
|
20
|
+
- Convert all packages to ESM (type: module)
|
|
21
|
+
- Replace Jest with Vitest for all test targets
|
|
22
|
+
- Migrate ESLint to v9 flat config (eslint.config.js)
|
|
23
|
+
- Build output ESM-only (removed CJS dist/index.js require path)
|
|
24
|
+
- Upgrade @tanstack/react-query from v4 to v5
|
|
25
|
+
- Upgrade @availity/api-axios to v13
|
|
26
|
+
- Drop Node 20 support (engines: ^22.0.0 || ^24.0.0)
|
|
27
|
+
- Bump React to 19.2.7, MUI to 7.3.11, TypeScript to 5.9.3
|
|
28
|
+
- Simplify CI caching with built-in yarn cache action + Nx cache
|
|
29
|
+
- Modernize nx.json configuration
|
|
30
|
+
- Update husky hooks to use yarn directly
|
|
31
|
+
- Replace lint-staged nx affected with direct eslint
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* migrate to ESM, Vitest, and ESLint 9 flat config ([cc22bb4](https://github.com/Availity/element/commit/cc22bb4a230bc1f3b190f187c4e61249d015b25b))
|
|
36
|
+
|
|
5
37
|
## [2.0.6](https://github.com/Availity/element/compare/@availity/mui-event-tracker@2.0.5...@availity/mui-event-tracker@2.0.6) (2026-05-27)
|
|
6
38
|
|
|
7
39
|
### Dependency Updates
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { AvAnalytics } from '@availity/analytics-core';
|
|
4
3
|
|
|
@@ -30,6 +29,6 @@ type EventTrackerProps = {
|
|
|
30
29
|
};
|
|
31
30
|
declare const EventTrackerContext: React.Context<AvAnalytics | null>;
|
|
32
31
|
declare const useEventTracker: () => AvAnalytics;
|
|
33
|
-
declare const EventTrackerProvider: ({ children, plugins, pageTracking, autoTrack, recursive, attributePrefix, eventModifiers, }: EventTrackerProps) =>
|
|
32
|
+
declare const EventTrackerProvider: ({ children, plugins, pageTracking, autoTrack, recursive, attributePrefix, eventModifiers, }: EventTrackerProps) => React.JSX.Element;
|
|
34
33
|
|
|
35
34
|
export { EventTrackerContext, type EventTrackerProps, EventTrackerProvider, useEventTracker };
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
EventTrackerContext: () => EventTrackerContext,
|
|
24
|
-
EventTrackerProvider: () => EventTrackerProvider,
|
|
25
|
-
useEventTracker: () => useEventTracker
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
1
|
// src/lib/EventTracker.tsx
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var EventTrackerContext =
|
|
2
|
+
import { createContext, useContext, useEffect, useMemo } from "react";
|
|
3
|
+
import { AvAnalytics } from "@availity/analytics-core";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var EventTrackerContext = createContext(null);
|
|
34
6
|
var useEventTracker = () => {
|
|
35
|
-
const ctx =
|
|
7
|
+
const ctx = useContext(EventTrackerContext);
|
|
36
8
|
if (!ctx) {
|
|
37
9
|
throw new Error("useEventTracker must be used within an EventTrackerProvider");
|
|
38
10
|
}
|
|
@@ -47,22 +19,21 @@ var EventTrackerProvider = ({
|
|
|
47
19
|
attributePrefix = "data-analytics",
|
|
48
20
|
eventModifiers = ["action"]
|
|
49
21
|
}) => {
|
|
50
|
-
const analytics =
|
|
51
|
-
() => new
|
|
22
|
+
const analytics = useMemo(
|
|
23
|
+
() => new AvAnalytics(plugins, Promise, pageTracking, autoTrack, { recursive, attributePrefix, eventModifiers }),
|
|
52
24
|
[attributePrefix, autoTrack, eventModifiers, pageTracking, plugins, recursive]
|
|
53
25
|
);
|
|
54
|
-
|
|
26
|
+
useEffect(() => {
|
|
55
27
|
analytics.init();
|
|
56
28
|
if (pageTracking) {
|
|
57
29
|
analytics.trackPageView();
|
|
58
30
|
}
|
|
59
31
|
return () => analytics.stopAutoTrack();
|
|
60
32
|
}, [analytics, pageTracking]);
|
|
61
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ jsx(EventTrackerContext.Provider, { value: analytics, children });
|
|
62
34
|
};
|
|
63
|
-
|
|
64
|
-
0 && (module.exports = {
|
|
35
|
+
export {
|
|
65
36
|
EventTrackerContext,
|
|
66
37
|
EventTrackerProvider,
|
|
67
38
|
useEventTracker
|
|
68
|
-
}
|
|
39
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-event-tracker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Availity MUI EventTracker Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -21,36 +21,34 @@
|
|
|
21
21
|
"author": "Availity Developers <AVOSS@availity.com>",
|
|
22
22
|
"browser": "./dist/index.js",
|
|
23
23
|
"main": "./dist/index.js",
|
|
24
|
-
"module": "./dist/index.mjs",
|
|
25
24
|
"types": "./dist/index.d.ts",
|
|
26
25
|
"exports": {
|
|
27
|
-
"./package.json": "./package.json",
|
|
28
26
|
".": {
|
|
29
27
|
"types": "./dist/index.d.ts",
|
|
30
|
-
"import": "./dist/index.
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
"import": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
33
31
|
},
|
|
34
32
|
"scripts": {
|
|
35
|
-
"build": "tsup src/index.ts --format esm
|
|
36
|
-
"dev": "tsup src/index.ts --format esm
|
|
33
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
34
|
+
"dev": "tsup src/index.ts --format esm --watch --dts",
|
|
37
35
|
"clean": "rm -rf dist",
|
|
38
36
|
"clean:nm": "rm -rf node_modules",
|
|
39
37
|
"publish": "yarn npm publish --tolerate-republish --access public",
|
|
40
38
|
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
41
39
|
},
|
|
42
40
|
"devDependencies": {
|
|
43
|
-
"@availity/mui-button": "^
|
|
44
|
-
"@availity/mui-form-utils": "^
|
|
45
|
-
"@availity/mui-layout": "^
|
|
46
|
-
"@availity/mui-menu": "^
|
|
47
|
-
"@availity/mui-textfield": "^
|
|
48
|
-
"@availity/mui-typography": "^
|
|
49
|
-
"@mui/material": "^7.3.
|
|
50
|
-
"react": "19.2.
|
|
51
|
-
"react-dom": "19.2.
|
|
52
|
-
"tsup": "^8.
|
|
53
|
-
"typescript": "^5.
|
|
41
|
+
"@availity/mui-button": "^3.0.0",
|
|
42
|
+
"@availity/mui-form-utils": "^3.0.0",
|
|
43
|
+
"@availity/mui-layout": "^3.0.0",
|
|
44
|
+
"@availity/mui-menu": "^3.0.0",
|
|
45
|
+
"@availity/mui-textfield": "^3.0.0",
|
|
46
|
+
"@availity/mui-typography": "^3.0.0",
|
|
47
|
+
"@mui/material": "^7.3.11",
|
|
48
|
+
"react": "19.2.7",
|
|
49
|
+
"react-dom": "19.2.7",
|
|
50
|
+
"tsup": "^8.5.1",
|
|
51
|
+
"typescript": "^5.9.3"
|
|
54
52
|
},
|
|
55
53
|
"peerDependencies": {
|
|
56
54
|
"@mui/material": "^7.0.0",
|
|
@@ -60,7 +58,8 @@
|
|
|
60
58
|
"access": "public"
|
|
61
59
|
},
|
|
62
60
|
"dependencies": {
|
|
63
|
-
"@availity/analytics-core": "^
|
|
61
|
+
"@availity/analytics-core": "^7.2.0"
|
|
64
62
|
},
|
|
65
|
-
"sideEffects": false
|
|
63
|
+
"sideEffects": false,
|
|
64
|
+
"type": "module"
|
|
66
65
|
}
|
package/project.json
CHANGED
|
@@ -8,23 +8,20 @@
|
|
|
8
8
|
"lint": {
|
|
9
9
|
"executor": "@nx/eslint:lint",
|
|
10
10
|
"options": {
|
|
11
|
-
"eslintConfig": ".eslintrc.json",
|
|
12
11
|
"silent": false,
|
|
13
12
|
"fix": false,
|
|
14
13
|
"cache": true,
|
|
15
14
|
"cacheLocation": "./node_modules/.cache/event-tracker/.eslintcache",
|
|
16
15
|
"maxWarnings": -1,
|
|
17
16
|
"quiet": false,
|
|
18
|
-
"noEslintrc": false,
|
|
19
17
|
"hasTypeAwareRules": true,
|
|
20
18
|
"cacheStrategy": "metadata"
|
|
21
19
|
}
|
|
22
20
|
},
|
|
23
21
|
"test": {
|
|
24
|
-
"executor": "
|
|
25
|
-
"outputs": ["{workspaceRoot}/coverage/event-tracker"],
|
|
22
|
+
"executor": "nx:run-commands",
|
|
26
23
|
"options": {
|
|
27
|
-
"
|
|
24
|
+
"command": "vitest run packages/event-tracker"
|
|
28
25
|
}
|
|
29
26
|
},
|
|
30
27
|
"version": {
|
|
@@ -34,7 +31,9 @@
|
|
|
34
31
|
"commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
|
|
35
32
|
"tagPrefix": "@availity/{projectName}@",
|
|
36
33
|
"trackDeps": true,
|
|
37
|
-
"skipCommitTypes": [
|
|
34
|
+
"skipCommitTypes": [
|
|
35
|
+
"docs"
|
|
36
|
+
]
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
}
|
|
@@ -4,10 +4,10 @@ import { render, cleanup, fireEvent, waitFor } from '@testing-library/react';
|
|
|
4
4
|
import { EventTrackerProvider, useEventTracker } from './EventTracker';
|
|
5
5
|
|
|
6
6
|
const makePlugin = () => ({
|
|
7
|
-
isEnabled:
|
|
8
|
-
init:
|
|
9
|
-
trackEvent:
|
|
10
|
-
trackPageView:
|
|
7
|
+
isEnabled: vi.fn(() => true),
|
|
8
|
+
init: vi.fn(),
|
|
9
|
+
trackEvent: vi.fn(),
|
|
10
|
+
trackPageView: vi.fn(),
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
describe('EventTracker', () => {
|
package/src/lib/EventTracker.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { createContext, useContext, useEffect, useMemo } from 'react';
|
|
2
|
-
import { AvAnalytics } from '@availity/analytics-core';
|
|
2
|
+
import { AvAnalytics, AvAnalyticsPlugin } from '@availity/analytics-core';
|
|
3
3
|
|
|
4
4
|
export type EventTrackerProps = {
|
|
5
5
|
/** */
|
|
@@ -50,7 +50,7 @@ export const EventTrackerProvider = ({
|
|
|
50
50
|
eventModifiers = ['action'],
|
|
51
51
|
}: EventTrackerProps) => {
|
|
52
52
|
const analytics = useMemo(
|
|
53
|
-
() => new AvAnalytics(plugins, Promise, pageTracking, autoTrack, { recursive, attributePrefix, eventModifiers }),
|
|
53
|
+
() => new AvAnalytics(plugins as AvAnalyticsPlugin[], Promise, pageTracking, autoTrack, { recursive, attributePrefix, eventModifiers }),
|
|
54
54
|
[attributePrefix, autoTrack, eventModifiers, pageTracking, plugins, recursive]
|
|
55
55
|
);
|
|
56
56
|
|
package/dist/index.d.mts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AvAnalytics } from '@availity/analytics-core';
|
|
4
|
-
|
|
5
|
-
type EventTrackerProps = {
|
|
6
|
-
/** */
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
/** An array of plugins to pass to the underlying AvAnalytics class instance. */
|
|
9
|
-
plugins?: any[];
|
|
10
|
-
/** Enable or disable page tracking on initialization.
|
|
11
|
-
* @default true
|
|
12
|
-
*/
|
|
13
|
-
pageTracking?: boolean;
|
|
14
|
-
/** Enable or disable auto tracking on initialization.
|
|
15
|
-
* @default true
|
|
16
|
-
*/
|
|
17
|
-
autoTrack?: boolean;
|
|
18
|
-
/** Enable or disable recursive functionality on initialization.
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
recursive?: boolean;
|
|
22
|
-
/** Customize the prefix used for data event tracker attributes used for auto tracking.
|
|
23
|
-
* @default 'data-analytics'
|
|
24
|
-
*/
|
|
25
|
-
attributePrefix?: string;
|
|
26
|
-
/** Array of event modifiers enabling you to use other keywords for action instead of click for event type matching.
|
|
27
|
-
* @default ['action']
|
|
28
|
-
*/
|
|
29
|
-
eventModifiers?: any[];
|
|
30
|
-
};
|
|
31
|
-
declare const EventTrackerContext: React.Context<AvAnalytics | null>;
|
|
32
|
-
declare const useEventTracker: () => AvAnalytics;
|
|
33
|
-
declare const EventTrackerProvider: ({ children, plugins, pageTracking, autoTrack, recursive, attributePrefix, eventModifiers, }: EventTrackerProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
-
|
|
35
|
-
export { EventTrackerContext, type EventTrackerProps, EventTrackerProvider, useEventTracker };
|
package/dist/index.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// src/lib/EventTracker.tsx
|
|
2
|
-
import { createContext, useContext, useEffect, useMemo } from "react";
|
|
3
|
-
import { AvAnalytics } from "@availity/analytics-core";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var EventTrackerContext = createContext(null);
|
|
6
|
-
var useEventTracker = () => {
|
|
7
|
-
const ctx = useContext(EventTrackerContext);
|
|
8
|
-
if (!ctx) {
|
|
9
|
-
throw new Error("useEventTracker must be used within an EventTrackerProvider");
|
|
10
|
-
}
|
|
11
|
-
return ctx;
|
|
12
|
-
};
|
|
13
|
-
var EventTrackerProvider = ({
|
|
14
|
-
children,
|
|
15
|
-
plugins,
|
|
16
|
-
pageTracking = true,
|
|
17
|
-
autoTrack = true,
|
|
18
|
-
recursive = true,
|
|
19
|
-
attributePrefix = "data-analytics",
|
|
20
|
-
eventModifiers = ["action"]
|
|
21
|
-
}) => {
|
|
22
|
-
const analytics = useMemo(
|
|
23
|
-
() => new AvAnalytics(plugins, Promise, pageTracking, autoTrack, { recursive, attributePrefix, eventModifiers }),
|
|
24
|
-
[attributePrefix, autoTrack, eventModifiers, pageTracking, plugins, recursive]
|
|
25
|
-
);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
analytics.init();
|
|
28
|
-
if (pageTracking) {
|
|
29
|
-
analytics.trackPageView();
|
|
30
|
-
}
|
|
31
|
-
return () => analytics.stopAutoTrack();
|
|
32
|
-
}, [analytics, pageTracking]);
|
|
33
|
-
return /* @__PURE__ */ jsx(EventTrackerContext.Provider, { value: analytics, children });
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
EventTrackerContext,
|
|
37
|
-
EventTrackerProvider,
|
|
38
|
-
useEventTracker
|
|
39
|
-
};
|
package/jest.config.js
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"types": ["jest", "node", "@testing-library/jest-dom"],
|
|
7
|
-
"allowJs": true
|
|
8
|
-
},
|
|
9
|
-
"include": ["jest.config.ts", "**/*.test.js", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
|
|
10
|
-
}
|