@aws-amplify/ui 3.2.0 → 3.2.1

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
@@ -11,23 +11,23 @@ declare type AuthFormData = Record<string, string>;
11
11
  /**
12
12
  * List of routes that support custom formFields
13
13
  */
14
- declare type formFieldComponents = 'signIn' | 'signUp' | 'forceNewPassword' | 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'resetPassword' | 'setupTOTP';
14
+ declare type FormFieldComponents = 'signIn' | 'signUp' | 'forceNewPassword' | 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'resetPassword' | 'setupTOTP';
15
15
  /**
16
16
  * Used to customize form field attributes for each authenticator screen.
17
17
  */
18
18
  declare type FormFields = {
19
- [key in formFieldComponents]?: formField;
19
+ [key in FormFieldComponents]?: FormField;
20
20
  };
21
21
  /**
22
22
  * Override option for each screen. Maps each input to override options.
23
23
  */
24
- interface formField {
25
- [key: string]: formFieldTypes;
24
+ interface FormField {
25
+ [key: string]: FormFieldOptions;
26
26
  }
27
27
  /**
28
28
  * Override options for each field
29
29
  */
30
- interface formFieldTypes {
30
+ interface FormFieldOptions {
31
31
  /** Will hide the label above the input if set to true */
32
32
  labelHidden?: boolean;
33
33
  /** Label text */
@@ -60,6 +60,15 @@ declare enum AuthChallengeNames {
60
60
  RESET_REQUIRED = "RESET_REQUIRED",
61
61
  MFA_SETUP = "MFA_SETUP"
62
62
  }
63
+ /** Contact destinations that we can send user confirmation code to */
64
+ declare type ContactMethod = 'Email' | 'Phone Number';
65
+ /** Federated IDPs that Authenticator supports */
66
+ declare enum FederatedIdentityProviders {
67
+ Apple = "SignInWithApple",
68
+ Amazon = "LoginWithAmazon",
69
+ Facebook = "Facebook",
70
+ Google = "Google"
71
+ }
63
72
  /** Known cognito user attributes */
64
73
  interface CognitoAttributes {
65
74
  email: string;
@@ -277,13 +286,22 @@ declare type AuthMachineState = State<AuthContext, AuthEvent>;
277
286
 
278
287
  declare type NoInfer<T> = [T][T extends any ? 0 : never];
279
288
 
280
- declare const authInputAttributes: AuthInputAttributes;
281
- declare enum FederatedIdentityProviders {
282
- Apple = "SignInWithApple",
283
- Amazon = "LoginWithAmazon",
284
- Facebook = "Facebook",
285
- Google = "Google"
286
- }
289
+ /**
290
+ * This file contains helpers that lets you easily access current actor's state
291
+ * and context.
292
+ */
293
+
294
+ /**
295
+ * Get the state of current actor. This is useful for checking which screen
296
+ * to render: e.g. `getActorState(state).matches('confirmSignUp.edit').
297
+ */
298
+ declare const getActorState: (state: AuthMachineState) => AuthActorState;
299
+ /**
300
+ * Get the context of current actor. Useful for getting any nested context
301
+ * like remoteError.
302
+ */
303
+ declare const getActorContext: (state: AuthMachineState) => AuthActorContext;
304
+
287
305
  /**
288
306
  * Given xstate context from AuthMachine, this returns the input label, type,
289
307
  * and error attributes of the configured login_mechanisms. An optional "alias"
@@ -302,16 +320,7 @@ declare const getConfiguredAliases: (context: AuthContext) => {
302
320
  primaryAlias: "email" | "phone_number" | "username";
303
321
  secondaryAliases: ("email" | "phone_number" | "username")[];
304
322
  };
305
- /**
306
- * Get the state of current actor. This is useful for checking which screen
307
- * to render: e.g. `getActorState(state).matches('confirmSignUp.edit').
308
- */
309
- declare const getActorState: (state: AuthMachineState) => AuthActorState;
310
- /**
311
- * Get the context of current actor. Useful for getting any nested context
312
- * like remoteError.
313
- */
314
- declare const getActorContext: (state: AuthMachineState) => AuthActorContext;
323
+
315
324
  /**
316
325
  * Creates public facing auth helpers that abstracts out xstate implementation
317
326
  * detail. Each framework implementation can export these helpers so that
@@ -370,6 +379,24 @@ declare const getServiceFacade: ({ send, state }: {
370
379
  toSignUp: (data?: AuthEventData) => void;
371
380
  skipVerification: (data?: AuthEventData) => void;
372
381
  };
382
+
383
+ /**
384
+ * This file contains helpers related to forms and input attributes.
385
+ */
386
+
387
+ declare const authInputAttributes: AuthInputAttributes;
388
+ declare const getFormDataFromEvent: (event: Event) => {
389
+ [k: string]: FormDataEntryValue;
390
+ };
391
+ declare const setFormOrder: (formOverrides: FormField, fieldNames: Array<SignUpAttribute | CommonFields>) => Array<string | number>;
392
+
393
+ /**
394
+ * This file contains general helpers that state machine or authenticator
395
+ * implementations can use.
396
+ */
397
+
398
+ declare const censorAllButFirstAndLast: (value: string) => string;
399
+ declare const censorPhoneNumber: (val: string) => string;
373
400
  /**
374
401
  * Listens to external auth Hub events and sends corresponding event to
375
402
  * the `authService` of interest
@@ -380,14 +407,6 @@ declare const getServiceFacade: ({ send, state }: {
380
407
  */
381
408
  declare const listenToAuthHub: (send: AuthMachineSend) => () => void;
382
409
 
383
- declare type ContactMethod = 'Email' | 'Phone Number';
384
- declare const censorAllButFirstAndLast: (value: string) => string;
385
- declare const censorPhoneNumber: (val: string) => string;
386
- declare const getFormDataFromEvent: (event: Event) => {
387
- [k: string]: FormDataEntryValue;
388
- };
389
- declare const setFormOrder: (formOverrides: formField, fieldNames: Array<SignUpAttribute | CommonFields>) => Array<string | number>;
390
-
391
410
  declare const countryDialCodes: string[];
392
411
 
393
412
  /**
@@ -975,4 +994,4 @@ declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
975
994
 
976
995
  declare const defaultTheme: WebTheme;
977
996
 
978
- export { ActorContextWithForms, ActorDoneData, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthInputAttributes, AuthInterpreter, AuthMachineSend, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoAttributes, CognitoUserAmplify, ColorModeOverride, ColorValue, CommonFields, ContactMethod, DefaultTexts, DesignToken, Dict, FederatedIdentityProviders, FontSizeValue, FontValue, FontWeightValue, FormFields, InputAttributeDefaults, InvokeActorEventTypes, LineHeightValue, LoginMechanism, LoginMechanismArray, MediaQueryOverride, NoInfer, OpacityValue, OutlineOffsetValue, OutlineWidthValue, Override, Phrase, RadiusValue, ResetPasswordContext, ResetPasswordState, SelectorOverride, 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, formField, formFieldComponents, formFieldTypes, getActorContext, getActorState, getAliasInfoFromContext, getConfiguredAliases, getFormDataFromEvent, getSendEventAliases, getServiceContextFacade, getServiceFacade, hasTranslation, isDesignToken, listenToAuthHub, setFormOrder, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };
997
+ export { ActorContextWithForms, ActorDoneData, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthInputAttributes, AuthInterpreter, AuthMachineSend, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoAttributes, CognitoUserAmplify, ColorModeOverride, ColorValue, CommonFields, ContactMethod, DefaultTexts, DesignToken, Dict, FederatedIdentityProviders, FontSizeValue, FontValue, FontWeightValue, FormField, FormFieldComponents, FormFieldOptions, FormFields, InputAttributeDefaults, InvokeActorEventTypes, LineHeightValue, LoginMechanism, LoginMechanismArray, MediaQueryOverride, NoInfer, OpacityValue, OutlineOffsetValue, OutlineWidthValue, Override, Phrase, RadiusValue, ResetPasswordContext, ResetPasswordState, SelectorOverride, 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, getFormDataFromEvent, getSendEventAliases, getServiceContextFacade, getServiceFacade, hasTranslation, isDesignToken, listenToAuthHub, setFormOrder, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };