@aws-amplify/ui 6.0.4 → 6.0.6

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.
@@ -7,7 +7,7 @@ import { isFunction } from '../../utils/utils.mjs';
7
7
  * Handles Amplify JS Auth hub events, by forwarding hub events as appropriate
8
8
  * xstate events.
9
9
  */
10
- const defaultAuthHubHandler = async ({ payload }, service, options) => {
10
+ const defaultAuthHubHandler = ({ payload }, service, options) => {
11
11
  const { event } = payload;
12
12
  const { send } = service;
13
13
  const { onSignIn, onSignOut } = options ?? {};
@@ -32,21 +32,17 @@ const defaultAuthHubHandler = async ({ payload }, service, options) => {
32
32
  }
33
33
  }
34
34
  };
35
- const getHubEventHandler = (service, handler) => (data) => {
36
- handler(data, service);
37
- };
38
35
  /**
39
36
  * Listens to external auth Hub events and sends corresponding event to
40
- * the `authService` of interest
41
- *
42
- * @param send - `send` function associated with the `authService` of interest
37
+ * the `service.send` of interest
43
38
  *
39
+ * @param service - contains state machine `send` function
40
+ * @param handler - auth event handler
44
41
  * @returns function that unsubscribes to the hub evenmt
45
42
  */
46
- const listenToAuthHub = (service,
47
- // angular passes its own `handler` param
48
- handler = defaultAuthHubHandler) => {
49
- return Hub.listen('auth', getHubEventHandler(service, handler), 'authenticator-hub-handler');
43
+ const listenToAuthHub = (service, handler = defaultAuthHubHandler) => {
44
+ const eventHandler = (data) => handler(data, service);
45
+ return Hub.listen('auth', eventHandler, 'authenticator-hub-handler');
50
46
  };
51
47
 
52
48
  export { defaultAuthHubHandler, listenToAuthHub };
@@ -10,6 +10,17 @@ import '../../helpers/accountSettings/utils.mjs';
10
10
 
11
11
  // Cognito does not allow a password length less then 8 characters
12
12
  const DEFAULT_COGNITO_PASSWORD_MIN_LENGTH = 8;
13
+ const isInvalidUserAtributes = (userAttributes) => Array.isArray(userAttributes);
14
+ const parseUserAttributes = (userAttributes) => {
15
+ if (!userAttributes) {
16
+ return undefined;
17
+ }
18
+ // `aws-amplify` versions <= 6.0.5 return an array of `userAttributes` rather than an object
19
+ if (isInvalidUserAtributes(userAttributes)) {
20
+ return Object.entries(userAttributes).map(([_, value]) => Object.keys(value)[0]);
21
+ }
22
+ return Object.keys(userAttributes);
23
+ };
13
24
  const defaultServices = {
14
25
  async getAmplifyConfig() {
15
26
  const result = Amplify.getConfig();
@@ -25,9 +36,7 @@ const defaultServices = {
25
36
  : keyValueArray[0];
26
37
  })
27
38
  : undefined;
28
- const parsedSignupAttributes = userAttributes
29
- ? Object.entries(userAttributes).map(([_key, value]) => Object.keys(value)[0])
30
- : undefined;
39
+ const parsedSignupAttributes = parseUserAttributes(userAttributes);
31
40
  const parsedSocialProviders = loginWith?.oauth?.providers
32
41
  ? loginWith.oauth.providers?.map((provider) => provider.toString().toLowerCase())
33
42
  : undefined;
package/dist/index.js CHANGED
@@ -408,7 +408,7 @@ const classNames = (...args) => {
408
408
  * Handles Amplify JS Auth hub events, by forwarding hub events as appropriate
409
409
  * xstate events.
410
410
  */
411
- const defaultAuthHubHandler = async ({ payload }, service, options) => {
411
+ const defaultAuthHubHandler = ({ payload }, service, options) => {
412
412
  const { event } = payload;
413
413
  const { send } = service;
414
414
  const { onSignIn, onSignOut } = options ?? {};
@@ -433,21 +433,17 @@ const defaultAuthHubHandler = async ({ payload }, service, options) => {
433
433
  }
434
434
  }
435
435
  };
436
- const getHubEventHandler = (service, handler) => (data) => {
437
- handler(data, service);
438
- };
439
436
  /**
440
437
  * Listens to external auth Hub events and sends corresponding event to
441
- * the `authService` of interest
442
- *
443
- * @param send - `send` function associated with the `authService` of interest
438
+ * the `service.send` of interest
444
439
  *
440
+ * @param service - contains state machine `send` function
441
+ * @param handler - auth event handler
445
442
  * @returns function that unsubscribes to the hub evenmt
446
443
  */
447
- const listenToAuthHub = (service,
448
- // angular passes its own `handler` param
449
- handler = defaultAuthHubHandler) => {
450
- return utils$1.Hub.listen('auth', getHubEventHandler(service, handler), 'authenticator-hub-handler');
444
+ const listenToAuthHub = (service, handler = defaultAuthHubHandler) => {
445
+ const eventHandler = (data) => handler(data, service);
446
+ return utils$1.Hub.listen('auth', eventHandler, 'authenticator-hub-handler');
451
447
  };
452
448
 
453
449
  const countryDialCodes = [
@@ -3611,6 +3607,17 @@ const runValidators = async (formData, touchData, passwordSettings, validators)
3611
3607
 
3612
3608
  // Cognito does not allow a password length less then 8 characters
3613
3609
  const DEFAULT_COGNITO_PASSWORD_MIN_LENGTH = 8;
3610
+ const isInvalidUserAtributes = (userAttributes) => Array.isArray(userAttributes);
3611
+ const parseUserAttributes = (userAttributes) => {
3612
+ if (!userAttributes) {
3613
+ return undefined;
3614
+ }
3615
+ // `aws-amplify` versions <= 6.0.5 return an array of `userAttributes` rather than an object
3616
+ if (isInvalidUserAtributes(userAttributes)) {
3617
+ return Object.entries(userAttributes).map(([_, value]) => Object.keys(value)[0]);
3618
+ }
3619
+ return Object.keys(userAttributes);
3620
+ };
3614
3621
  const defaultServices = {
3615
3622
  async getAmplifyConfig() {
3616
3623
  const result = awsAmplify.Amplify.getConfig();
@@ -3626,9 +3633,7 @@ const defaultServices = {
3626
3633
  : keyValueArray[0];
3627
3634
  })
3628
3635
  : undefined;
3629
- const parsedSignupAttributes = userAttributes
3630
- ? Object.entries(userAttributes).map(([_key, value]) => Object.keys(value)[0])
3631
- : undefined;
3636
+ const parsedSignupAttributes = parseUserAttributes(userAttributes);
3632
3637
  const parsedSocialProviders = loginWith?.oauth?.providers
3633
3638
  ? loginWith.oauth.providers?.map((provider) => provider.toString().toLowerCase())
3634
3639
  : undefined;
@@ -307,7 +307,7 @@
307
307
 
308
308
  .amplify-liveness-start-screen-warning {
309
309
  color: var(--amplify-colors-blue-90);
310
- background-color: var(--amplify-colors-blue-20);
310
+ background-color: var(--amplify-colors-blue-10);
311
311
  align-items: center;
312
312
  z-index: 3;
313
313
  }
@@ -349,13 +349,12 @@
349
349
 
350
350
  .amplify-liveness-popover {
351
351
  position: relative;
352
- cursor: pointer;
353
352
  }
354
353
 
355
354
  .amplify-liveness-popover__anchor {
356
355
  position: absolute;
357
356
  top: 26px;
358
- left: 3px;
357
+ left: 20px;
359
358
  z-index: 3;
360
359
  border-style: solid;
361
360
  border-width: 0 9px 9px 9px;
@@ -365,7 +364,7 @@
365
364
  .amplify-liveness-popover__anchor-secondary {
366
365
  position: absolute;
367
366
  top: 24px;
368
- left: 2px;
367
+ left: 19px;
369
368
  z-index: 2;
370
369
  border-style: solid;
371
370
  border-width: 0 10px 10px 10px;
@@ -378,6 +377,7 @@
378
377
  color: var(--amplify-colors-font-primary);
379
378
  flex-direction: row;
380
379
  font-size: var(--amplify-font-sizes-xs);
380
+ font-weight: var(--amplify-font-weights-normal);
381
381
  padding: var(--amplify-space-small);
382
382
  top: 33px;
383
383
  width: 240px;
@@ -308,7 +308,7 @@
308
308
 
309
309
  .amplify-liveness-start-screen-warning {
310
310
  color: var(--amplify-colors-blue-90);
311
- background-color: var(--amplify-colors-blue-20);
311
+ background-color: var(--amplify-colors-blue-10);
312
312
  align-items: center;
313
313
  z-index: 3;
314
314
  }
@@ -350,13 +350,12 @@
350
350
 
351
351
  .amplify-liveness-popover {
352
352
  position: relative;
353
- cursor: pointer;
354
353
  }
355
354
 
356
355
  .amplify-liveness-popover__anchor {
357
356
  position: absolute;
358
357
  top: 26px;
359
- left: 3px;
358
+ left: 20px;
360
359
  z-index: 3;
361
360
  border-style: solid;
362
361
  border-width: 0 9px 9px 9px;
@@ -366,7 +365,7 @@
366
365
  .amplify-liveness-popover__anchor-secondary {
367
366
  position: absolute;
368
367
  top: 24px;
369
- left: 2px;
368
+ left: 19px;
370
369
  z-index: 2;
371
370
  border-style: solid;
372
371
  border-width: 0 10px 10px 10px;
@@ -379,6 +378,7 @@
379
378
  color: var(--amplify-colors-font-primary);
380
379
  flex-direction: row;
381
380
  font-size: var(--amplify-font-sizes-xs);
381
+ font-weight: var(--amplify-font-weights-normal);
382
382
  padding: var(--amplify-space-small);
383
383
  top: 33px;
384
384
  width: 240px;
package/dist/styles.css CHANGED
@@ -4213,7 +4213,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4213
4213
 
4214
4214
  .amplify-liveness-start-screen-warning {
4215
4215
  color: var(--amplify-colors-blue-90);
4216
- background-color: var(--amplify-colors-blue-20);
4216
+ background-color: var(--amplify-colors-blue-10);
4217
4217
  align-items: center;
4218
4218
  z-index: 3;
4219
4219
  }
@@ -4255,13 +4255,12 @@ html[dir=rtl] .amplify-field-group__inner-start {
4255
4255
 
4256
4256
  .amplify-liveness-popover {
4257
4257
  position: relative;
4258
- cursor: pointer;
4259
4258
  }
4260
4259
 
4261
4260
  .amplify-liveness-popover__anchor {
4262
4261
  position: absolute;
4263
4262
  top: 26px;
4264
- left: 3px;
4263
+ left: 20px;
4265
4264
  z-index: 3;
4266
4265
  border-style: solid;
4267
4266
  border-width: 0 9px 9px 9px;
@@ -4271,7 +4270,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4271
4270
  .amplify-liveness-popover__anchor-secondary {
4272
4271
  position: absolute;
4273
4272
  top: 24px;
4274
- left: 2px;
4273
+ left: 19px;
4275
4274
  z-index: 2;
4276
4275
  border-style: solid;
4277
4276
  border-width: 0 10px 10px 10px;
@@ -4284,6 +4283,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4284
4283
  color: var(--amplify-colors-font-primary);
4285
4284
  flex-direction: row;
4286
4285
  font-size: var(--amplify-font-sizes-xs);
4286
+ font-weight: var(--amplify-font-weights-normal);
4287
4287
  padding: var(--amplify-space-small);
4288
4288
  top: 33px;
4289
4289
  width: 240px;
@@ -4214,7 +4214,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4214
4214
 
4215
4215
  .amplify-liveness-start-screen-warning {
4216
4216
  color: var(--amplify-colors-blue-90);
4217
- background-color: var(--amplify-colors-blue-20);
4217
+ background-color: var(--amplify-colors-blue-10);
4218
4218
  align-items: center;
4219
4219
  z-index: 3;
4220
4220
  }
@@ -4256,13 +4256,12 @@ html[dir=rtl] .amplify-field-group__inner-start {
4256
4256
 
4257
4257
  .amplify-liveness-popover {
4258
4258
  position: relative;
4259
- cursor: pointer;
4260
4259
  }
4261
4260
 
4262
4261
  .amplify-liveness-popover__anchor {
4263
4262
  position: absolute;
4264
4263
  top: 26px;
4265
- left: 3px;
4264
+ left: 20px;
4266
4265
  z-index: 3;
4267
4266
  border-style: solid;
4268
4267
  border-width: 0 9px 9px 9px;
@@ -4272,7 +4271,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4272
4271
  .amplify-liveness-popover__anchor-secondary {
4273
4272
  position: absolute;
4274
4273
  top: 24px;
4275
- left: 2px;
4274
+ left: 19px;
4276
4275
  z-index: 2;
4277
4276
  border-style: solid;
4278
4277
  border-width: 0 10px 10px 10px;
@@ -4285,6 +4284,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4285
4284
  color: var(--amplify-colors-font-primary);
4286
4285
  flex-direction: row;
4287
4286
  font-size: var(--amplify-font-sizes-xs);
4287
+ font-weight: var(--amplify-font-weights-normal);
4288
4288
  padding: var(--amplify-space-small);
4289
4289
  top: 33px;
4290
4290
  width: 240px;
@@ -6,10 +6,10 @@ import { AuthInterpreter, AuthMachineHubHandler } from './types';
6
6
  export declare const defaultAuthHubHandler: AuthMachineHubHandler;
7
7
  /**
8
8
  * Listens to external auth Hub events and sends corresponding event to
9
- * the `authService` of interest
10
- *
11
- * @param send - `send` function associated with the `authService` of interest
9
+ * the `service.send` of interest
12
10
  *
11
+ * @param service - contains state machine `send` function
12
+ * @param handler - auth event handler
13
13
  * @returns function that unsubscribes to the hub evenmt
14
14
  */
15
15
  export declare const listenToAuthHub: (service: AuthInterpreter, handler?: AuthMachineHubHandler) => import("@aws-amplify/core/dist/esm/Hub/types").StopListenerCallback;
@@ -23,4 +23,4 @@ export type AuthMachineSend = AuthInterpreter['send'];
23
23
  export type AuthMachineHubHandler = (data: HubCapsule<any, any>, service: AuthInterpreter, options?: {
24
24
  onSignIn?: (user: AuthUser) => void;
25
25
  onSignOut?: () => void;
26
- }) => Promise<void>;
26
+ }) => void;
@@ -1,9 +1,10 @@
1
+ import { UserAttributeKey } from 'aws-amplify/auth';
1
2
  import { confirmResetPassword, confirmSignIn, confirmSignUp, resetPassword, signIn, signUp } from 'aws-amplify/auth';
2
- import { AuthFormData, AuthTouchData, PasswordSettings, SignUpAttribute, SocialProvider, ValidatorResult } from '../../types';
3
+ import { AuthFormData, AuthTouchData, PasswordSettings, SocialProvider, ValidatorResult } from '../../types';
3
4
  export declare const defaultServices: {
4
5
  getAmplifyConfig(): Promise<{
5
6
  loginMechanisms: ("email" | "phone_number" | "username")[];
6
- signUpAttributes: SignUpAttribute[];
7
+ signUpAttributes: UserAttributeKey[];
7
8
  socialProviders: SocialProvider[];
8
9
  identityPoolId: string;
9
10
  allowGuestAccess?: boolean;
@@ -17,7 +18,7 @@ export declare const defaultServices: {
17
18
  passwordFormat?: never;
18
19
  } | {
19
20
  loginMechanisms: ("email" | "phone_number" | "username")[];
20
- signUpAttributes: SignUpAttribute[];
21
+ signUpAttributes: UserAttributeKey[];
21
22
  socialProviders: SocialProvider[];
22
23
  userPoolClientId: string;
23
24
  userPoolId: string;
@@ -48,7 +49,7 @@ export declare const defaultServices: {
48
49
  allowGuestAccess?: never;
49
50
  } | {
50
51
  loginMechanisms: ("email" | "phone_number" | "username")[];
51
- signUpAttributes: SignUpAttribute[];
52
+ signUpAttributes: UserAttributeKey[];
52
53
  socialProviders: SocialProvider[];
53
54
  identityPoolId: never;
54
55
  allowGuestAccess?: never;
@@ -62,7 +63,7 @@ export declare const defaultServices: {
62
63
  passwordFormat?: never;
63
64
  } | {
64
65
  loginMechanisms: ("email" | "phone_number" | "username")[];
65
- signUpAttributes: SignUpAttribute[];
66
+ signUpAttributes: UserAttributeKey[];
66
67
  socialProviders: SocialProvider[];
67
68
  identityPoolId: string;
68
69
  allowGuestAccess?: boolean;
@@ -76,7 +77,7 @@ export declare const defaultServices: {
76
77
  passwordFormat?: never;
77
78
  } | {
78
79
  loginMechanisms: ("email" | "phone_number" | "username")[];
79
- signUpAttributes: SignUpAttribute[];
80
+ signUpAttributes: UserAttributeKey[];
80
81
  socialProviders: SocialProvider[];
81
82
  userPoolClientId: never;
82
83
  userPoolId: never;
@@ -90,7 +91,7 @@ export declare const defaultServices: {
90
91
  allowGuestAccess?: never;
91
92
  } | {
92
93
  loginMechanisms: ("email" | "phone_number" | "username")[];
93
- signUpAttributes: SignUpAttribute[];
94
+ signUpAttributes: UserAttributeKey[];
94
95
  socialProviders: SocialProvider[];
95
96
  userPoolClientId: string;
96
97
  userPoolId: string;
@@ -121,7 +122,7 @@ export declare const defaultServices: {
121
122
  allowGuestAccess?: never;
122
123
  } | {
123
124
  loginMechanisms: ("email" | "phone_number" | "username")[];
124
- signUpAttributes: SignUpAttribute[];
125
+ signUpAttributes: UserAttributeKey[];
125
126
  socialProviders: SocialProvider[];
126
127
  userPoolClientId: never;
127
128
  userPoolId: never;
@@ -135,7 +136,7 @@ export declare const defaultServices: {
135
136
  allowGuestAccess?: boolean;
136
137
  } | {
137
138
  loginMechanisms: ("email" | "phone_number" | "username")[];
138
- signUpAttributes: SignUpAttribute[];
139
+ signUpAttributes: UserAttributeKey[];
139
140
  socialProviders: SocialProvider[];
140
141
  userPoolClientId: string;
141
142
  userPoolId: string;
@@ -166,7 +167,7 @@ export declare const defaultServices: {
166
167
  allowGuestAccess?: never;
167
168
  } | {
168
169
  loginMechanisms: ("email" | "phone_number" | "username")[];
169
- signUpAttributes: SignUpAttribute[];
170
+ signUpAttributes: UserAttributeKey[];
170
171
  socialProviders: SocialProvider[];
171
172
  userPoolClientId: string;
172
173
  userPoolId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui",
3
- "version": "6.0.4",
3
+ "version": "6.0.6",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {