@aws-amplify/ui-react-core 2.1.19 → 2.1.20
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/types/Authenticator/context/AuthenticatorContext.d.ts +1 -1
- package/dist/types/Authenticator/hooks/types.d.ts +26 -26
- package/dist/types/Authenticator/hooks/useAuthenticator/types.d.ts +6 -6
- package/dist/types/Authenticator/hooks/useAuthenticatorRoute/types.d.ts +18 -18
- package/dist/types/InAppMessaging/hooks/useMessage/types.d.ts +2 -2
- package/dist/types/InAppMessaging/types.d.ts +15 -15
- package/dist/types/InAppMessaging/utils/handleMessageAction.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AuthChallengeName, AuthenticatorServiceFacade, LegacyFormFieldOptions } from '@aws-amplify/ui';
|
|
3
3
|
import { UseAuthenticator } from './useAuthenticator';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
4
|
+
export type AuthenticatorRouteComponentKey = 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'forceNewPassword' | 'resetPassword' | 'setupTOTP' | 'signIn' | 'signUp' | 'verifyUser';
|
|
5
|
+
export type AuthenticatorLegacyField = LegacyFormFieldOptions;
|
|
6
|
+
export type AuthenticatorLegacyFields = AuthenticatorLegacyField[];
|
|
7
7
|
/**
|
|
8
8
|
* These are the "facades" that we provide, which contains contexts respective
|
|
9
9
|
* to current authenticator state.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
11
|
+
export type AuthenticatorMachineContext = AuthenticatorServiceFacade;
|
|
12
|
+
export type AuthenticatorMachineContextKey = keyof AuthenticatorMachineContext;
|
|
13
|
+
export type AuthenticatorRouteComponentName = Capitalize<AuthenticatorRouteComponentKey>;
|
|
14
14
|
interface HeaderProps {
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
}
|
|
17
17
|
interface FooterProps {
|
|
18
18
|
children?: React.ReactNode;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
type FormFieldsProps = {
|
|
21
21
|
isPending: UseAuthenticator['isPending'];
|
|
22
22
|
validationErrors?: UseAuthenticator['validationErrors'];
|
|
23
23
|
};
|
|
24
|
-
export
|
|
25
|
-
export
|
|
24
|
+
export type FooterComponent<Props = {}> = React.ComponentType<FooterProps & Props>;
|
|
25
|
+
export type FormFieldsComponent<FieldType, Props = {}> = React.ComponentType<FormFieldsProps & {
|
|
26
26
|
fields: FieldType[];
|
|
27
27
|
} & Props>;
|
|
28
|
-
export
|
|
28
|
+
export type HeaderComponent<Props = {}> = React.ComponentType<HeaderProps & Props>;
|
|
29
29
|
export interface ComponentSlots<FieldType = {}> {
|
|
30
30
|
Footer: FooterComponent;
|
|
31
31
|
Header: HeaderComponent;
|
|
@@ -34,7 +34,7 @@ export interface ComponentSlots<FieldType = {}> {
|
|
|
34
34
|
/**
|
|
35
35
|
* Common component prop types used for both RWA and RNA implementations
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
37
|
+
export type CommonRouteProps = {
|
|
38
38
|
error?: UseAuthenticator['error'];
|
|
39
39
|
isPending: UseAuthenticator['isPending'];
|
|
40
40
|
handleBlur: UseAuthenticator['updateBlur'];
|
|
@@ -44,45 +44,45 @@ export declare type CommonRouteProps = {
|
|
|
44
44
|
/**
|
|
45
45
|
* Base Route component props
|
|
46
46
|
*/
|
|
47
|
-
export
|
|
47
|
+
export type ConfirmResetPasswordBaseProps<FieldType = {}> = {
|
|
48
48
|
resendCode: UseAuthenticator['resendCode'];
|
|
49
49
|
validationErrors?: UseAuthenticator['validationErrors'];
|
|
50
50
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
51
|
-
export
|
|
51
|
+
export type ConfirmSignInBaseProps<FieldType = {}> = {
|
|
52
52
|
challengeName: AuthChallengeName;
|
|
53
53
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
54
54
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
55
|
-
export
|
|
55
|
+
export type ConfirmSignUpBaseProps<FieldType = {}> = {
|
|
56
56
|
codeDeliveryDetails: UseAuthenticator['codeDeliveryDetails'];
|
|
57
57
|
resendCode: UseAuthenticator['resendCode'];
|
|
58
58
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
59
|
-
export
|
|
59
|
+
export type ConfirmVerifyUserProps<FieldType = {}> = {
|
|
60
60
|
skipVerification: UseAuthenticator['skipVerification'];
|
|
61
61
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
62
|
-
export
|
|
62
|
+
export type ForceResetPasswordBaseProps<FieldType = {}> = {
|
|
63
63
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
64
64
|
validationErrors?: UseAuthenticator['validationErrors'];
|
|
65
65
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
66
|
-
export
|
|
66
|
+
export type ResetPasswordBaseProps<FieldType = {}> = {
|
|
67
67
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
68
68
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
69
|
-
export
|
|
69
|
+
export type SetupTOTPBaseProps<FieldType = {}> = {
|
|
70
70
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
71
71
|
totpSecretCode: UseAuthenticator['totpSecretCode'];
|
|
72
72
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
73
|
-
export
|
|
73
|
+
export type SignInBaseProps<FieldType = {}> = {
|
|
74
74
|
hideSignUp?: boolean;
|
|
75
75
|
toFederatedSignIn: UseAuthenticator['toFederatedSignIn'];
|
|
76
76
|
toResetPassword: UseAuthenticator['toResetPassword'];
|
|
77
77
|
toSignUp: UseAuthenticator['toSignUp'];
|
|
78
78
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
79
|
-
export
|
|
79
|
+
export type SignUpBaseProps<FieldType = {}> = {
|
|
80
80
|
hideSignIn?: boolean;
|
|
81
81
|
toFederatedSignIn: UseAuthenticator['toFederatedSignIn'];
|
|
82
82
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
83
83
|
validationErrors?: UseAuthenticator['validationErrors'];
|
|
84
84
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
85
|
-
export
|
|
85
|
+
export type VerifyUserProps<FieldType = {}> = {
|
|
86
86
|
skipVerification: UseAuthenticator['skipVerification'];
|
|
87
87
|
} & CommonRouteProps & ComponentSlots<FieldType>;
|
|
88
88
|
export interface DefaultProps<FieldType = {}> {
|
|
@@ -100,24 +100,24 @@ export interface DefaultProps<FieldType = {}> {
|
|
|
100
100
|
/**
|
|
101
101
|
* common types extended for default component types/implementations and override component types
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
type BaseComponent<ComponentRouteProps = {}, FieldType = {}, Props = {}> = React.ComponentType<ComponentSlots<FieldType> & ComponentRouteProps & {
|
|
104
104
|
fields: FieldType[];
|
|
105
105
|
} & Props>;
|
|
106
106
|
/**
|
|
107
107
|
* Authenticator Route Component Default types
|
|
108
108
|
*/
|
|
109
|
-
export
|
|
109
|
+
export type Defaults<FieldType = {}, PlatformProps = {}> = {
|
|
110
110
|
[Key in AuthenticatorRouteComponentName]: BaseComponent<DefaultProps<FieldType>[Key], FieldType, PlatformProps> & ComponentSlots<FieldType>;
|
|
111
111
|
};
|
|
112
|
-
export
|
|
112
|
+
export type Overrides<FieldType = {}, PlatformProps = {}> = {
|
|
113
113
|
[Key in AuthenticatorRouteComponentName]?: BaseComponent<DefaultProps<FieldType>[Key], FieldType, PlatformProps>;
|
|
114
114
|
};
|
|
115
115
|
/**
|
|
116
116
|
* Default Route Component union type
|
|
117
117
|
*/
|
|
118
|
-
export
|
|
118
|
+
export type DefaultComponentType<FieldType = {}> = Defaults<FieldType>[keyof Defaults<FieldType>];
|
|
119
119
|
/**
|
|
120
120
|
* Default Route Component union type
|
|
121
121
|
*/
|
|
122
|
-
export
|
|
122
|
+
export type DefaultPropsType<FieldType = {}> = DefaultProps<FieldType>[keyof DefaultProps<FieldType>];
|
|
123
123
|
export {};
|
|
@@ -3,17 +3,17 @@ import { AuthenticatorServiceFacade, LegacyFormFieldOptions } from '@aws-amplify
|
|
|
3
3
|
* These are the "facades" that we provide, which contains contexts respective
|
|
4
4
|
* to current authenticator state.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
6
|
+
type AuthenticatorMachineContext = AuthenticatorServiceFacade;
|
|
7
|
+
type AuthenticatorMachineContextKey = keyof AuthenticatorMachineContext;
|
|
8
|
+
export type AuthenticatorRouteComponentKey = 'signIn' | 'signUp' | 'forceNewPassword' | 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'resetPassword' | 'setupTOTP' | 'verifyUser';
|
|
9
|
+
export type AuthenticatorLegacyFields = LegacyFormFieldOptions[];
|
|
10
10
|
/**
|
|
11
11
|
* Inspired from https://xstate.js.org/docs/packages/xstate-react/#useselector-actor-selector-compare-getsnapshot.
|
|
12
12
|
*
|
|
13
13
|
* Selector accepts current facade values and returns an array of
|
|
14
14
|
* desired value(s) that should trigger re-render.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type UseAuthenticatorSelector = (context: AuthenticatorMachineContext) => AuthenticatorMachineContext[AuthenticatorMachineContextKey][];
|
|
17
17
|
export interface UseAuthenticator extends AuthenticatorServiceFacade {
|
|
18
18
|
/** @deprecated For internal use only */
|
|
19
19
|
fields: AuthenticatorLegacyFields;
|
|
@@ -25,5 +25,5 @@ export interface UseAuthenticator extends AuthenticatorServiceFacade {
|
|
|
25
25
|
totpUsername?: string;
|
|
26
26
|
} | null;
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export type Comparator = (currentMachineContext: AuthenticatorMachineContext, nextMachineContext: AuthenticatorMachineContext) => boolean;
|
|
29
29
|
export {};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { AuthenticatorMachineContext, AuthenticatorMachineContextKey, AuthenticatorRouteComponentName, CommonRouteProps, ConfirmResetPasswordBaseProps, ConfirmSignInBaseProps, ConfirmSignUpBaseProps, Defaults, DefaultProps, ForceResetPasswordBaseProps, ResetPasswordBaseProps, SetupTOTPBaseProps, SignInBaseProps, SignUpBaseProps, VerifyUserProps, ConfirmVerifyUserProps } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type UseAuthenticatorRouteParams<FieldType> = {
|
|
3
3
|
components: Defaults<FieldType>;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type UseAuthenticatorRoute<ComponentName extends AuthenticatorRouteComponentName, FieldType = {}> = {
|
|
6
6
|
Component: Defaults<FieldType>[ComponentName];
|
|
7
7
|
props: DefaultProps<FieldType>[ComponentName];
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type UseAuthenticatorRouteDefault<FieldType> = {
|
|
10
10
|
Component: Defaults<FieldType>[AuthenticatorRouteComponentName];
|
|
11
11
|
props: DefaultProps<FieldType>[AuthenticatorRouteComponentName];
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
13
|
+
type ExtractMachineKey<RouteProps> = Extract<AuthenticatorMachineContextKey, keyof RouteProps>;
|
|
14
|
+
export type FormEventHandlerMachineKey = 'updateBlur' | 'updateForm' | 'submitForm';
|
|
15
|
+
export type FormEventHandlerPropKey = `handleBlur` | `handleChange` | `handleSubmit`;
|
|
16
|
+
export type CommonRouteMachineKey = ExtractMachineKey<CommonRouteProps> | FormEventHandlerMachineKey;
|
|
17
17
|
/**
|
|
18
18
|
* `route` sub-component machine selector key types
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
20
|
+
export type ConfirmResetPasswordMachineKey = ExtractMachineKey<ConfirmResetPasswordBaseProps> | CommonRouteMachineKey;
|
|
21
|
+
export type ConfirmSignInMachineKey = ExtractMachineKey<ConfirmSignInBaseProps> | CommonRouteMachineKey | 'user';
|
|
22
|
+
export type ConfirmSignUpMachineKey = ExtractMachineKey<ConfirmSignUpBaseProps> | CommonRouteMachineKey;
|
|
23
|
+
export type ConfirmVerifyUserMachineKey = ExtractMachineKey<ConfirmVerifyUserProps> | CommonRouteMachineKey;
|
|
24
|
+
export type ForceNewPasswordMachineKey = ExtractMachineKey<ForceResetPasswordBaseProps> | CommonRouteMachineKey;
|
|
25
|
+
export type ResetPasswordMachineKey = ExtractMachineKey<ResetPasswordBaseProps> | CommonRouteMachineKey;
|
|
26
|
+
export type SetupTOTPMachineKey = ExtractMachineKey<SetupTOTPBaseProps> | CommonRouteMachineKey;
|
|
27
|
+
export type SignInMachineKey = ExtractMachineKey<SignInBaseProps> | CommonRouteMachineKey;
|
|
28
|
+
export type SignUpMachineKey = ExtractMachineKey<SignUpBaseProps> | CommonRouteMachineKey;
|
|
29
|
+
export type VerifyUserMachineKey = ExtractMachineKey<VerifyUserProps> | CommonRouteMachineKey;
|
|
30
30
|
/**
|
|
31
31
|
* machine values with machine form event handlers keys mapped to UI form event handlers
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export type ConvertedMachineProps = Omit<AuthenticatorMachineContext, FormEventHandlerMachineKey> & {
|
|
34
34
|
handleBlur: AuthenticatorMachineContext['updateBlur'];
|
|
35
35
|
handleChange: AuthenticatorMachineContext['updateForm'];
|
|
36
36
|
handleSubmit: AuthenticatorMachineContext['submitForm'];
|
|
@@ -9,8 +9,8 @@ export interface UseMessageParams<PlatformStyleProps> {
|
|
|
9
9
|
components: Components<PlatformStyleProps>;
|
|
10
10
|
onMessageAction: OnMessageAction;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
type MessageComponent<PlatformStyleProps> = BannerMessageComponent<PlatformStyleProps> | CarouselMessageComponent<PlatformStyleProps> | FullScreenMessageComponent<PlatformStyleProps> | ModalMessageComponent<PlatformStyleProps>;
|
|
13
|
+
type MessageProps<PlatformStyleProps> = BannerMessageCommonProps<PlatformStyleProps> | CarouselMessageCommonProps<PlatformStyleProps> | FullScreenMessageCommonProps<PlatformStyleProps> | ModalMessageCommonProps<PlatformStyleProps>;
|
|
14
14
|
export interface UseMessage<PlatformStyleProps> {
|
|
15
15
|
Component: MessageComponent<PlatformStyleProps>;
|
|
16
16
|
props: MessageProps<PlatformStyleProps>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InAppMessage, InAppMessageAction, InAppMessageButton, InAppMessageContent, InAppMessageImage, InAppMessageLayout, InAppMessageStyle, InAppMessageTextAlign } from '@aws-amplify/notifications';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
3
|
+
export type Message = InAppMessage;
|
|
4
|
+
export type MessageAction = InAppMessageAction;
|
|
5
|
+
export type MessageButton = InAppMessageButton;
|
|
6
|
+
export type MessageContent = InAppMessageContent;
|
|
7
|
+
export type MessageImage = InAppMessageImage;
|
|
8
|
+
export type MessageLayout = InAppMessageLayout;
|
|
9
|
+
export type MessageStyle = InAppMessageStyle;
|
|
10
|
+
export type MessageTextAlign = InAppMessageTextAlign;
|
|
11
|
+
export type OnMessageAction = (params: {
|
|
12
12
|
action: MessageAction;
|
|
13
13
|
url?: string | undefined;
|
|
14
14
|
}) => void;
|
|
@@ -27,8 +27,8 @@ export interface MessageCommonProps<PlatformStyleProps> {
|
|
|
27
27
|
onDisplay?: () => void;
|
|
28
28
|
style?: PlatformStyleProps;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
31
|
-
export
|
|
30
|
+
export type BannerMessageLayouts = 'BOTTOM_BANNER' | 'MIDDLE_BANNER' | 'TOP_BANNER';
|
|
31
|
+
export type MessageComponentPosition = 'bottom' | 'middle' | 'top';
|
|
32
32
|
export interface BannerMessageCommonProps<PlatformStyleProps> extends MessageCommonProps<PlatformStyleProps>, MessageContentProps {
|
|
33
33
|
position?: MessageComponentPosition;
|
|
34
34
|
}
|
|
@@ -46,7 +46,7 @@ export interface MessagePayloadStyle {
|
|
|
46
46
|
primaryButton?: MessageStyle;
|
|
47
47
|
secondaryButton?: MessageStyle;
|
|
48
48
|
}
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
49
|
+
export type BannerMessageComponent<PlatformStyleProps> = React.ComponentType<BannerMessageCommonProps<PlatformStyleProps>>;
|
|
50
|
+
export type CarouselMessageComponent<PlatformStyleProps> = React.ComponentType<CarouselMessageCommonProps<PlatformStyleProps>>;
|
|
51
|
+
export type FullScreenMessageComponent<PlatformStyleProps> = React.ComponentType<FullScreenMessageCommonProps<PlatformStyleProps>>;
|
|
52
|
+
export type ModalMessageComponent<PlatformStyleProps> = React.ComponentType<ModalMessageCommonProps<PlatformStyleProps>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MessageAction } from '../types';
|
|
2
|
-
export
|
|
2
|
+
export type HandleMessageLinkAction = (url: string) => void | Promise<void>;
|
|
3
3
|
interface HandleMessageActionParams {
|
|
4
4
|
action: MessageAction;
|
|
5
5
|
handleMessageLinkAction: HandleMessageLinkAction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.20",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"react-native": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typecheck": "tsc --noEmit"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@aws-amplify/ui": "5.6.
|
|
33
|
+
"@aws-amplify/ui": "5.6.1",
|
|
34
34
|
"@xstate/react": "3.0.1",
|
|
35
35
|
"lodash": "4.17.21",
|
|
36
36
|
"xstate": "^4.33.6"
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"react": ">= 16.14.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
+
"@aws-amplify/eslint-config-amplify-ui": "0.0.0",
|
|
43
44
|
"@rollup/plugin-typescript": "^8.3.1",
|
|
44
45
|
"@testing-library/react": "^12.0.0",
|
|
45
46
|
"@testing-library/react-hooks": "^7.0.2",
|
|
@@ -48,7 +49,6 @@
|
|
|
48
49
|
"@types/react-dom": "^17.0.13",
|
|
49
50
|
"@types/react-test-renderer": "^17.0.1",
|
|
50
51
|
"eslint": "^8.4.1",
|
|
51
|
-
"eslint-config-amplify-ui": "0.0.0",
|
|
52
52
|
"jest": "^27.0.4",
|
|
53
53
|
"prettier": "2.4.1",
|
|
54
54
|
"react": "^17.0.2",
|