@aws-amplify/ui 6.12.1 → 6.13.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.
@@ -61,11 +61,18 @@ const getSignUpInput = (username, formValues, loginMechanism) => {
61
61
  return { username, password, options };
62
62
  };
63
63
  const getUsernameSignUp = ({ formValues, loginMechanisms, }) => {
64
+ // When 'username' is in loginMechanisms, always use the username field for the Username parameter.
65
+ // This handles both username-only mode and alias mode (username + email/phone as sign-in options).
66
+ // See: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases
67
+ if (loginMechanisms.includes('username')) {
68
+ return formValues.username;
69
+ }
64
70
  const loginMechanism = loginMechanisms[0];
65
71
  if (loginMechanism === 'phone_number') {
66
72
  const { country_code, phone_number } = formValues;
67
73
  return sanitizePhoneNumber(country_code, phone_number);
68
74
  }
75
+ // Otherwise, use the primary login mechanism (email as username)
69
76
  return formValues[loginMechanism];
70
77
  };
71
78
 
package/dist/index.js CHANGED
@@ -4177,11 +4177,18 @@ const getSignUpInput = (username, formValues, loginMechanism) => {
4177
4177
  return { username, password, options };
4178
4178
  };
4179
4179
  const getUsernameSignUp = ({ formValues, loginMechanisms, }) => {
4180
+ // When 'username' is in loginMechanisms, always use the username field for the Username parameter.
4181
+ // This handles both username-only mode and alias mode (username + email/phone as sign-in options).
4182
+ // See: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases
4183
+ if (loginMechanisms.includes('username')) {
4184
+ return formValues.username;
4185
+ }
4180
4186
  const loginMechanism = loginMechanisms[0];
4181
4187
  if (loginMechanism === 'phone_number') {
4182
4188
  const { country_code, phone_number } = formValues;
4183
4189
  return sanitizePhoneNumber(country_code, phone_number);
4184
4190
  }
4191
+ // Otherwise, use the primary login mechanism (email as username)
4185
4192
  return formValues[loginMechanism];
4186
4193
  };
4187
4194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui",
3
- "version": "6.12.1",
3
+ "version": "6.13.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -62,7 +62,7 @@
62
62
  "@types/lodash": "^4.14.170",
63
63
  "@types/webpack-env": "^1.16.2",
64
64
  "autoprefixer": "^10.3.1",
65
- "glob": "^10.3.10",
65
+ "glob": "^10.5.0",
66
66
  "postcss": "^8.4.31",
67
67
  "sass": "^1.35.2",
68
68
  "style-dictionary": "3.9.1"
@@ -70,4 +70,4 @@
70
70
  "sideEffects": [
71
71
  "dist/**/*.css"
72
72
  ]
73
- }
73
+ }