@aws-amplify/ui 3.0.5 → 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",
@@ -249,6 +279,7 @@ declare const DefaultTexts: {
249
279
  readonly FAMILY_NAME: string;
250
280
  readonly GIVEN_NAME: string;
251
281
  readonly FORGOT_YOUR_PASSWORD: string;
282
+ readonly FORGOT_YOUR_PASSWORD_LEGACY: string;
252
283
  readonly HIDE_PASSWORD: string;
253
284
  readonly LOADING: string;
254
285
  readonly LOGIN_NAME: string;
@@ -302,41 +333,16 @@ declare type Dict = Record<string, string>;
302
333
  * You can also use translate<string> to handle custom strings or dynamic content.
303
334
  */
304
335
  declare function translate<T = Phrase>(phrase: NoInfer<T>): string;
336
+ /**
337
+ * Whether I18n has a translation entry for given phrase
338
+ */
339
+ declare function hasTranslation(phrase: string): boolean;
305
340
  declare const translations: Record<string, Dict>;
306
341
 
307
- declare const defaultServices: {
308
- getAmplifyConfig(): Promise<{}>;
309
- getCurrentUser(): Promise<any>;
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>;
333
- };
334
-
335
342
  declare type AuthenticatorMachineOptions = AuthContext['config'] & {
336
- initialState?: 'signIn' | 'signUp' | 'resetPassword';
337
- services?: Partial<typeof defaultServices>;
343
+ services?: AuthContext['services'];
338
344
  };
339
- declare function createAuthenticatorMachine({ initialState, loginMechanisms, signUpAttributes, socialProviders, services: customServices, }: AuthenticatorMachineOptions): xstate.StateMachine<AuthContext, any, AuthEvent, {
345
+ declare function createAuthenticatorMachine(): xstate.StateMachine<AuthContext, any, AuthEvent, {
340
346
  value: any;
341
347
  context: AuthContext;
342
348
  }, xstate.ActionObject<AuthContext, AuthEvent>>;
@@ -703,7 +709,6 @@ interface Breakpoints {
703
709
  xl: number;
704
710
  xxl: number;
705
711
  };
706
- unit: string;
707
712
  defaultBreakpoint: string;
708
713
  }
709
714
 
@@ -825,4 +830,4 @@ declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
825
830
 
826
831
  declare const defaultTheme: WebTheme;
827
832
 
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 };
833
+ 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, hasTranslation, isDesignToken, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };