@aws-amplify/ui 6.9.1 → 6.10.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.
Files changed (42) hide show
  1. package/dist/esm/helpers/authenticator/facade.mjs +4 -2
  2. package/dist/esm/helpers/authenticator/formFields/defaults.mjs +4 -0
  3. package/dist/esm/helpers/authenticator/getRoute.mjs +4 -0
  4. package/dist/esm/helpers/authenticator/textUtil.mjs +30 -0
  5. package/dist/esm/i18n/dictionaries/authenticator/de.mjs +8 -0
  6. package/dist/esm/i18n/dictionaries/authenticator/defaultTexts.mjs +8 -0
  7. package/dist/esm/i18n/dictionaries/authenticator/en.mjs +8 -0
  8. package/dist/esm/i18n/dictionaries/authenticator/es.mjs +8 -0
  9. package/dist/esm/i18n/dictionaries/authenticator/fr.mjs +8 -0
  10. package/dist/esm/i18n/dictionaries/authenticator/he.mjs +8 -0
  11. package/dist/esm/i18n/dictionaries/authenticator/id.mjs +8 -0
  12. package/dist/esm/i18n/dictionaries/authenticator/it.mjs +8 -0
  13. package/dist/esm/i18n/dictionaries/authenticator/ja.mjs +8 -0
  14. package/dist/esm/i18n/dictionaries/authenticator/kr.mjs +8 -0
  15. package/dist/esm/i18n/dictionaries/authenticator/nb.mjs +8 -0
  16. package/dist/esm/i18n/dictionaries/authenticator/nl.mjs +8 -0
  17. package/dist/esm/i18n/dictionaries/authenticator/pl.mjs +8 -0
  18. package/dist/esm/i18n/dictionaries/authenticator/pt.mjs +8 -0
  19. package/dist/esm/i18n/dictionaries/authenticator/ru.mjs +8 -0
  20. package/dist/esm/i18n/dictionaries/authenticator/sv.mjs +8 -0
  21. package/dist/esm/i18n/dictionaries/authenticator/th.mjs +8 -0
  22. package/dist/esm/i18n/dictionaries/authenticator/tr.mjs +9 -1
  23. package/dist/esm/i18n/dictionaries/authenticator/ua.mjs +8 -0
  24. package/dist/esm/i18n/dictionaries/authenticator/zh.mjs +8 -0
  25. package/dist/esm/machines/authenticator/actions.mjs +22 -5
  26. package/dist/esm/machines/authenticator/actors/signIn.mjs +53 -49
  27. package/dist/esm/machines/authenticator/actors/signUp.mjs +2 -0
  28. package/dist/esm/machines/authenticator/actors/utils.mjs +13 -1
  29. package/dist/esm/machines/authenticator/guards.mjs +8 -0
  30. package/dist/esm/machines/authenticator/index.mjs +2 -1
  31. package/dist/index.js +300 -57
  32. package/dist/types/helpers/authenticator/facade.d.ts +4 -2
  33. package/dist/types/helpers/authenticator/textUtil.d.ts +7 -1
  34. package/dist/types/i18n/dictionaries/authenticator/defaultTexts.d.ts +8 -0
  35. package/dist/types/i18n/dictionaries/index.d.ts +8 -0
  36. package/dist/types/i18n/translations.d.ts +8 -0
  37. package/dist/types/machines/authenticator/actors/signIn.d.ts +2 -3
  38. package/dist/types/machines/authenticator/actors/signUp.d.ts +2 -3
  39. package/dist/types/machines/authenticator/actors/utils.d.ts +2 -0
  40. package/dist/types/machines/authenticator/types.d.ts +6 -3
  41. package/dist/types/types/authenticator/form.d.ts +1 -1
  42. package/package.json +2 -2
@@ -40,6 +40,7 @@ const handleAutoSignInResponse = {
40
40
  'setChallengeName',
41
41
  'setMissingAttributes',
42
42
  'setTotpSecretCode',
43
+ 'setAllowedMfaTypes',
43
44
  ],
44
45
  target: '#signUpActor.resolved',
45
46
  },
@@ -243,6 +244,7 @@ function signUpActor({ services }) {
243
244
  totpSecretCode: context.totpSecretCode,
244
245
  username: context.username,
245
246
  unverifiedUserAttributes: context.unverifiedUserAttributes,
247
+ allowedMfaTypes: context.allowedMfaTypes,
246
248
  }),
247
249
  },
248
250
  },
@@ -6,5 +6,17 @@ const getFederatedSignInState = (target) => ({
6
6
  onError: { actions: 'setRemoteError', target },
7
7
  },
8
8
  });
9
+ const getConfirmSignInFormValuesKey = (signInStep) => {
10
+ if ([
11
+ 'CONTINUE_SIGN_IN_WITH_MFA_SELECTION',
12
+ 'CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION',
13
+ ].includes(signInStep)) {
14
+ return 'mfa_type';
15
+ }
16
+ if (signInStep === 'CONTINUE_SIGN_IN_WITH_EMAIL_SETUP') {
17
+ return 'email';
18
+ }
19
+ return 'confirmation_code';
20
+ };
9
21
 
10
- export { getFederatedSignInState };
22
+ export { getConfirmSignInFormValuesKey, getFederatedSignInState };
@@ -1,6 +1,7 @@
1
1
  const SIGN_IN_STEP_MFA_CONFIRMATION = [
2
2
  'CONFIRM_SIGN_IN_WITH_SMS_CODE',
3
3
  'CONFIRM_SIGN_IN_WITH_TOTP_CODE',
4
+ 'CONFIRM_SIGN_IN_WITH_EMAIL_CODE',
4
5
  ];
5
6
  // response next step guards
6
7
  const shouldConfirmSignInWithNewPassword = (_, { data }) => data?.nextStep.signInStep ===
@@ -20,6 +21,11 @@ const isConfirmSignUpStep = (_, { data }) => data?.step === 'CONFIRM_SIGN_UP';
20
21
  // actor entry guards read `step` from actor context
21
22
  const shouldConfirmSignIn = ({ step }) => SIGN_IN_STEP_MFA_CONFIRMATION.includes(step);
22
23
  const shouldSetupTotp = ({ step }) => step === 'CONTINUE_SIGN_IN_WITH_TOTP_SETUP';
24
+ const shouldSetupEmail = ({ step }) => step === 'CONTINUE_SIGN_IN_WITH_EMAIL_SETUP';
25
+ const shouldSelectMfaType = ({ step }) => [
26
+ 'CONTINUE_SIGN_IN_WITH_MFA_SELECTION',
27
+ 'CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION',
28
+ ].includes(step);
23
29
  const shouldResetPassword = ({ step }) => step === 'RESET_PASSWORD';
24
30
  const shouldConfirmResetPassword = ({ step }) => step === 'CONFIRM_RESET_PASSWORD_WITH_CODE';
25
31
  const shouldConfirmSignUp = ({ step }) => step === 'CONFIRM_SIGN_UP';
@@ -64,6 +70,8 @@ const GUARDS = {
64
70
  shouldResetPassword,
65
71
  shouldResetPasswordFromSignIn,
66
72
  shouldSetupTotp,
73
+ shouldSetupEmail,
74
+ shouldSelectMfaType,
67
75
  shouldVerifyAttribute,
68
76
  };
69
77
 
@@ -275,7 +275,7 @@ function createAuthenticatorMachine(options) {
275
275
  { cond: 'hasActor', actions: forwardTo(({ actorRef }) => actorRef) },
276
276
  ]),
277
277
  setActorDoneData: assign({
278
- actorDoneData: (context, event) => ({
278
+ actorDoneData: (_, event) => ({
279
279
  challengeName: event.data.challengeName,
280
280
  codeDeliveryDetails: event.data.codeDeliveryDetails,
281
281
  missingAttributes: event.data.missingAttributes,
@@ -284,6 +284,7 @@ function createAuthenticatorMachine(options) {
284
284
  step: event.data.step,
285
285
  totpSecretCode: event.data.totpSecretCode,
286
286
  unverifiedUserAttributes: event.data.unverifiedUserAttributes,
287
+ allowedMfaTypes: event.data.allowedMfaTypes,
287
288
  }),
288
289
  }),
289
290
  applyAmplifyConfig: assign({