@aws-amplify/ui 3.0.8 → 3.0.9

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/index.d.ts CHANGED
@@ -16,6 +16,34 @@ declare type SignInResult = string;
16
16
  declare type Validator = (formData: AuthFormData, touchData?: AuthFormData) => ValidatorResult | Promise<ValidatorResult>;
17
17
  declare type SignInTypes = (user: string, code: string, mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA) => SignInResult | Promise<SignInResult>;
18
18
 
19
+ declare const defaultServices: {
20
+ getAmplifyConfig(): Promise<{}>;
21
+ getCurrentUser(): Promise<any>;
22
+ handleSignUp(formData: any): Promise<any>;
23
+ handleSignIn({ username, password, }: {
24
+ username: string;
25
+ password: string;
26
+ }): Promise<any>;
27
+ handleConfirmSignIn({ user, code, mfaType, }: {
28
+ user: any;
29
+ code: string;
30
+ mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
31
+ }): Promise<any>;
32
+ handleConfirmSignUp({ username, code, }: {
33
+ username: string;
34
+ code: string;
35
+ }): Promise<any>;
36
+ handleForgotPasswordSubmit({ username, code, password, }: {
37
+ username: string;
38
+ code: string;
39
+ password: string;
40
+ }): Promise<SignInResult>;
41
+ handleForgotPassword(formData: any): Promise<any>;
42
+ validateCustomSignUp(formData: any, touchData: any): Promise<ValidatorResult>;
43
+ validateConfirmPassword<Validator>(formData: any, touchData: any): Promise<ValidatorResult>;
44
+ validatePreferredUsername(formData: any, touchData: any): Promise<ValidatorResult>;
45
+ };
46
+
19
47
  declare type AuthFormData = Record<string, string>;
20
48
  interface AuthContext {
21
49
  actorRef?: any;
@@ -23,7 +51,9 @@ interface AuthContext {
23
51
  loginMechanisms?: LoginMechanism[];
24
52
  signUpAttributes?: SignUpAttribute[];
25
53
  socialProviders?: SocialProvider[];
54
+ initialState?: 'signIn' | 'signUp' | 'resetPassword';
26
55
  };
56
+ services?: Partial<typeof defaultServices>;
27
57
  user?: CognitoUserAmplify;
28
58
  username?: string;
29
59
  password?: string;
@@ -87,7 +117,7 @@ interface CognitoUserAmplify extends CognitoUser {
87
117
  username?: string;
88
118
  }
89
119
  declare type InvokeActorEventTypes = 'done.invoke.signInActor' | 'done.invoke.signUpActor' | 'done.invoke.signOutActor' | 'done.invoke.resetPasswordActor';
90
- declare type AuthEventTypes = 'CHANGE' | 'BLUR' | 'FEDERATED_SIGN_IN' | 'RESEND' | 'RESET_PASSWORD' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'SKIP' | 'SUBMIT' | InvokeActorEventTypes;
120
+ declare type AuthEventTypes = 'CHANGE' | 'BLUR' | 'FEDERATED_SIGN_IN' | 'RESEND' | 'RESET_PASSWORD' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'SKIP' | 'SUBMIT' | 'INIT' | InvokeActorEventTypes;
91
121
  declare enum AuthChallengeNames {
92
122
  SMS_MFA = "SMS_MFA",
93
123
  SOFTWARE_TOKEN_MFA = "SOFTWARE_TOKEN_MFA",
@@ -309,39 +339,10 @@ declare function translate<T = Phrase>(phrase: NoInfer<T>): string;
309
339
  declare function hasTranslation(phrase: string): boolean;
310
340
  declare const translations: Record<string, Dict>;
311
341
 
312
- declare const defaultServices: {
313
- getAmplifyConfig(): Promise<{}>;
314
- getCurrentUser(): Promise<any>;
315
- handleSignUp(formData: any): Promise<any>;
316
- handleSignIn({ username, password, }: {
317
- username: string;
318
- password: string;
319
- }): Promise<any>;
320
- handleConfirmSignIn({ user, code, mfaType, }: {
321
- user: any;
322
- code: string;
323
- mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
324
- }): Promise<any>;
325
- handleConfirmSignUp({ username, code, }: {
326
- username: string;
327
- code: string;
328
- }): Promise<any>;
329
- handleForgotPasswordSubmit({ username, code, password, }: {
330
- username: string;
331
- code: string;
332
- password: string;
333
- }): Promise<SignInResult>;
334
- handleForgotPassword(formData: any): Promise<any>;
335
- validateCustomSignUp(formData: any, touchData: any): Promise<ValidatorResult>;
336
- validateConfirmPassword<Validator>(formData: any, touchData: any): Promise<ValidatorResult>;
337
- validatePreferredUsername(formData: any, touchData: any): Promise<ValidatorResult>;
338
- };
339
-
340
342
  declare type AuthenticatorMachineOptions = AuthContext['config'] & {
341
- initialState?: 'signIn' | 'signUp' | 'resetPassword';
342
- services?: Partial<typeof defaultServices>;
343
+ services?: AuthContext['services'];
343
344
  };
344
- declare function createAuthenticatorMachine({ initialState, loginMechanisms, signUpAttributes, socialProviders, services: customServices, }: AuthenticatorMachineOptions): xstate.StateMachine<AuthContext, any, AuthEvent, {
345
+ declare function createAuthenticatorMachine(): xstate.StateMachine<AuthContext, any, AuthEvent, {
345
346
  value: any;
346
347
  context: AuthContext;
347
348
  }, xstate.ActionObject<AuthContext, AuthEvent>>;