@aws-amplify/ui 3.0.3 → 3.0.7

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
@@ -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
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,6 +25,17 @@ 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>;
@@ -32,11 +46,12 @@ interface BaseFormContext {
32
46
  remoteError?: string;
33
47
  user?: CognitoUserAmplify;
34
48
  validationError?: ValidationError;
49
+ codeDeliveryDetails?: CodeDeliveryDetails;
35
50
  country_code?: string;
36
51
  }
37
52
  interface SignInContext extends BaseFormContext {
38
- loginMechanisms: AuthContext['config']['loginMechanisms'];
39
- socialProviders: AuthContext['config']['socialProviders'];
53
+ loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
54
+ socialProviders: Required<AuthContext>['config']['socialProviders'];
40
55
  attributeToVerify?: string;
41
56
  redirectIntent?: string;
42
57
  unverifiedAttributes?: Record<string, string>;
@@ -47,8 +62,8 @@ declare type SignUpFieldsWithDefaults = typeof signUpFieldsWithDefault[number];
47
62
  declare type SignUpFieldsWithoutDefaults = typeof signUpFieldsWithoutDefault[number];
48
63
  declare type SignUpAttribute = SignUpFieldsWithDefaults | SignUpFieldsWithoutDefaults;
49
64
  interface SignUpContext extends BaseFormContext {
50
- loginMechanisms: AuthContext['config']['loginMechanisms'];
51
- socialProviders: AuthContext['config']['socialProviders'];
65
+ loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
66
+ socialProviders: Required<AuthContext>['config']['socialProviders'];
52
67
  unverifiedAttributes?: Record<string, string>;
53
68
  }
54
69
  interface ResetPasswordContext extends BaseFormContext {
@@ -168,6 +183,7 @@ declare const getServiceContextFacade: (state: AuthMachineState) => {
168
183
  validationErrors: {
169
184
  [x: string]: string;
170
185
  };
186
+ codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
171
187
  };
172
188
  declare const getServiceFacade: ({ send, state }: {
173
189
  send: any;
@@ -181,6 +197,7 @@ declare const getServiceFacade: ({ send, state }: {
181
197
  validationErrors: {
182
198
  [x: string]: string;
183
199
  };
200
+ codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
184
201
  resendCode: (data?: AuthEventData) => void;
185
202
  signOut: (data?: AuthEventData) => void;
186
203
  submitForm: (data?: AuthEventData) => void;
@@ -232,6 +249,7 @@ declare const DefaultTexts: {
232
249
  readonly FAMILY_NAME: string;
233
250
  readonly GIVEN_NAME: string;
234
251
  readonly FORGOT_YOUR_PASSWORD: string;
252
+ readonly FORGOT_YOUR_PASSWORD_LEGACY: string;
235
253
  readonly HIDE_PASSWORD: string;
236
254
  readonly LOADING: string;
237
255
  readonly LOGIN_NAME: string;
@@ -285,11 +303,35 @@ declare type Dict = Record<string, string>;
285
303
  * You can also use translate<string> to handle custom strings or dynamic content.
286
304
  */
287
305
  declare function translate<T = Phrase>(phrase: NoInfer<T>): string;
306
+ /**
307
+ * Whether I18n has a translation entry for given phrase
308
+ */
309
+ declare function hasTranslation(phrase: string): boolean;
288
310
  declare const translations: Record<string, Dict>;
289
311
 
290
312
  declare const defaultServices: {
291
313
  getAmplifyConfig(): Promise<{}>;
292
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>;
293
335
  validateCustomSignUp(formData: any, touchData: any): Promise<ValidatorResult>;
294
336
  validateConfirmPassword<Validator>(formData: any, touchData: any): Promise<ValidatorResult>;
295
337
  validatePreferredUsername(formData: any, touchData: any): Promise<ValidatorResult>;
@@ -666,7 +708,6 @@ interface Breakpoints {
666
708
  xl: number;
667
709
  xxl: number;
668
710
  };
669
- unit: string;
670
711
  defaultBreakpoint: string;
671
712
  }
672
713
 
@@ -788,4 +829,4 @@ declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
788
829
 
789
830
  declare const defaultTheme: WebTheme;
790
831
 
791
- 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 };
832
+ 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 };