@availity/mui-authorize 2.0.6 → 3.0.1

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 CHANGED
@@ -2,6 +2,39 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [3.0.1](https://github.com/Availity/element/compare/@availity/mui-authorize@3.0.0...@availity/mui-authorize@3.0.1) (2026-09-14)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `mui-block-ui` updated to version `3.0.0`
10
+ ## [3.0.0](https://github.com/Availity/element/compare/@availity/mui-authorize@2.0.6...@availity/mui-authorize@3.0.0) (2026-06-16)
11
+
12
+ ### Dependency Updates
13
+
14
+ * `mui-block-ui` updated to version `2.0.6`
15
+ * `@availity/mock` updated to version `2.0.6`
16
+
17
+ ### ⚠ BREAKING CHANGES
18
+
19
+ * CJS builds removed, packages are ESM-only.
20
+
21
+ - Convert all packages to ESM (type: module)
22
+ - Replace Jest with Vitest for all test targets
23
+ - Migrate ESLint to v9 flat config (eslint.config.js)
24
+ - Build output ESM-only (removed CJS dist/index.js require path)
25
+ - Upgrade @tanstack/react-query from v4 to v5
26
+ - Upgrade @availity/api-axios to v13
27
+ - Drop Node 20 support (engines: ^22.0.0 || ^24.0.0)
28
+ - Bump React to 19.2.7, MUI to 7.3.11, TypeScript to 5.9.3
29
+ - Simplify CI caching with built-in yarn cache action + Nx cache
30
+ - Modernize nx.json configuration
31
+ - Update husky hooks to use yarn directly
32
+ - Replace lint-staged nx affected with direct eslint
33
+
34
+ ### Features
35
+
36
+ * migrate to ESM, Vitest, and ESLint 9 flat config ([cc22bb4](https://github.com/Availity/element/commit/cc22bb4a230bc1f3b190f187c4e61249d015b25b))
37
+
5
38
  ## [2.0.6](https://github.com/Availity/element/compare/@availity/mui-authorize@2.0.5...@availity/mui-authorize@2.0.6) (2026-05-27)
6
39
 
7
40
  ## [2.0.5](https://github.com/Availity/element/compare/@availity/mui-authorize@2.0.4...@availity/mui-authorize@2.0.5) (2026-03-03)
package/dist/index.js CHANGED
@@ -1,33 +1,7 @@
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
- Authorize: () => Authorize
24
- });
25
- module.exports = __toCommonJS(index_exports);
26
-
27
1
  // src/lib/Authorize.tsx
28
- var import_mui_block_ui = require("@availity/mui-block-ui");
29
- var import_authorize = require("@availity/authorize");
30
- var import_jsx_runtime = require("react/jsx-runtime");
2
+ import { BlockUi } from "@availity/mui-block-ui";
3
+ import { useAuthorize } from "@availity/authorize";
4
+ import { Fragment, jsx } from "react/jsx-runtime";
31
5
  var Authorize = ({
32
6
  loader = true,
33
7
  negate = false,
@@ -37,17 +11,16 @@ var Authorize = ({
37
11
  parameters = {},
38
12
  queryOptions
39
13
  }) => {
40
- const { authorized, isLoading } = (0, import_authorize.useAuthorize)(permissions, parameters, queryOptions);
14
+ const { authorized, isLoading } = useAuthorize(permissions, parameters, queryOptions);
41
15
  if (isLoading) {
42
- if (loader) return loader === true ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_block_ui.BlockUi, { blocking: true }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: loader });
16
+ if (loader) return loader === true ? /* @__PURE__ */ jsx(BlockUi, { blocking: true }) : /* @__PURE__ */ jsx(Fragment, { children: loader });
43
17
  return null;
44
18
  }
45
19
  if ((authorized || negate) && !(authorized && negate)) {
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
20
+ return /* @__PURE__ */ jsx(Fragment, { children });
47
21
  }
48
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: unauthorized });
22
+ return /* @__PURE__ */ jsx(Fragment, { children: unauthorized });
49
23
  };
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
24
+ export {
52
25
  Authorize
53
- });
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-authorize",
3
- "version": "2.0.6",
3
+ "version": "3.0.1",
4
4
  "description": "Availity Authorize Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -21,42 +21,42 @@
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.mjs",
31
- "require": "./dist/index.js"
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,cjs --dts",
36
- "dev": "tsup src/index.ts --format esm,cjs --watch --dts",
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
  "dependencies": {
43
- "@availity/authorize": "^5.0.6",
44
- "@availity/mui-block-ui": "^2.0.2",
45
- "@tanstack/react-query": "^4.36.1"
41
+ "@availity/authorize": "^6.0.1",
42
+ "@availity/mui-block-ui": "^3.0.1"
46
43
  },
47
44
  "devDependencies": {
48
- "@mui/material": "^7.3.4",
49
- "react": "19.2.0",
50
- "react-dom": "19.2.0",
51
- "tsup": "^8.4.0",
52
- "typescript": "^5.4.5"
45
+ "@mui/material": "^7.3.11",
46
+ "@tanstack/react-query": "^5.101.0",
47
+ "react": "19.2.7",
48
+ "react-dom": "19.2.7",
49
+ "tsup": "^8.5.1",
50
+ "typescript": "^5.9.3"
53
51
  },
54
52
  "peerDependencies": {
55
53
  "@mui/material": "^7.0.0",
54
+ "@tanstack/react-query": "^5.101.0",
56
55
  "react": ">=17.0.0"
57
56
  },
58
57
  "publishConfig": {
59
58
  "access": "public"
60
59
  },
61
- "sideEffects": false
60
+ "sideEffects": false,
61
+ "type": "module"
62
62
  }
package/project.json CHANGED
@@ -8,25 +8,23 @@
8
8
  "lint": {
9
9
  "executor": "@nx/eslint:lint",
10
10
  "options": {
11
- "eslintConfig": ".eslintrc.json",
12
- "lintFilePatterns": ["packages/authorize/**/*.{js,ts}"],
11
+ "lintFilePatterns": [
12
+ "packages/authorize/**/*.{js,ts}"
13
+ ],
13
14
  "silent": false,
14
15
  "fix": false,
15
16
  "cache": true,
16
17
  "cacheLocation": "./node_modules/.cache/authorize/.eslintcache",
17
18
  "maxWarnings": -1,
18
19
  "quiet": false,
19
- "noEslintrc": false,
20
20
  "hasTypeAwareRules": true,
21
21
  "cacheStrategy": "metadata"
22
22
  }
23
23
  },
24
24
  "test": {
25
- "executor": "@nx/jest:jest",
26
- "outputs": ["{workspaceRoot}/coverage/authorize"],
25
+ "executor": "nx:run-commands",
27
26
  "options": {
28
- "jestConfig": "packages/authorize/jest.config.js",
29
- "passWithNoTests": true
27
+ "command": "vitest run packages/authorize"
30
28
  }
31
29
  },
32
30
  "version": {
@@ -36,7 +34,9 @@
36
34
  "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
37
35
  "tagPrefix": "@availity/{projectName}@",
38
36
  "trackDeps": true,
39
- "skipCommitTypes": ["docs"]
37
+ "skipCommitTypes": [
38
+ "docs"
39
+ ]
40
40
  }
41
41
  }
42
42
  }
package/dist/index.d.mts DELETED
@@ -1,27 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { UseAuthorizeProps } from '@availity/authorize';
3
-
4
- type AuthorizeProps = {
5
- /** The content that renders when the user does have the permissions required. */
6
- children?: ReactNode;
7
- /** When true, BlockUi is used when loading the permissions. When a node, that node is rendered instead of BlockUi when loading the permissions. When false, nothing is rendered when loading the permissions. Default: true. */
8
- loader?: boolean | ReactNode;
9
- /** Negate the authorization. If the user does have the permissions specified, they are considered "unauthorized" (shown the unauthorized prop content). If the user does not have the permissions specified, they are considered "authorized" (shown the children prop content) */
10
- negate?: boolean;
11
- /** The content that renders when the user does not have the permissions required. */
12
- unauthorized?: ReactNode;
13
- } & UseAuthorizeProps;
14
- /** Component for showing content based on the user's permissions. Wrap this component around content you only want specific users to see.
15
- *
16
- * The internal `useAuthorize` hook utilizes [react-query](https://tanstack.com/query/v4/docs/framework/react/overview) to handle data fetching.
17
- * This means you must add a [QueryClientProvider](https://tanstack.com/query/v4/docs/framework/react/reference/QueryClientProvider)
18
- * to your app if you do not already have one.
19
- *
20
- * The default setup should cover most use-cases. However, there are 2 query options we recommend looking into
21
- * in order to determine what is correct for your app. These settings are `refetchOnWindowFocus` and
22
- * `staleTime`. The first option sets whether the to refetch the query when the window is focused, and
23
- * the other is the default marker for how long the query is valid.
24
- */
25
- declare const Authorize: ({ loader, negate, children, unauthorized, permissions, parameters, queryOptions }: AuthorizeProps) => React.JSX.Element | null;
26
-
27
- export { Authorize, type AuthorizeProps };
package/dist/index.mjs DELETED
@@ -1,26 +0,0 @@
1
- // src/lib/Authorize.tsx
2
- import { BlockUi } from "@availity/mui-block-ui";
3
- import { useAuthorize } from "@availity/authorize";
4
- import { Fragment, jsx } from "react/jsx-runtime";
5
- var Authorize = ({
6
- loader = true,
7
- negate = false,
8
- children = null,
9
- unauthorized = null,
10
- permissions,
11
- parameters = {},
12
- queryOptions
13
- }) => {
14
- const { authorized, isLoading } = useAuthorize(permissions, parameters, queryOptions);
15
- if (isLoading) {
16
- if (loader) return loader === true ? /* @__PURE__ */ jsx(BlockUi, { blocking: true }) : /* @__PURE__ */ jsx(Fragment, { children: loader });
17
- return null;
18
- }
19
- if ((authorized || negate) && !(authorized && negate)) {
20
- return /* @__PURE__ */ jsx(Fragment, { children });
21
- }
22
- return /* @__PURE__ */ jsx(Fragment, { children: unauthorized });
23
- };
24
- export {
25
- Authorize
26
- };
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- const global = require('../../jest.config.global');
2
-
3
- module.exports = {
4
- ...global,
5
- displayName: 'authorize',
6
- coverageDirectory: '../../coverage/authorize'
7
- };
@@ -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
- }