@aws-amplify/ui 3.1.0 → 3.3.0
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 +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +226 -114
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/styles.css +127 -143
- package/dist/theme.css +31 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,95 @@
|
|
|
1
1
|
import * as amazon_cognito_identity_js from 'amazon-cognito-identity-js';
|
|
2
2
|
import { CognitoUser, CodeDeliveryDetails } from 'amazon-cognito-identity-js';
|
|
3
3
|
import * as xstate from 'xstate';
|
|
4
|
-
import {
|
|
4
|
+
import { Interpreter, State, Sender } from 'xstate';
|
|
5
5
|
import { PartialDeep } from 'type-fest';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Map of each input name to its value
|
|
9
|
+
*/
|
|
10
|
+
declare type AuthFormData = Record<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* List of routes that support custom formFields
|
|
13
|
+
*/
|
|
14
|
+
declare type FormFieldComponents = 'signIn' | 'signUp' | 'forceNewPassword' | 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'resetPassword' | 'setupTOTP';
|
|
15
|
+
/**
|
|
16
|
+
* Used to customize form field attributes for each authenticator screen.
|
|
17
|
+
*/
|
|
18
|
+
declare type FormFields = {
|
|
19
|
+
[key in FormFieldComponents]?: FormField;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Override option for each screen. Maps each input to override options.
|
|
23
|
+
*/
|
|
24
|
+
interface FormField {
|
|
25
|
+
[key: string]: FormFieldOptions;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Override options for each field
|
|
29
|
+
*/
|
|
30
|
+
interface FormFieldOptions {
|
|
31
|
+
/** Will hide the label above the input if set to true */
|
|
32
|
+
labelHidden?: boolean;
|
|
33
|
+
/** Label text */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Placeholder text */
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated For internal use only, please use `isRequired` instead.
|
|
39
|
+
*/
|
|
40
|
+
required?: boolean;
|
|
41
|
+
/** Whether this field is required for submission */
|
|
42
|
+
isRequired?: boolean;
|
|
43
|
+
/** Default dial code value */
|
|
44
|
+
dialCode?: string;
|
|
45
|
+
/** TOTP issuer to be used in the QR setup */
|
|
46
|
+
totpIssuer?: string;
|
|
47
|
+
/** TOTP username to be used in the QR */
|
|
48
|
+
totpUsername?: string;
|
|
49
|
+
/** List of dial codes you want to show in phone number field */
|
|
50
|
+
dialCodeList?: Array<string>;
|
|
51
|
+
/** Integer that denotes where this field should be positioned in. */
|
|
52
|
+
order?: number;
|
|
53
|
+
}
|
|
54
|
+
declare type PasswordPolicyRules = 'REQUIRES_LOWERCASE' | 'REQUIRES_NUMBERS' | 'REQUIRES_SYMBOLS' | 'REQUIRES_UPPERCASE';
|
|
55
|
+
interface PasswordSettings {
|
|
56
|
+
passwordPolicyMinLength: number;
|
|
57
|
+
passwordPolicyCharacters: Array<PasswordPolicyRules>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Enum of known challenge names */
|
|
61
|
+
declare enum AuthChallengeNames {
|
|
62
|
+
SMS_MFA = "SMS_MFA",
|
|
63
|
+
SOFTWARE_TOKEN_MFA = "SOFTWARE_TOKEN_MFA",
|
|
64
|
+
NEW_PASSWORD_REQUIRED = "NEW_PASSWORD_REQUIRED",
|
|
65
|
+
RESET_REQUIRED = "RESET_REQUIRED",
|
|
66
|
+
MFA_SETUP = "MFA_SETUP"
|
|
67
|
+
}
|
|
68
|
+
/** Contact destinations that we can send user confirmation code to */
|
|
69
|
+
declare type ContactMethod = 'Email' | 'Phone Number';
|
|
70
|
+
/** Federated IDPs that Authenticator supports */
|
|
71
|
+
declare enum FederatedIdentityProviders {
|
|
72
|
+
Apple = "SignInWithApple",
|
|
73
|
+
Amazon = "LoginWithAmazon",
|
|
74
|
+
Facebook = "Facebook",
|
|
75
|
+
Google = "Google"
|
|
76
|
+
}
|
|
77
|
+
/** Known cognito user attributes */
|
|
78
|
+
interface CognitoAttributes {
|
|
79
|
+
email: string;
|
|
80
|
+
phone_number: string;
|
|
81
|
+
[key: string]: string;
|
|
82
|
+
}
|
|
83
|
+
/** Cognito User Interface */
|
|
84
|
+
interface CognitoUserAmplify extends CognitoUser {
|
|
85
|
+
username?: string;
|
|
86
|
+
attributes?: CognitoAttributes;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Maps each input to its validation error, if any
|
|
91
|
+
*/
|
|
92
|
+
declare type ValidationError = Record<string, string | string[]>;
|
|
8
93
|
/**
|
|
9
94
|
* Return type of validator. This is `null` if there are no error, and `ValidationError` otherwise.
|
|
10
95
|
*/
|
|
@@ -13,9 +98,39 @@ declare type SignInResult = string;
|
|
|
13
98
|
/**
|
|
14
99
|
* Validates the given formData. This can be synchronous or asynchronous.
|
|
15
100
|
*/
|
|
16
|
-
declare type Validator = (formData: AuthFormData, touchData?: AuthFormData) => ValidatorResult | Promise<ValidatorResult>;
|
|
101
|
+
declare type Validator = (formData: AuthFormData, touchData?: AuthFormData, passwordSettings?: PasswordSettings) => ValidatorResult | Promise<ValidatorResult>;
|
|
17
102
|
declare type SignInTypes = (user: string, code: string, mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA) => SignInResult | Promise<SignInResult>;
|
|
18
103
|
|
|
104
|
+
/** Array of auth fields that we supply defaults with */
|
|
105
|
+
declare const signUpFieldsWithDefault: readonly ["birthdate", "email", "family_name", "given_name", "middle_name", "name", "nickname", "phone_number", "preferred_username", "profile", "website"];
|
|
106
|
+
/** Auth fields that we supply defaults with */
|
|
107
|
+
declare type SignUpFieldsWithDefaults = typeof signUpFieldsWithDefault[number];
|
|
108
|
+
/** Array of auth fields that we do not supply defaults with */
|
|
109
|
+
declare const signUpFieldsWithoutDefault: readonly ["address", "gender", "locale", "picture", "updated_at", "zoneinfo"];
|
|
110
|
+
/** Auth fields that we do not supply defaults with */
|
|
111
|
+
declare type SignUpFieldsWithoutDefaults = typeof signUpFieldsWithoutDefault[number];
|
|
112
|
+
/** All known auth fields */
|
|
113
|
+
declare type SignUpAttribute = SignUpFieldsWithDefaults | SignUpFieldsWithoutDefaults;
|
|
114
|
+
/** Fields that are common in all routes */
|
|
115
|
+
declare type CommonFields = 'username' | 'password' | 'confirm_password';
|
|
116
|
+
/** Array of known login mechanisms */
|
|
117
|
+
declare const LoginMechanismArray: readonly ["username", "email", "phone_number"];
|
|
118
|
+
/** Login mechanisms that can be used to sign in */
|
|
119
|
+
declare type LoginMechanism = typeof LoginMechanismArray[number];
|
|
120
|
+
/** List of social provider Authenticator supports */
|
|
121
|
+
declare type SocialProvider = 'amazon' | 'apple' | 'facebook' | 'google';
|
|
122
|
+
/** Input fields that we provide default fields with */
|
|
123
|
+
declare type AuthFieldsWithDefaults = LoginMechanism | SignUpFieldsWithDefaults | 'confirmation_code' | 'password';
|
|
124
|
+
/** Maps default attributes values for an input */
|
|
125
|
+
interface InputAttributeDefaults {
|
|
126
|
+
label: string;
|
|
127
|
+
type: string;
|
|
128
|
+
placeholder: string;
|
|
129
|
+
autocomplete?: string;
|
|
130
|
+
}
|
|
131
|
+
/** Maps default attribute values for each Auth Field */
|
|
132
|
+
declare type AuthInputAttributes = Record<AuthFieldsWithDefaults, InputAttributeDefaults>;
|
|
133
|
+
|
|
19
134
|
declare const defaultServices: {
|
|
20
135
|
getAmplifyConfig(): Promise<{}>;
|
|
21
136
|
getCurrentUser(): Promise<any>;
|
|
@@ -40,17 +155,27 @@ declare const defaultServices: {
|
|
|
40
155
|
}): Promise<SignInResult>;
|
|
41
156
|
handleForgotPassword(formData: any): Promise<any>;
|
|
42
157
|
validateCustomSignUp(formData: any, touchData: any): Promise<ValidatorResult>;
|
|
43
|
-
|
|
158
|
+
validateFormPassword<Validator>(formData: any, touchData: any, passwordSettings: PasswordSettings): Promise<ValidatorResult>;
|
|
159
|
+
validateConfirmPassword<Validator_1>(formData: any, touchData: any): Promise<ValidatorResult>;
|
|
44
160
|
validatePreferredUsername(formData: any, touchData: any): Promise<ValidatorResult>;
|
|
45
161
|
};
|
|
46
162
|
|
|
47
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Data that actor returns when they are done and reach the final state
|
|
165
|
+
*/
|
|
48
166
|
interface ActorDoneData {
|
|
167
|
+
/** Any auth form values that needs to be persisted between the actors */
|
|
49
168
|
authAttributes?: AuthFormData;
|
|
169
|
+
/** String that indicates where authMachine should next transition to */
|
|
50
170
|
intent?: string;
|
|
171
|
+
/** User returned by the actor it's done */
|
|
51
172
|
user?: CognitoUserAmplify;
|
|
52
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Context interface for the top-level machine
|
|
176
|
+
*/
|
|
53
177
|
interface AuthContext {
|
|
178
|
+
/** Reference to the spawned actor */
|
|
54
179
|
actorRef?: any;
|
|
55
180
|
config?: {
|
|
56
181
|
loginMechanisms?: LoginMechanism[];
|
|
@@ -58,6 +183,7 @@ interface AuthContext {
|
|
|
58
183
|
socialProviders?: SocialProvider[];
|
|
59
184
|
formFields?: FormFields;
|
|
60
185
|
initialState?: 'signIn' | 'signUp' | 'resetPassword';
|
|
186
|
+
passwordSettings?: PasswordSettings;
|
|
61
187
|
};
|
|
62
188
|
services?: Partial<typeof defaultServices>;
|
|
63
189
|
user?: CognitoUserAmplify;
|
|
@@ -67,24 +193,33 @@ interface AuthContext {
|
|
|
67
193
|
mfaType?: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
|
|
68
194
|
actorDoneData?: Omit<ActorDoneData, 'user'>;
|
|
69
195
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
user?: string;
|
|
74
|
-
code?: string;
|
|
75
|
-
mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
|
|
76
|
-
}
|
|
196
|
+
/**
|
|
197
|
+
* Base context for all actors that have auth forms associated
|
|
198
|
+
*/
|
|
77
199
|
interface BaseFormContext {
|
|
200
|
+
/** Any user attributes set that needs to persist between states */
|
|
78
201
|
authAttributes?: Record<string, any>;
|
|
202
|
+
/** Current challengeName issued by Cognnito */
|
|
79
203
|
challengeName?: string;
|
|
204
|
+
/** Required attributes for form submission */
|
|
80
205
|
requiredAttributes?: Array<string>;
|
|
206
|
+
/** Maps each input name to tis value */
|
|
81
207
|
formValues?: AuthFormData;
|
|
208
|
+
/** Input (names) that has been blurred at least ones */
|
|
82
209
|
touched?: AuthFormData;
|
|
210
|
+
/** String that indicates where authMachine should next transition to */
|
|
83
211
|
intent?: string;
|
|
212
|
+
/** Error returned from remote service / API */
|
|
84
213
|
remoteError?: string;
|
|
214
|
+
/** Current user inteface the actor is working with */
|
|
85
215
|
user?: CognitoUserAmplify;
|
|
216
|
+
/** Maps each input to its validation error, if any */
|
|
86
217
|
validationError?: ValidationError;
|
|
218
|
+
/** Maps each password validation rule */
|
|
219
|
+
passwordSettings?: PasswordSettings;
|
|
220
|
+
/** Denotes where a confirmation code has been sent to */
|
|
87
221
|
codeDeliveryDetails?: CodeDeliveryDetails;
|
|
222
|
+
/** Default country code for all phone number fields. */
|
|
88
223
|
country_code?: string;
|
|
89
224
|
}
|
|
90
225
|
interface SignInContext extends BaseFormContext {
|
|
@@ -95,11 +230,6 @@ interface SignInContext extends BaseFormContext {
|
|
|
95
230
|
redirectIntent?: string;
|
|
96
231
|
unverifiedAttributes?: Record<string, string>;
|
|
97
232
|
}
|
|
98
|
-
declare const signUpFieldsWithDefault: readonly ["birthdate", "email", "family_name", "given_name", "middle_name", "name", "nickname", "phone_number", "preferred_username", "profile", "website"];
|
|
99
|
-
declare const signUpFieldsWithoutDefault: readonly ["address", "gender", "locale", "picture", "updated_at", "zoneinfo"];
|
|
100
|
-
declare type SignUpFieldsWithDefaults = typeof signUpFieldsWithDefault[number];
|
|
101
|
-
declare type SignUpFieldsWithoutDefaults = typeof signUpFieldsWithoutDefault[number];
|
|
102
|
-
declare type SignUpAttribute = SignUpFieldsWithDefaults | SignUpFieldsWithoutDefaults;
|
|
103
233
|
interface SignUpContext extends BaseFormContext {
|
|
104
234
|
loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
|
|
105
235
|
socialProviders: Required<AuthContext>['config']['socialProviders'];
|
|
@@ -118,83 +248,69 @@ interface SignOutContext {
|
|
|
118
248
|
user?: CognitoUserAmplify;
|
|
119
249
|
formFields?: FormFields;
|
|
120
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Context for actors that have forms
|
|
253
|
+
*/
|
|
121
254
|
declare type ActorContextWithForms = SignInContext | SignUpContext | ResetPasswordContext;
|
|
122
|
-
declare type SignInState = State<SignInContext, AuthEvent>;
|
|
123
|
-
declare type SignUpState = State<SignUpContext, AuthEvent>;
|
|
124
|
-
declare type SignOutState = State<SignOutContext, AuthEvent>;
|
|
125
|
-
declare type ResetPasswordState = State<ResetPasswordContext, AuthEvent>;
|
|
126
255
|
declare type AuthActorContext = ActorContextWithForms | SignOutContext;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
interface CognitoAttributes {
|
|
133
|
-
email: string;
|
|
134
|
-
phone_number: string;
|
|
135
|
-
[key: string]: string;
|
|
136
|
-
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Events that occur when actors are done
|
|
259
|
+
*/
|
|
137
260
|
declare type InvokeActorEventTypes = 'done.invoke.signInActor' | 'done.invoke.signUpActor' | 'done.invoke.signOutActor' | 'done.invoke.resetPasswordActor';
|
|
261
|
+
/**
|
|
262
|
+
* All known explicit events for xstate
|
|
263
|
+
*/
|
|
138
264
|
declare type AuthEventTypes = 'CHANGE' | 'BLUR' | 'FEDERATED_SIGN_IN' | 'RESEND' | 'RESET_PASSWORD' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'SKIP' | 'SUBMIT' | 'INIT' | InvokeActorEventTypes;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
NEW_PASSWORD_REQUIRED = "NEW_PASSWORD_REQUIRED",
|
|
143
|
-
RESET_REQUIRED = "RESET_REQUIRED",
|
|
144
|
-
MFA_SETUP = "MFA_SETUP"
|
|
145
|
-
}
|
|
146
|
-
interface InputAttributes {
|
|
147
|
-
label: string;
|
|
148
|
-
type: string;
|
|
149
|
-
placeholder: string;
|
|
150
|
-
autocomplete?: string;
|
|
151
|
-
}
|
|
152
|
-
declare const LoginMechanismArray: readonly ["username", "email", "phone_number"];
|
|
153
|
-
declare type CommonFields = 'username' | 'password' | 'confirm_password';
|
|
154
|
-
declare type LoginMechanism = typeof LoginMechanismArray[number];
|
|
155
|
-
declare type SocialProvider = 'amazon' | 'apple' | 'facebook' | 'google';
|
|
156
|
-
declare type formFieldComponents = 'signIn' | 'signUp' | 'forceNewPassword' | 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'resetPassword' | 'setupTOTP';
|
|
157
|
-
declare type FormFields = {
|
|
158
|
-
[key in formFieldComponents]?: formField;
|
|
159
|
-
};
|
|
160
|
-
interface formField {
|
|
161
|
-
[key: string]: formFieldTypes;
|
|
162
|
-
}
|
|
163
|
-
interface formFieldTypes {
|
|
164
|
-
labelHidden?: boolean;
|
|
165
|
-
label?: string;
|
|
166
|
-
placeholder?: string;
|
|
167
|
-
/**
|
|
168
|
-
* @deprecated Internal use only, please use `isRequired` instead.
|
|
169
|
-
*/
|
|
170
|
-
required?: boolean;
|
|
171
|
-
isRequired?: boolean;
|
|
172
|
-
dialCode?: string;
|
|
173
|
-
totpIssuer?: string;
|
|
174
|
-
totpUsername?: string;
|
|
175
|
-
dialCodeList?: Array<string>;
|
|
176
|
-
order?: number;
|
|
177
|
-
}
|
|
178
|
-
declare type AuthFieldsWithDefaults = LoginMechanism | SignUpFieldsWithDefaults | 'confirmation_code' | 'password';
|
|
179
|
-
declare type AuthInputAttributes = Record<AuthFieldsWithDefaults, InputAttributes>;
|
|
265
|
+
/**
|
|
266
|
+
* Data payload for auth events
|
|
267
|
+
*/
|
|
180
268
|
declare type AuthEventData = Record<PropertyKey, any>;
|
|
269
|
+
/** Top-level auth machine event interface */
|
|
181
270
|
interface AuthEvent {
|
|
182
271
|
type: AuthEventTypes;
|
|
183
272
|
data?: AuthEventData;
|
|
184
273
|
}
|
|
185
|
-
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* This files provides types that describe general shape of
|
|
277
|
+
* authenticator machine and its intepreter.
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Intefrace for `authMachine` machine interpreter
|
|
282
|
+
*/
|
|
186
283
|
declare type AuthInterpreter = Interpreter<AuthContext, any, AuthEvent>;
|
|
284
|
+
/**
|
|
285
|
+
* Function type for `send` in `authMachine`
|
|
286
|
+
*/
|
|
187
287
|
declare type AuthMachineSend = AuthInterpreter['send'];
|
|
188
288
|
|
|
289
|
+
declare type SignInState = State<SignInContext, AuthEvent>;
|
|
290
|
+
declare type SignUpState = State<SignUpContext, AuthEvent>;
|
|
291
|
+
declare type SignOutState = State<SignOutContext, AuthEvent>;
|
|
292
|
+
declare type ResetPasswordState = State<ResetPasswordContext, AuthEvent>;
|
|
293
|
+
declare type AuthActorState = State<AuthActorContext, AuthEvent>;
|
|
294
|
+
declare type AuthMachineState = State<AuthContext, AuthEvent>;
|
|
295
|
+
|
|
189
296
|
declare type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
190
297
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
298
|
+
/**
|
|
299
|
+
* This file contains helpers that lets you easily access current actor's state
|
|
300
|
+
* and context.
|
|
301
|
+
*/
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Get the state of current actor. This is useful for checking which screen
|
|
305
|
+
* to render: e.g. `getActorState(state).matches('confirmSignUp.edit').
|
|
306
|
+
*/
|
|
307
|
+
declare const getActorState: (state: AuthMachineState) => AuthActorState;
|
|
308
|
+
/**
|
|
309
|
+
* Get the context of current actor. Useful for getting any nested context
|
|
310
|
+
* like remoteError.
|
|
311
|
+
*/
|
|
312
|
+
declare const getActorContext: (state: AuthMachineState) => AuthActorContext;
|
|
313
|
+
|
|
198
314
|
/**
|
|
199
315
|
* Given xstate context from AuthMachine, this returns the input label, type,
|
|
200
316
|
* and error attributes of the configured login_mechanisms. An optional "alias"
|
|
@@ -210,19 +326,10 @@ declare const getAliasInfoFromContext: (context: AuthContext, alias?: LoginMecha
|
|
|
210
326
|
* secondaryAliases.
|
|
211
327
|
*/
|
|
212
328
|
declare const getConfiguredAliases: (context: AuthContext) => {
|
|
213
|
-
primaryAlias: "
|
|
214
|
-
secondaryAliases: ("
|
|
329
|
+
primaryAlias: "email" | "phone_number" | "username";
|
|
330
|
+
secondaryAliases: ("email" | "phone_number" | "username")[];
|
|
215
331
|
};
|
|
216
|
-
|
|
217
|
-
* Get the state of current actor. This is useful for checking which screen
|
|
218
|
-
* to render: e.g. `getActorState(state).matches('confirmSignUp.edit').
|
|
219
|
-
*/
|
|
220
|
-
declare const getActorState: (state: AuthMachineState) => AuthActorState;
|
|
221
|
-
/**
|
|
222
|
-
* Get the context of current actor. Useful for getting any nested context
|
|
223
|
-
* like remoteError.
|
|
224
|
-
*/
|
|
225
|
-
declare const getActorContext: (state: AuthMachineState) => AuthActorContext;
|
|
332
|
+
|
|
226
333
|
/**
|
|
227
334
|
* Creates public facing auth helpers that abstracts out xstate implementation
|
|
228
335
|
* detail. Each framework implementation can export these helpers so that
|
|
@@ -253,7 +360,7 @@ declare const getServiceContextFacade: (state: AuthMachineState) => {
|
|
|
253
360
|
route: string;
|
|
254
361
|
user: CognitoUserAmplify;
|
|
255
362
|
validationErrors: {
|
|
256
|
-
[x: string]: string;
|
|
363
|
+
[x: string]: string | string[];
|
|
257
364
|
};
|
|
258
365
|
codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
|
|
259
366
|
};
|
|
@@ -267,7 +374,7 @@ declare const getServiceFacade: ({ send, state }: {
|
|
|
267
374
|
route: string;
|
|
268
375
|
user: CognitoUserAmplify;
|
|
269
376
|
validationErrors: {
|
|
270
|
-
[x: string]: string;
|
|
377
|
+
[x: string]: string | string[];
|
|
271
378
|
};
|
|
272
379
|
codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
|
|
273
380
|
resendCode: (data?: AuthEventData) => void;
|
|
@@ -281,6 +388,24 @@ declare const getServiceFacade: ({ send, state }: {
|
|
|
281
388
|
toSignUp: (data?: AuthEventData) => void;
|
|
282
389
|
skipVerification: (data?: AuthEventData) => void;
|
|
283
390
|
};
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* This file contains helpers related to forms and input attributes.
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
declare const authInputAttributes: AuthInputAttributes;
|
|
397
|
+
declare const getFormDataFromEvent: (event: Event) => {
|
|
398
|
+
[k: string]: FormDataEntryValue;
|
|
399
|
+
};
|
|
400
|
+
declare const setFormOrder: (formOverrides: FormField, fieldNames: Array<SignUpAttribute | CommonFields>) => Array<string | number>;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* This file contains general helpers that state machine or authenticator
|
|
404
|
+
* implementations can use.
|
|
405
|
+
*/
|
|
406
|
+
|
|
407
|
+
declare const censorAllButFirstAndLast: (value: string) => string;
|
|
408
|
+
declare const censorPhoneNumber: (val: string) => string;
|
|
284
409
|
/**
|
|
285
410
|
* Listens to external auth Hub events and sends corresponding event to
|
|
286
411
|
* the `authService` of interest
|
|
@@ -291,14 +416,6 @@ declare const getServiceFacade: ({ send, state }: {
|
|
|
291
416
|
*/
|
|
292
417
|
declare const listenToAuthHub: (send: AuthMachineSend) => () => void;
|
|
293
418
|
|
|
294
|
-
declare type ContactMethod = 'Email' | 'Phone Number';
|
|
295
|
-
declare const censorAllButFirstAndLast: (value: string) => string;
|
|
296
|
-
declare const censorPhoneNumber: (val: string) => string;
|
|
297
|
-
declare const getFormDataFromEvent: (event: Event) => {
|
|
298
|
-
[k: string]: FormDataEntryValue;
|
|
299
|
-
};
|
|
300
|
-
declare const setFormOrder: (formOverrides: formField, fieldNames: Array<SignUpAttribute | CommonFields>) => Array<string | number>;
|
|
301
|
-
|
|
302
419
|
declare const countryDialCodes: string[];
|
|
303
420
|
|
|
304
421
|
/**
|
|
@@ -671,7 +788,7 @@ declare type WebShadows = {
|
|
|
671
788
|
[Property in keyof Shadows]: WebDesignToken<ShadowValue>;
|
|
672
789
|
};
|
|
673
790
|
|
|
674
|
-
declare type
|
|
791
|
+
declare type SpaceSizes = {
|
|
675
792
|
xxxs: DesignToken<SpaceValue>;
|
|
676
793
|
xxs: DesignToken<SpaceValue>;
|
|
677
794
|
xs: DesignToken<SpaceValue>;
|
|
@@ -681,16 +798,11 @@ declare type Space = {
|
|
|
681
798
|
xl: DesignToken<SpaceValue>;
|
|
682
799
|
xxl: DesignToken<SpaceValue>;
|
|
683
800
|
xxxl: DesignToken<SpaceValue>;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
medium: DesignToken<SpaceValue>;
|
|
690
|
-
large: DesignToken<SpaceValue>;
|
|
691
|
-
xl: DesignToken<SpaceValue>;
|
|
692
|
-
xxl: DesignToken<SpaceValue>;
|
|
693
|
-
xxxl: DesignToken<SpaceValue>;
|
|
801
|
+
};
|
|
802
|
+
declare type Space = SpaceSizes & {
|
|
803
|
+
zero: DesignToken<SpaceValue>;
|
|
804
|
+
relative: SpaceSizes & {
|
|
805
|
+
full: DesignToken<SpaceValue>;
|
|
694
806
|
};
|
|
695
807
|
};
|
|
696
808
|
declare type WebSpace = {
|
|
@@ -891,4 +1003,4 @@ declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
|
|
|
891
1003
|
|
|
892
1004
|
declare const defaultTheme: WebTheme;
|
|
893
1005
|
|
|
894
|
-
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,
|
|
1006
|
+
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, PasswordPolicyRules, PasswordSettings, 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 };
|