@aws-amplify/ui-react 6.9.5 → 6.10.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/dist/esm/components/Authenticator/Authenticator.mjs +4 -0
- package/dist/esm/components/Authenticator/Router/Router.mjs +6 -0
- package/dist/esm/components/Authenticator/SelectMfaType/SelectMfaType.mjs +44 -0
- package/dist/esm/components/Authenticator/SetupEmail/SetupEmail.mjs +38 -0
- package/dist/esm/components/Authenticator/hooks/useCustomComponents/defaultComponents.mjs +10 -0
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +70 -1
- package/dist/types/components/Authenticator/Authenticator.d.ts +10 -0
- package/dist/types/components/Authenticator/SelectMfaType/SelectMfaType.d.ts +6 -0
- package/dist/types/components/Authenticator/SelectMfaType/index.d.ts +1 -0
- package/dist/types/components/Authenticator/SetupEmail/SetupEmail.d.ts +6 -0
- package/dist/types/components/Authenticator/SetupEmail/index.d.ts +1 -0
- package/dist/types/components/Authenticator/hooks/useCustomComponents/defaultComponents.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -13,6 +13,8 @@ import { ForceNewPassword } from './ForceNewPassword/ForceNewPassword.mjs';
|
|
|
13
13
|
import './ForgotPassword/ConfirmResetPassword.mjs';
|
|
14
14
|
import { ForgotPassword } from './ForgotPassword/ForgotPassword.mjs';
|
|
15
15
|
import { defaultComponents } from './hooks/useCustomComponents/defaultComponents.mjs';
|
|
16
|
+
import { SelectMfaType } from './SelectMfaType/SelectMfaType.mjs';
|
|
17
|
+
import { SetupEmail } from './SetupEmail/SetupEmail.mjs';
|
|
16
18
|
|
|
17
19
|
// `AuthenticatorInternal` exists to give access to the context returned via `useAuthenticator`,
|
|
18
20
|
// which allows the `Authenticator` to just return `children` if a user is authenticated.
|
|
@@ -70,5 +72,7 @@ Authenticator.SetupTotp = SetupTotp;
|
|
|
70
72
|
Authenticator.SignIn = SignIn;
|
|
71
73
|
Authenticator.SignUp = SignUp;
|
|
72
74
|
Authenticator.ForceNewPassword = ForceNewPassword;
|
|
75
|
+
Authenticator.SelectMfaType = SelectMfaType;
|
|
76
|
+
Authenticator.SetupEmail = SetupEmail;
|
|
73
77
|
|
|
74
78
|
export { Authenticator, AuthenticatorInternal };
|
|
@@ -15,6 +15,8 @@ import { ConfirmSignIn } from '../ConfirmSignIn/ConfirmSignIn.mjs';
|
|
|
15
15
|
import { ConfirmResetPassword } from '../ForgotPassword/ConfirmResetPassword.mjs';
|
|
16
16
|
import { ForgotPassword } from '../ForgotPassword/ForgotPassword.mjs';
|
|
17
17
|
import { isSignInOrSignUpRoute } from '../utils.mjs';
|
|
18
|
+
import { SelectMfaType } from '../SelectMfaType/SelectMfaType.mjs';
|
|
19
|
+
import { SetupEmail } from '../SetupEmail/SetupEmail.mjs';
|
|
18
20
|
|
|
19
21
|
function RenderNothing() {
|
|
20
22
|
// @ts-ignore
|
|
@@ -31,6 +33,10 @@ const getRouteComponent = (route) => {
|
|
|
31
33
|
return ConfirmSignUp;
|
|
32
34
|
case 'confirmSignIn':
|
|
33
35
|
return ConfirmSignIn;
|
|
36
|
+
case 'selectMfaType':
|
|
37
|
+
return SelectMfaType;
|
|
38
|
+
case 'setupEmail':
|
|
39
|
+
return SetupEmail;
|
|
34
40
|
case 'setupTotp':
|
|
35
41
|
return SetupTotp;
|
|
36
42
|
case 'signIn':
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { authenticatorTextUtil } from '@aws-amplify/ui';
|
|
3
|
+
import { useAuthenticator } from '@aws-amplify/ui-react-core';
|
|
4
|
+
import { Flex } from '../../../primitives/Flex/Flex.mjs';
|
|
5
|
+
import { Heading } from '../../../primitives/Heading/Heading.mjs';
|
|
6
|
+
import { RadioGroupField } from '../../../primitives/RadioGroupField/RadioGroupField.mjs';
|
|
7
|
+
import { Radio } from '../../../primitives/Radio/Radio.mjs';
|
|
8
|
+
import { useCustomComponents } from '../hooks/useCustomComponents/useCustomComponents.mjs';
|
|
9
|
+
import { useFormHandlers } from '../hooks/useFormHandlers/useFormHandlers.mjs';
|
|
10
|
+
import { ConfirmSignInFooter } from '../shared/ConfirmSignInFooter.mjs';
|
|
11
|
+
import { RemoteErrorMessage } from '../shared/RemoteErrorMessage.mjs';
|
|
12
|
+
import { RouteContainer } from '../RouteContainer/RouteContainer.mjs';
|
|
13
|
+
|
|
14
|
+
const { getMfaTypeLabelByValue, getSelectMfaTypeByChallengeName, getSelectMfaTypeText, } = authenticatorTextUtil;
|
|
15
|
+
const SelectMfaType = ({ className, variation, }) => {
|
|
16
|
+
const { isPending, allowedMfaTypes = [] } = useAuthenticator((context) => {
|
|
17
|
+
return [context.isPending, context.allowedMfaTypes];
|
|
18
|
+
});
|
|
19
|
+
const { handleChange, handleSubmit } = useFormHandlers();
|
|
20
|
+
const { components: {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
SelectMfaType: { Header = SelectMfaType.Header, Footer = SelectMfaType.Footer, }, }, } = useCustomComponents();
|
|
23
|
+
return (React.createElement(RouteContainer, { className: className, variation: variation },
|
|
24
|
+
React.createElement("form", { "data-amplify-form": "", "data-amplify-authenticator-select-mfa-type": "", method: "post", onChange: handleChange, onSubmit: handleSubmit },
|
|
25
|
+
React.createElement(Flex, { as: "fieldset", direction: "column", isDisabled: isPending },
|
|
26
|
+
React.createElement(Header, null),
|
|
27
|
+
React.createElement(Flex, { direction: "column" },
|
|
28
|
+
React.createElement(RadioGroupField, { name: "mfa_type", legend: getSelectMfaTypeText(), legendHidden: true, isDisabled: isPending, isRequired: true }, allowedMfaTypes.map((value, index) => (React.createElement(Radio, { name: "mfa_type", key: value, value: value, defaultChecked: index === 0 }, getMfaTypeLabelByValue(value))))),
|
|
29
|
+
React.createElement(RemoteErrorMessage, null)),
|
|
30
|
+
React.createElement(ConfirmSignInFooter, null),
|
|
31
|
+
React.createElement(Footer, null)))));
|
|
32
|
+
};
|
|
33
|
+
SelectMfaType.Header = function Header() {
|
|
34
|
+
const { challengeName } = useAuthenticator((context) => {
|
|
35
|
+
return [context.challengeName];
|
|
36
|
+
});
|
|
37
|
+
return (React.createElement(Heading, { level: 3 }, getSelectMfaTypeByChallengeName(challengeName)));
|
|
38
|
+
};
|
|
39
|
+
SelectMfaType.Footer = function Footer() {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { SelectMfaType };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { authenticatorTextUtil } from '@aws-amplify/ui';
|
|
3
|
+
import { useAuthenticator } from '@aws-amplify/ui-react-core';
|
|
4
|
+
import { Flex } from '../../../primitives/Flex/Flex.mjs';
|
|
5
|
+
import { Heading } from '../../../primitives/Heading/Heading.mjs';
|
|
6
|
+
import { useCustomComponents } from '../hooks/useCustomComponents/useCustomComponents.mjs';
|
|
7
|
+
import { useFormHandlers } from '../hooks/useFormHandlers/useFormHandlers.mjs';
|
|
8
|
+
import { ConfirmSignInFooter } from '../shared/ConfirmSignInFooter.mjs';
|
|
9
|
+
import { RemoteErrorMessage } from '../shared/RemoteErrorMessage.mjs';
|
|
10
|
+
import { FormFields } from '../shared/FormFields.mjs';
|
|
11
|
+
import { RouteContainer } from '../RouteContainer/RouteContainer.mjs';
|
|
12
|
+
|
|
13
|
+
const { getSetupEmailText } = authenticatorTextUtil;
|
|
14
|
+
const SetupEmail = ({ className, variation, }) => {
|
|
15
|
+
const { isPending } = useAuthenticator((context) => [context.isPending]);
|
|
16
|
+
const { handleChange, handleSubmit } = useFormHandlers();
|
|
17
|
+
const { components: {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
SetupEmail: { Header = SetupEmail.Header, Footer = SetupEmail.Footer }, }, } = useCustomComponents();
|
|
20
|
+
return (React.createElement(RouteContainer, { className: className, variation: variation },
|
|
21
|
+
React.createElement("form", { "data-amplify-form": "", "data-amplify-authenticator-setup-email": "", method: "post", onChange: handleChange, onSubmit: handleSubmit },
|
|
22
|
+
React.createElement(Flex, { as: "fieldset", direction: "column", isDisabled: isPending },
|
|
23
|
+
React.createElement(Header, null),
|
|
24
|
+
React.createElement(Flex, { direction: "column" },
|
|
25
|
+
React.createElement(FormFields, null),
|
|
26
|
+
React.createElement(RemoteErrorMessage, null)),
|
|
27
|
+
React.createElement(ConfirmSignInFooter, null),
|
|
28
|
+
React.createElement(Footer, null)))));
|
|
29
|
+
};
|
|
30
|
+
SetupEmail.Header = function Header() {
|
|
31
|
+
return React.createElement(Heading, { level: 3 }, getSetupEmailText());
|
|
32
|
+
};
|
|
33
|
+
SetupEmail.Footer = function Footer() {
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { SetupEmail };
|
|
@@ -8,6 +8,8 @@ import { ConfirmVerifyUser } from '../../VerifyUser/ConfirmVerifyUser.mjs';
|
|
|
8
8
|
import { VerifyUser } from '../../VerifyUser/VerifyUser.mjs';
|
|
9
9
|
import { ConfirmResetPassword } from '../../ForgotPassword/ConfirmResetPassword.mjs';
|
|
10
10
|
import { ForgotPassword } from '../../ForgotPassword/ForgotPassword.mjs';
|
|
11
|
+
import { SelectMfaType } from '../../SelectMfaType/SelectMfaType.mjs';
|
|
12
|
+
import { SetupEmail } from '../../SetupEmail/SetupEmail.mjs';
|
|
11
13
|
|
|
12
14
|
const defaultComponents = {
|
|
13
15
|
// @ts-ignore
|
|
@@ -25,6 +27,14 @@ const defaultComponents = {
|
|
|
25
27
|
Header: ConfirmSignUp.Header,
|
|
26
28
|
Footer: ConfirmSignUp.Footer,
|
|
27
29
|
},
|
|
30
|
+
SelectMfaType: {
|
|
31
|
+
Header: SelectMfaType.Header,
|
|
32
|
+
Footer: SelectMfaType.Footer,
|
|
33
|
+
},
|
|
34
|
+
SetupEmail: {
|
|
35
|
+
Header: SetupEmail.Header,
|
|
36
|
+
Footer: SetupEmail.Footer,
|
|
37
|
+
},
|
|
28
38
|
SetupTotp: {
|
|
29
39
|
Header: SetupTotp.Header,
|
|
30
40
|
Footer: SetupTotp.Footer,
|
package/dist/esm/version.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -2469,7 +2469,7 @@ const defaultDeleteUserDisplayText = {
|
|
|
2469
2469
|
warningText: 'Deleting your account is not reversible. You will lose access to your account and all data associated with it.',
|
|
2470
2470
|
};
|
|
2471
2471
|
|
|
2472
|
-
const VERSION = '6.
|
|
2472
|
+
const VERSION = '6.10.0';
|
|
2473
2473
|
|
|
2474
2474
|
const logger$2 = ui.getLogger('AccountSettings');
|
|
2475
2475
|
const getIsDisabled = (formValues, validationError) => {
|
|
@@ -3281,6 +3281,61 @@ ForgotPassword.Footer = function Footer() {
|
|
|
3281
3281
|
|
|
3282
3282
|
const isSignInOrSignUpRoute = (route) => route === 'signIn' || route === 'signUp';
|
|
3283
3283
|
|
|
3284
|
+
const { getMfaTypeLabelByValue, getSelectMfaTypeByChallengeName, getSelectMfaTypeText, } = ui.authenticatorTextUtil;
|
|
3285
|
+
const SelectMfaType = ({ className, variation, }) => {
|
|
3286
|
+
const { isPending, allowedMfaTypes = [] } = uiReactCore.useAuthenticator((context) => {
|
|
3287
|
+
return [context.isPending, context.allowedMfaTypes];
|
|
3288
|
+
});
|
|
3289
|
+
const { handleChange, handleSubmit } = useFormHandlers();
|
|
3290
|
+
const { components: {
|
|
3291
|
+
// @ts-ignore
|
|
3292
|
+
SelectMfaType: { Header = SelectMfaType.Header, Footer = SelectMfaType.Footer, }, }, } = useCustomComponents();
|
|
3293
|
+
return (React__namespace.createElement(RouteContainer, { className: className, variation: variation },
|
|
3294
|
+
React__namespace.createElement("form", { "data-amplify-form": "", "data-amplify-authenticator-select-mfa-type": "", method: "post", onChange: handleChange, onSubmit: handleSubmit },
|
|
3295
|
+
React__namespace.createElement(Field.Flex, { as: "fieldset", direction: "column", isDisabled: isPending },
|
|
3296
|
+
React__namespace.createElement(Header, null),
|
|
3297
|
+
React__namespace.createElement(Field.Flex, { direction: "column" },
|
|
3298
|
+
React__namespace.createElement(RadioGroupField, { name: "mfa_type", legend: getSelectMfaTypeText(), legendHidden: true, isDisabled: isPending, isRequired: true }, allowedMfaTypes.map((value, index) => (React__namespace.createElement(Radio, { name: "mfa_type", key: value, value: value, defaultChecked: index === 0 }, getMfaTypeLabelByValue(value))))),
|
|
3299
|
+
React__namespace.createElement(RemoteErrorMessage, null)),
|
|
3300
|
+
React__namespace.createElement(ConfirmSignInFooter, null),
|
|
3301
|
+
React__namespace.createElement(Footer, null)))));
|
|
3302
|
+
};
|
|
3303
|
+
SelectMfaType.Header = function Header() {
|
|
3304
|
+
const { challengeName } = uiReactCore.useAuthenticator((context) => {
|
|
3305
|
+
return [context.challengeName];
|
|
3306
|
+
});
|
|
3307
|
+
return (React__namespace.createElement(Heading, { level: 3 }, getSelectMfaTypeByChallengeName(challengeName)));
|
|
3308
|
+
};
|
|
3309
|
+
SelectMfaType.Footer = function Footer() {
|
|
3310
|
+
// @ts-ignore
|
|
3311
|
+
return null;
|
|
3312
|
+
};
|
|
3313
|
+
|
|
3314
|
+
const { getSetupEmailText } = ui.authenticatorTextUtil;
|
|
3315
|
+
const SetupEmail = ({ className, variation, }) => {
|
|
3316
|
+
const { isPending } = uiReactCore.useAuthenticator((context) => [context.isPending]);
|
|
3317
|
+
const { handleChange, handleSubmit } = useFormHandlers();
|
|
3318
|
+
const { components: {
|
|
3319
|
+
// @ts-ignore
|
|
3320
|
+
SetupEmail: { Header = SetupEmail.Header, Footer = SetupEmail.Footer }, }, } = useCustomComponents();
|
|
3321
|
+
return (React__namespace.createElement(RouteContainer, { className: className, variation: variation },
|
|
3322
|
+
React__namespace.createElement("form", { "data-amplify-form": "", "data-amplify-authenticator-setup-email": "", method: "post", onChange: handleChange, onSubmit: handleSubmit },
|
|
3323
|
+
React__namespace.createElement(Field.Flex, { as: "fieldset", direction: "column", isDisabled: isPending },
|
|
3324
|
+
React__namespace.createElement(Header, null),
|
|
3325
|
+
React__namespace.createElement(Field.Flex, { direction: "column" },
|
|
3326
|
+
React__namespace.createElement(FormFields, null),
|
|
3327
|
+
React__namespace.createElement(RemoteErrorMessage, null)),
|
|
3328
|
+
React__namespace.createElement(ConfirmSignInFooter, null),
|
|
3329
|
+
React__namespace.createElement(Footer, null)))));
|
|
3330
|
+
};
|
|
3331
|
+
SetupEmail.Header = function Header() {
|
|
3332
|
+
return React__namespace.createElement(Heading, { level: 3 }, getSetupEmailText());
|
|
3333
|
+
};
|
|
3334
|
+
SetupEmail.Footer = function Footer() {
|
|
3335
|
+
// @ts-ignore
|
|
3336
|
+
return null;
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3284
3339
|
function RenderNothing() {
|
|
3285
3340
|
// @ts-ignore
|
|
3286
3341
|
return null;
|
|
@@ -3296,6 +3351,10 @@ const getRouteComponent = (route) => {
|
|
|
3296
3351
|
return ConfirmSignUp;
|
|
3297
3352
|
case 'confirmSignIn':
|
|
3298
3353
|
return ConfirmSignIn;
|
|
3354
|
+
case 'selectMfaType':
|
|
3355
|
+
return SelectMfaType;
|
|
3356
|
+
case 'setupEmail':
|
|
3357
|
+
return SetupEmail;
|
|
3299
3358
|
case 'setupTotp':
|
|
3300
3359
|
return SetupTotp;
|
|
3301
3360
|
case 'signIn':
|
|
@@ -3341,6 +3400,14 @@ const defaultComponents = {
|
|
|
3341
3400
|
Header: ConfirmSignUp.Header,
|
|
3342
3401
|
Footer: ConfirmSignUp.Footer,
|
|
3343
3402
|
},
|
|
3403
|
+
SelectMfaType: {
|
|
3404
|
+
Header: SelectMfaType.Header,
|
|
3405
|
+
Footer: SelectMfaType.Footer,
|
|
3406
|
+
},
|
|
3407
|
+
SetupEmail: {
|
|
3408
|
+
Header: SetupEmail.Header,
|
|
3409
|
+
Footer: SetupEmail.Footer,
|
|
3410
|
+
},
|
|
3344
3411
|
SetupTotp: {
|
|
3345
3412
|
Header: SetupTotp.Header,
|
|
3346
3413
|
Footer: SetupTotp.Footer,
|
|
@@ -3431,6 +3498,8 @@ Authenticator.SetupTotp = SetupTotp;
|
|
|
3431
3498
|
Authenticator.SignIn = SignIn;
|
|
3432
3499
|
Authenticator.SignUp = SignUp;
|
|
3433
3500
|
Authenticator.ForceNewPassword = ForceNewPassword;
|
|
3501
|
+
Authenticator.SelectMfaType = SelectMfaType;
|
|
3502
|
+
Authenticator.SetupEmail = SetupEmail;
|
|
3434
3503
|
|
|
3435
3504
|
/**
|
|
3436
3505
|
* [📖 Docs](https://ui.docs.amplify.aws/react/connected-components/authenticator)
|
|
@@ -53,5 +53,15 @@ export declare namespace Authenticator {
|
|
|
53
53
|
Header(): React.JSX.Element | null;
|
|
54
54
|
Footer(): React.JSX.Element | null;
|
|
55
55
|
};
|
|
56
|
+
var SelectMfaType: {
|
|
57
|
+
({ className, variation, }: import("./RouteContainer").RouteProps): JSX.Element;
|
|
58
|
+
Header(): JSX.Element;
|
|
59
|
+
Footer(): JSX.Element;
|
|
60
|
+
};
|
|
61
|
+
var SetupEmail: {
|
|
62
|
+
({ className, variation, }: import("./RouteContainer").RouteProps): JSX.Element;
|
|
63
|
+
Header(): JSX.Element;
|
|
64
|
+
Footer(): JSX.Element;
|
|
65
|
+
};
|
|
56
66
|
}
|
|
57
67
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SelectMfaType } from './SelectMfaType';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SetupEmail';
|
package/dist/types/components/Authenticator/hooks/useCustomComponents/defaultComponents.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface DefaultComponents extends Omit<Components, 'FormFields'> {
|
|
|
10
10
|
ConfirmVerifyUser?: Omit<Components, 'FormFields'>;
|
|
11
11
|
ForceNewPassword?: Components;
|
|
12
12
|
ForgotPassword?: Omit<Components, 'FormFields'>;
|
|
13
|
+
SelectMfaType?: Omit<Components, 'FormFields'>;
|
|
14
|
+
SetupEmail?: Omit<Components, 'FormFields'>;
|
|
13
15
|
SetupTotp?: Omit<Components, 'FormFields'>;
|
|
14
16
|
SignIn?: Omit<Components, 'FormFields'>;
|
|
15
17
|
SignUp?: Components;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "6.
|
|
1
|
+
export declare const VERSION = "6.10.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"typecheck": "tsc --noEmit"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@aws-amplify/ui": "6.
|
|
59
|
-
"@aws-amplify/ui-react-core": "3.
|
|
58
|
+
"@aws-amplify/ui": "6.10.0",
|
|
59
|
+
"@aws-amplify/ui-react-core": "3.4.0",
|
|
60
60
|
"@radix-ui/react-direction": "^1.1.0",
|
|
61
61
|
"@radix-ui/react-dropdown-menu": "^2.1.4",
|
|
62
62
|
"@radix-ui/react-slider": "^1.2.2",
|
|
@@ -98,4 +98,4 @@
|
|
|
98
98
|
"limit": "25 kB"
|
|
99
99
|
}
|
|
100
100
|
]
|
|
101
|
-
}
|
|
101
|
+
}
|