@availity/change-password 3.0.7 → 4.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/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { default, useChangePasswordContext, ChangePasswordContext } from './src/ChangePassword';
2
- export { default as ChangePasswordForm } from './src/ChangePasswordForm';
1
+ export { default, useChangePasswordContext, ChangePasswordContext } from './src/ChangePassword.jsx';
2
+ export { default as ChangePasswordForm } from './src/ChangePasswordForm.jsx';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/change-password",
3
- "version": "3.0.7",
3
+ "version": "4.0.0",
4
4
  "description": "Easy to use change-password components",
5
5
  "keywords": [
6
6
  "react",
@@ -17,37 +17,50 @@
17
17
  "directory": "packages/change-password"
18
18
  },
19
19
  "license": "MIT",
20
+ "type": "module",
20
21
  "author": "Tyson Warner <tyson.warner@availity.com>",
21
- "main": "index.js",
22
- "types": "index.d.ts",
23
22
  "scripts": {
23
+ "build": "tsup --clean",
24
+ "dev": "tsup --watch",
25
+ "clean": "rm -rf dist",
24
26
  "publish": "yarn npm publish --tolerate-republish --access public",
25
27
  "publish:canary": "yarn npm publish --access public --tag canary"
26
28
  },
27
29
  "dependencies": {
28
- "@availity/block-ui": "^1.1.7",
29
- "@availity/form": "1.10.7",
30
- "@availity/icon": "0.11.11",
31
- "@tanstack/react-query": "^4.36.1",
30
+ "@availity/block-ui": "^2.0.0",
31
+ "@availity/form": "2.0.0",
32
+ "@availity/icon": "1.0.0",
32
33
  "classnames": "^2.5.1",
33
34
  "dayjs": "^1.11.13",
34
- "lodash": "^4.17.21",
35
+ "lodash": "^4.18.1",
35
36
  "prop-types": "^15.8.1"
36
37
  },
37
38
  "devDependencies": {
38
- "@availity/api-axios": "^12.1.0",
39
- "axios": "^1.13.2",
39
+ "@availity/api-axios": "^13.0.2",
40
+ "@tanstack/react-query": "^5.75.5",
41
+ "axios": "^1.17.0",
40
42
  "react": "^18.3.1",
41
43
  "react-dom": "^18.3.1",
42
- "reactstrap": "^8.10.1"
44
+ "reactstrap": "^8.10.1",
45
+ "tsup": "^8.5.1"
43
46
  },
44
47
  "peerDependencies": {
45
- "@availity/api-axios": "^12.0.0",
48
+ "@availity/api-axios": "^12.0.0 || ^13.0.0",
49
+ "@tanstack/react-query": "^5.75.5",
46
50
  "axios": "^1.13.2",
47
51
  "react": "^18.0.0",
48
52
  "reactstrap": "^8.10.1"
49
53
  },
50
54
  "publishConfig": {
51
55
  "access": "public"
56
+ },
57
+ "exports": {
58
+ ".": {
59
+ "source": "./index.js",
60
+ "import": {
61
+ "types": "./index.d.ts",
62
+ "default": "./dist/index.js"
63
+ }
64
+ }
52
65
  }
53
66
  }
package/project.json CHANGED
@@ -4,10 +4,15 @@
4
4
  "projectType": "library",
5
5
  "targets": {
6
6
  "test": {
7
- "executor": "@nx/jest:jest",
8
- "outputs": ["{workspaceRoot}/coverage/change-password"],
7
+ "executor": "nx:run-commands",
9
8
  "options": {
10
- "jestConfig": "packages/change-password/jest.config.js"
9
+ "command": "vitest run --project=change-password",
10
+ "cwd": "."
11
+ },
12
+ "configurations": {
13
+ "ci": {
14
+ "command": "vitest run --project=change-password --coverage"
15
+ }
11
16
  }
12
17
  },
13
18
  "version": {
@@ -34,6 +39,12 @@
34
39
  "hasTypeAwareRules": true,
35
40
  "cacheStrategy": "metadata"
36
41
  }
42
+ },
43
+ "build": {
44
+ "command": "tsup",
45
+ "options": {
46
+ "cwd": "packages/change-password"
47
+ }
37
48
  }
38
49
  }
39
50
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import Icon from '@availity/icon';
3
3
  import { useFormikContext } from 'formik';
4
- import { useChangePasswordContext } from './ChangePassword';
4
+ import { useChangePasswordContext } from './ChangePassword.jsx';
5
5
  import './ChangePasswordFeedback.scss';
6
6
 
7
7
  const ChangePasswordFeedback = () => {
@@ -4,8 +4,8 @@ import BlockUI from '@availity/block-ui';
4
4
  import Icon from '@availity/icon';
5
5
  import { Alert, Button, CardBody, CardFooter, Col, Row } from 'reactstrap';
6
6
  import { Form, Field } from '@availity/form';
7
- import { useChangePasswordContext } from './ChangePassword';
8
- import ChangePasswordFeedback from './ChangePasswordFeedback';
7
+ import { useChangePasswordContext } from './ChangePassword.jsx';
8
+ import ChangePasswordFeedback from './ChangePasswordFeedback.jsx';
9
9
  import './ChangePasswordForm.scss';
10
10
 
11
11
  const ChangePasswordForm = ({
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { StoryObj } from '@storybook/react';
2
+ import { StoryObj } from '@storybook/react-vite';
3
3
  import * as yup from 'yup';
4
4
  import AvApi from '@availity/api-axios';
5
5
  import ChangePassword, { ChangePasswordForm } from '..';
6
6
 
7
7
  export default {
8
- title: 'Bootstrap Components/Change Password',
8
+ title: 'Deprecated/Change Password',
9
9
  parameters: {
10
10
  docs: {
11
11
  description: {
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { render, fireEvent, cleanup } from '@testing-library/react';
3
- import ChangePassword, { ChangePasswordForm } from '..';
3
+ import ChangePassword, { ChangePasswordForm } from '../index.js';
4
4
 
5
- jest.mock('@availity/api-axios');
5
+ vi.mock('@availity/api-axios');
6
6
 
7
7
  afterEach(() => {
8
- jest.clearAllMocks();
8
+ vi.clearAllMocks();
9
9
  cleanup();
10
10
  });
11
11
 
@@ -47,7 +47,7 @@ describe('ChangePasswordFeedback', () => {
47
47
  },
48
48
  ];
49
49
 
50
- const resource = { changePassword: jest.fn() };
50
+ const resource = { changePassword: vi.fn() };
51
51
  const { getByTestId } = render(
52
52
  <ChangePassword resource={resource} conditions={conditions}>
53
53
  <ChangePasswordForm />
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { render, waitFor, fireEvent, cleanup } from '@testing-library/react';
3
- import ChangePassword, { ChangePasswordForm, useChangePasswordContext } from '..';
3
+ import ChangePassword, { ChangePasswordForm, useChangePasswordContext } from '../index.js';
4
4
 
5
- jest.mock('@availity/api-axios');
5
+ vi.mock('@availity/api-axios');
6
6
 
7
7
  afterEach(() => {
8
- jest.clearAllMocks();
8
+ vi.clearAllMocks();
9
9
  cleanup();
10
10
  });
11
11
 
@@ -23,10 +23,10 @@ describe('ChangePasswordForm', () => {
23
23
 
24
24
  it('submits api request with new password', async () => {
25
25
  const resource = {
26
- changePassword: jest.fn().mockResolvedValue('Your password was successfully updated'),
26
+ changePassword: vi.fn().mockResolvedValue('Your password was successfully updated'),
27
27
  };
28
28
 
29
- const onHandleSubmit = jest.fn();
29
+ const onHandleSubmit = vi.fn();
30
30
 
31
31
  const { getByTestId, getByText } = render(
32
32
  <ChangePassword resource={resource}>
@@ -77,7 +77,7 @@ describe('ChangePasswordForm', () => {
77
77
 
78
78
  it('renders custom on success message', async () => {
79
79
  const resource = {
80
- changePassword: jest.fn().mockResolvedValue('Your password was successfully updated'),
80
+ changePassword: vi.fn().mockResolvedValue('Your password was successfully updated'),
81
81
  };
82
82
 
83
83
  const CustomPasswordComponent = () => {
@@ -135,7 +135,7 @@ describe('ChangePasswordForm', () => {
135
135
 
136
136
  it('renders error message', async () => {
137
137
  const resource = {
138
- changePassword: jest.fn().mockRejectedValue('Failed to change password'),
138
+ changePassword: vi.fn().mockRejectedValue('Failed to change password'),
139
139
  };
140
140
 
141
141
  const { getByTestId, getByText } = render(
@@ -183,7 +183,7 @@ describe('ChangePasswordForm', () => {
183
183
 
184
184
  it('renders custom error message', async () => {
185
185
  const resource = {
186
- changePassword: jest.fn().mockRejectedValue('Failed to change password'),
186
+ changePassword: vi.fn().mockRejectedValue('Failed to change password'),
187
187
  };
188
188
 
189
189
  const CustomPasswordComponent = () => {
@@ -241,7 +241,7 @@ describe('ChangePasswordForm', () => {
241
241
 
242
242
  it('toggles whether passwords are visible', async () => {
243
243
  const resource = {
244
- changePassword: jest.fn(),
244
+ changePassword: vi.fn(),
245
245
  };
246
246
 
247
247
  const { getByTestId } = render(
package/tsup.config.js ADDED
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['index.js'],
5
+ format: ['esm'],
6
+ dts: true,
7
+ loader: { '.scss': 'empty' },
8
+ });
@@ -38,7 +38,7 @@ export interface ChangePasswordContext {
38
38
  setConfirmNewPasswordVisible: () => boolean;
39
39
  }
40
40
 
41
- declare function useChangePasswordContext(): ChangePasswordContext;
41
+ export function useChangePasswordContext(): ChangePasswordContext;
42
42
 
43
43
  declare const ChangePassword: React.FC<ChangePasswordProps>;
44
44
 
@@ -0,0 +1,17 @@
1
+ import { defineProject } from 'vitest/config';
2
+
3
+ export default defineProject({
4
+ test: {
5
+ name: 'change-password',
6
+ globals: true,
7
+ environment: 'jsdom',
8
+ setupFiles: ['../../vitest.setup.ts'],
9
+ include: ['src/**/*.test.{ts,tsx,js,jsx}', 'tests/**/*.test.{ts,tsx,js,jsx}'],
10
+ env: { TZ: 'UTC' },
11
+ server: {
12
+ deps: {
13
+ inline: [/lodash/, /@availity\/yup/],
14
+ },
15
+ },
16
+ },
17
+ });
package/jest.config.js DELETED
@@ -1,8 +0,0 @@
1
- const global = require('../../jest/global-config');
2
-
3
- module.exports = {
4
- ...global,
5
- displayName: 'change-password',
6
- coverageDirectory: '../../coverage/change-password',
7
- };
8
-
@@ -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": ["**/*.test.js", "**/*.test.ts", "**/*.d.ts"]
10
- }
File without changes