@availity/change-password 3.0.6 → 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/CHANGELOG.md +21 -0
- package/README.md +6 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +2529 -0
- package/index.js +2 -2
- package/package.json +25 -12
- package/project.json +14 -3
- package/src/{ChangePasswordFeedback.js → ChangePasswordFeedback.jsx} +1 -1
- package/src/{ChangePasswordForm.js → ChangePasswordForm.jsx} +2 -2
- package/stories/change-password.stories.tsx +2 -2
- package/tests/{ChangePasswordFeedback.test.js → ChangePasswordFeedback.test.jsx} +4 -4
- package/tests/{ChangePasswordForm.test.js → ChangePasswordForm.test.jsx} +9 -9
- package/tsup.config.js +8 -0
- package/types/ChangePassword.d.ts +1 -1
- package/vitest.config.ts +17 -0
- package/jest.config.js +0 -8
- package/tsconfig.spec.json +0 -10
- /package/src/{ChangePassword.js → ChangePassword.jsx} +0 -0
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
|
+
"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": "^
|
|
29
|
-
"@availity/form": "
|
|
30
|
-
"@availity/icon": "0.
|
|
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.
|
|
35
|
+
"lodash": "^4.18.1",
|
|
35
36
|
"prop-types": "^15.8.1"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@availity/api-axios": "^
|
|
39
|
-
"
|
|
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": "
|
|
8
|
-
"outputs": ["{workspaceRoot}/coverage/change-password"],
|
|
7
|
+
"executor": "nx:run-commands",
|
|
9
8
|
"options": {
|
|
10
|
-
"
|
|
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: '
|
|
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
|
-
|
|
5
|
+
vi.mock('@availity/api-axios');
|
|
6
6
|
|
|
7
7
|
afterEach(() => {
|
|
8
|
-
|
|
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:
|
|
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
|
-
|
|
5
|
+
vi.mock('@availity/api-axios');
|
|
6
6
|
|
|
7
7
|
afterEach(() => {
|
|
8
|
-
|
|
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:
|
|
26
|
+
changePassword: vi.fn().mockResolvedValue('Your password was successfully updated'),
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const onHandleSubmit =
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
244
|
+
changePassword: vi.fn(),
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
const { getByTestId } = render(
|
package/tsup.config.js
ADDED
|
@@ -38,7 +38,7 @@ export interface ChangePasswordContext {
|
|
|
38
38
|
setConfirmNewPasswordVisible: () => boolean;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
export function useChangePasswordContext(): ChangePasswordContext;
|
|
42
42
|
|
|
43
43
|
declare const ChangePassword: React.FC<ChangePasswordProps>;
|
|
44
44
|
|
package/vitest.config.ts
ADDED
|
@@ -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
package/tsconfig.spec.json
DELETED
|
File without changes
|