@aws-amplify/ui 3.0.1 → 3.0.5
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/index.js +17 -18
- package/dist/esm/index.js.map +3 -3
- package/dist/index.d.ts +51 -11
- package/dist/index.js +17 -18
- package/dist/index.js.map +3 -3
- package/dist/styles.css +154 -65
- package/dist/theme.css +51 -44
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as amazon_cognito_identity_js from 'amazon-cognito-identity-js';
|
|
2
|
+
import { CognitoUser, CodeDeliveryDetails } from 'amazon-cognito-identity-js';
|
|
1
3
|
import * as xstate from 'xstate';
|
|
2
4
|
import { State, Interpreter, Sender } from 'xstate';
|
|
3
|
-
import { CognitoUser } from 'amazon-cognito-identity-js';
|
|
4
5
|
import { PartialDeep } from 'type-fest';
|
|
5
6
|
|
|
6
7
|
declare type ValidationError = Record<string, string>;
|
|
@@ -8,10 +9,12 @@ declare type ValidationError = Record<string, string>;
|
|
|
8
9
|
* Return type of validator. This is `null` if there are no error, and `ValidationError` otherwise.
|
|
9
10
|
*/
|
|
10
11
|
declare type ValidatorResult = void | null | ValidationError;
|
|
12
|
+
declare type SignInResult = string;
|
|
11
13
|
/**
|
|
12
14
|
* Validates the given formData. This can be synchronous or asynchronous.
|
|
13
15
|
*/
|
|
14
|
-
declare type Validator = (formData: AuthFormData) => ValidatorResult | Promise<ValidatorResult>;
|
|
16
|
+
declare type Validator = (formData: AuthFormData, touchData?: AuthFormData) => ValidatorResult | Promise<ValidatorResult>;
|
|
17
|
+
declare type SignInTypes = (user: string, code: string, mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA) => SignInResult | Promise<SignInResult>;
|
|
15
18
|
|
|
16
19
|
declare type AuthFormData = Record<string, string>;
|
|
17
20
|
interface AuthContext {
|
|
@@ -22,20 +25,33 @@ interface AuthContext {
|
|
|
22
25
|
socialProviders?: SocialProvider[];
|
|
23
26
|
};
|
|
24
27
|
user?: CognitoUserAmplify;
|
|
28
|
+
username?: string;
|
|
29
|
+
password?: string;
|
|
30
|
+
code?: string;
|
|
31
|
+
mfaType?: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
|
|
32
|
+
}
|
|
33
|
+
interface ServicesContext {
|
|
34
|
+
username?: string;
|
|
35
|
+
password?: string;
|
|
36
|
+
user?: string;
|
|
37
|
+
code?: string;
|
|
38
|
+
mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
|
|
25
39
|
}
|
|
26
40
|
interface BaseFormContext {
|
|
27
41
|
authAttributes?: Record<string, any>;
|
|
28
42
|
challengeName?: string;
|
|
29
43
|
formValues?: AuthFormData;
|
|
44
|
+
touched?: AuthFormData;
|
|
30
45
|
intent?: string;
|
|
31
46
|
remoteError?: string;
|
|
32
47
|
user?: CognitoUserAmplify;
|
|
33
48
|
validationError?: ValidationError;
|
|
49
|
+
codeDeliveryDetails?: CodeDeliveryDetails;
|
|
34
50
|
country_code?: string;
|
|
35
51
|
}
|
|
36
52
|
interface SignInContext extends BaseFormContext {
|
|
37
|
-
loginMechanisms: AuthContext['config']['loginMechanisms'];
|
|
38
|
-
socialProviders: AuthContext['config']['socialProviders'];
|
|
53
|
+
loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
|
|
54
|
+
socialProviders: Required<AuthContext>['config']['socialProviders'];
|
|
39
55
|
attributeToVerify?: string;
|
|
40
56
|
redirectIntent?: string;
|
|
41
57
|
unverifiedAttributes?: Record<string, string>;
|
|
@@ -46,8 +62,8 @@ declare type SignUpFieldsWithDefaults = typeof signUpFieldsWithDefault[number];
|
|
|
46
62
|
declare type SignUpFieldsWithoutDefaults = typeof signUpFieldsWithoutDefault[number];
|
|
47
63
|
declare type SignUpAttribute = SignUpFieldsWithDefaults | SignUpFieldsWithoutDefaults;
|
|
48
64
|
interface SignUpContext extends BaseFormContext {
|
|
49
|
-
loginMechanisms: AuthContext['config']['loginMechanisms'];
|
|
50
|
-
socialProviders: AuthContext['config']['socialProviders'];
|
|
65
|
+
loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
|
|
66
|
+
socialProviders: Required<AuthContext>['config']['socialProviders'];
|
|
51
67
|
unverifiedAttributes?: Record<string, string>;
|
|
52
68
|
}
|
|
53
69
|
interface ResetPasswordContext extends BaseFormContext {
|
|
@@ -71,7 +87,7 @@ interface CognitoUserAmplify extends CognitoUser {
|
|
|
71
87
|
username?: string;
|
|
72
88
|
}
|
|
73
89
|
declare type InvokeActorEventTypes = 'done.invoke.signInActor' | 'done.invoke.signUpActor' | 'done.invoke.signOutActor' | 'done.invoke.resetPasswordActor';
|
|
74
|
-
declare type AuthEventTypes = 'CHANGE' | 'FEDERATED_SIGN_IN' | 'RESEND' | 'RESET_PASSWORD' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'SKIP' | 'SUBMIT' | InvokeActorEventTypes;
|
|
90
|
+
declare type AuthEventTypes = 'CHANGE' | 'BLUR' | 'FEDERATED_SIGN_IN' | 'RESEND' | 'RESET_PASSWORD' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'SKIP' | 'SUBMIT' | InvokeActorEventTypes;
|
|
75
91
|
declare enum AuthChallengeNames {
|
|
76
92
|
SMS_MFA = "SMS_MFA",
|
|
77
93
|
SOFTWARE_TOKEN_MFA = "SOFTWARE_TOKEN_MFA",
|
|
@@ -151,6 +167,7 @@ declare const getSendEventAliases: (send: Sender<AuthEvent>) => {
|
|
|
151
167
|
readonly signOut: (data?: AuthEventData) => void;
|
|
152
168
|
readonly submitForm: (data?: AuthEventData) => void;
|
|
153
169
|
readonly updateForm: (data?: AuthEventData) => void;
|
|
170
|
+
readonly updateBlur: (data?: AuthEventData) => void;
|
|
154
171
|
readonly toFederatedSignIn: (data?: AuthEventData) => void;
|
|
155
172
|
readonly toResetPassword: (data?: AuthEventData) => void;
|
|
156
173
|
readonly toSignIn: (data?: AuthEventData) => void;
|
|
@@ -166,6 +183,7 @@ declare const getServiceContextFacade: (state: AuthMachineState) => {
|
|
|
166
183
|
validationErrors: {
|
|
167
184
|
[x: string]: string;
|
|
168
185
|
};
|
|
186
|
+
codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
|
|
169
187
|
};
|
|
170
188
|
declare const getServiceFacade: ({ send, state }: {
|
|
171
189
|
send: any;
|
|
@@ -179,10 +197,12 @@ declare const getServiceFacade: ({ send, state }: {
|
|
|
179
197
|
validationErrors: {
|
|
180
198
|
[x: string]: string;
|
|
181
199
|
};
|
|
200
|
+
codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
|
|
182
201
|
resendCode: (data?: AuthEventData) => void;
|
|
183
202
|
signOut: (data?: AuthEventData) => void;
|
|
184
203
|
submitForm: (data?: AuthEventData) => void;
|
|
185
204
|
updateForm: (data?: AuthEventData) => void;
|
|
205
|
+
updateBlur: (data?: AuthEventData) => void;
|
|
186
206
|
toFederatedSignIn: (data?: AuthEventData) => void;
|
|
187
207
|
toResetPassword: (data?: AuthEventData) => void;
|
|
188
208
|
toSignIn: (data?: AuthEventData) => void;
|
|
@@ -287,9 +307,29 @@ declare const translations: Record<string, Dict>;
|
|
|
287
307
|
declare const defaultServices: {
|
|
288
308
|
getAmplifyConfig(): Promise<{}>;
|
|
289
309
|
getCurrentUser(): Promise<any>;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
310
|
+
handleSignUp(formData: any): Promise<any>;
|
|
311
|
+
handleSignIn({ username, password, }: {
|
|
312
|
+
username: string;
|
|
313
|
+
password: string;
|
|
314
|
+
}): Promise<any>;
|
|
315
|
+
handleConfirmSignIn({ user, code, mfaType, }: {
|
|
316
|
+
user: any;
|
|
317
|
+
code: string;
|
|
318
|
+
mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
|
|
319
|
+
}): Promise<any>;
|
|
320
|
+
handleConfirmSignUp({ username, code, }: {
|
|
321
|
+
username: string;
|
|
322
|
+
code: string;
|
|
323
|
+
}): Promise<any>;
|
|
324
|
+
handleForgotPasswordSubmit({ username, code, password, }: {
|
|
325
|
+
username: string;
|
|
326
|
+
code: string;
|
|
327
|
+
password: string;
|
|
328
|
+
}): Promise<SignInResult>;
|
|
329
|
+
handleForgotPassword(formData: any): Promise<any>;
|
|
330
|
+
validateCustomSignUp(formData: any, touchData: any): Promise<ValidatorResult>;
|
|
331
|
+
validateConfirmPassword<Validator>(formData: any, touchData: any): Promise<ValidatorResult>;
|
|
332
|
+
validatePreferredUsername(formData: any, touchData: any): Promise<ValidatorResult>;
|
|
293
333
|
};
|
|
294
334
|
|
|
295
335
|
declare type AuthenticatorMachineOptions = AuthContext['config'] & {
|
|
@@ -785,4 +825,4 @@ declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
|
|
|
785
825
|
|
|
786
826
|
declare const defaultTheme: WebTheme;
|
|
787
827
|
|
|
788
|
-
export { ActorContextWithForms, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthInputAttributes, AuthInterpreter, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoUserAmplify, ColorModeOverride, ColorValue, ContactMethod, DefaultTexts, DesignToken, Dict, FederatedIdentityProviders, FontSizeValue, FontValue, FontWeightValue, InputAttributes, InvokeActorEventTypes, LineHeightValue, LoginMechanism, LoginMechanismArray, MediaQueryOverride, NoInfer, OpacityValue, OutlineOffsetValue, OutlineWidthValue, Override, Phrase, RadiusValue, ResetPasswordContext, ResetPasswordState, SelectorOverride, ShadowValue, SignInContext, SignInState, SignOutContext, SignOutState, SignUpAttribute, SignUpContext, SignUpFieldsWithDefaults, SignUpFieldsWithoutDefaults, SignUpState, SocialProvider, SpaceValue, Theme, TimeValue, TransformValue, ValidationError, Validator, ValidatorResult, WebDesignToken, WebTheme, authInputAttributes, censorAllButFirstAndLast, censorPhoneNumber, countryDialCodes, createAuthenticatorMachine, createTheme, defaultTheme, getActorContext, getActorState, getAliasInfoFromContext, getConfiguredAliases, getSendEventAliases, getServiceContextFacade, getServiceFacade, isDesignToken, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };
|
|
828
|
+
export { ActorContextWithForms, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthInputAttributes, AuthInterpreter, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoUserAmplify, ColorModeOverride, ColorValue, ContactMethod, DefaultTexts, DesignToken, Dict, FederatedIdentityProviders, FontSizeValue, FontValue, FontWeightValue, InputAttributes, InvokeActorEventTypes, LineHeightValue, LoginMechanism, LoginMechanismArray, MediaQueryOverride, NoInfer, OpacityValue, OutlineOffsetValue, OutlineWidthValue, Override, Phrase, RadiusValue, ResetPasswordContext, ResetPasswordState, SelectorOverride, ServicesContext, ShadowValue, SignInContext, SignInResult, SignInState, SignInTypes, SignOutContext, SignOutState, SignUpAttribute, SignUpContext, SignUpFieldsWithDefaults, SignUpFieldsWithoutDefaults, SignUpState, SocialProvider, SpaceValue, Theme, TimeValue, TransformValue, ValidationError, Validator, ValidatorResult, WebDesignToken, WebTheme, authInputAttributes, censorAllButFirstAndLast, censorPhoneNumber, countryDialCodes, createAuthenticatorMachine, createTheme, defaultTheme, getActorContext, getActorState, getAliasInfoFromContext, getConfiguredAliases, getSendEventAliases, getServiceContextFacade, getServiceFacade, isDesignToken, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };
|