@aws-amplify/ui-angular 2.4.19 → 2.4.20

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 (23) hide show
  1. package/aws-amplify-ui-angular.metadata.json +1 -1
  2. package/bundles/aws-amplify-ui-angular.umd.js +27 -19
  3. package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
  4. package/bundles/aws-amplify-ui-angular.umd.min.js +1 -1
  5. package/bundles/aws-amplify-ui-angular.umd.min.js.map +1 -1
  6. package/esm2015/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.js +4 -4
  7. package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +9 -8
  8. package/esm2015/lib/services/authenticator.service.js +1 -1
  9. package/fesm2015/aws-amplify-ui-angular.js +10 -9
  10. package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
  11. package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +11 -15
  12. package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +10 -14
  13. package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +10 -14
  14. package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +10 -14
  15. package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +10 -14
  16. package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +10 -14
  17. package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +10 -14
  18. package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +12 -17
  19. package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +10 -14
  20. package/lib/components/authenticator/components/sign-up/sign-up.component.d.ts +10 -14
  21. package/lib/components/authenticator/components/verify-user/verify-user.component.d.ts +10 -14
  22. package/lib/services/authenticator.service.d.ts +15 -25
  23. package/package.json +2 -2
@@ -536,10 +536,10 @@
536
536
  var actorContext = ui.getActorContext(state);
537
537
  var challengeName = actorContext.challengeName;
538
538
  switch (challengeName) {
539
- case ui.AuthChallengeNames.SOFTWARE_TOKEN_MFA:
539
+ case 'SOFTWARE_TOKEN_MFA':
540
540
  this.headerText = ui.translate('Confirm TOTP Code');
541
541
  break;
542
- case ui.AuthChallengeNames.SMS_MFA:
542
+ case 'SMS_MFA':
543
543
  this.headerText = ui.translate('Confirm SMS Code');
544
544
  break;
545
545
  default:
@@ -1240,7 +1240,16 @@
1240
1240
  this.confirmText = ui.translate('Confirm');
1241
1241
  }
1242
1242
  SetupTotpComponent.prototype.ngOnInit = function () {
1243
- this.generateQRCode();
1243
+ return __awaiter(this, void 0, void 0, function () {
1244
+ return __generator(this, function (_c) {
1245
+ switch (_c.label) {
1246
+ case 0: return [4 /*yield*/, this.generateQRCode()];
1247
+ case 1:
1248
+ _c.sent();
1249
+ return [2 /*return*/];
1250
+ }
1251
+ });
1252
+ });
1244
1253
  };
1245
1254
  Object.defineProperty(SetupTotpComponent.prototype, "context", {
1246
1255
  get: function () {
@@ -1250,33 +1259,32 @@
1250
1259
  configurable: true
1251
1260
  });
1252
1261
  SetupTotpComponent.prototype.generateQRCode = function () {
1253
- var _a, _b, _c, _d, _e, _f;
1262
+ var _a, _b;
1254
1263
  return __awaiter(this, void 0, void 0, function () {
1255
- var state, actorContext, user, _g, issuer, username, totpCode, _h, err_1;
1256
- return __generator(this, function (_j) {
1257
- switch (_j.label) {
1264
+ var state, actorContext, user, formFields, _c, _d, totpIssuer, _e, totpUsername, _f, totpCode, _g, err_1;
1265
+ return __generator(this, function (_h) {
1266
+ switch (_h.label) {
1258
1267
  case 0:
1259
1268
  state = this.authenticator.authState;
1260
1269
  actorContext = ui.getActorContext(state);
1261
- user = actorContext.user;
1262
- _j.label = 1;
1270
+ user = actorContext.user, formFields = actorContext.formFields;
1271
+ _c = (_b = (_a = formFields === null || formFields === void 0 ? void 0 : formFields.setupTOTP) === null || _a === void 0 ? void 0 : _a.QR) !== null && _b !== void 0 ? _b : {}, _d = _c.totpIssuer, totpIssuer = _d === void 0 ? 'AWSCognito' : _d, _e = _c.totpUsername, totpUsername = _e === void 0 ? user === null || user === void 0 ? void 0 : user.username : _e;
1272
+ _h.label = 1;
1263
1273
  case 1:
1264
- _j.trys.push([1, 4, , 5]);
1265
- _g = this;
1274
+ _h.trys.push([1, 4, , 5]);
1275
+ _f = this;
1266
1276
  return [4 /*yield*/, awsAmplify.Auth.setupTOTP(user)];
1267
1277
  case 2:
1268
- _g.secretKey = _j.sent();
1269
- issuer = (_c = (_b = (_a = this.formOverrides) === null || _a === void 0 ? void 0 : _a['QR']) === null || _b === void 0 ? void 0 : _b.totpIssuer) !== null && _c !== void 0 ? _c : 'AWSCognito';
1270
- username = (_f = (_e = (_d = this.formOverrides) === null || _d === void 0 ? void 0 : _d['QR']) === null || _e === void 0 ? void 0 : _e.totpUsername) !== null && _f !== void 0 ? _f : user.username;
1271
- totpCode = encodeURI("otpauth://totp/" + issuer + ":" + username + "?secret=" + this.secretKey + "&issuer=" + issuer);
1278
+ _f.secretKey = _h.sent();
1279
+ totpCode = ui.getTotpCode(totpIssuer, totpUsername, this.secretKey);
1272
1280
  logger.info('totp code was generated:', totpCode);
1273
- _h = this;
1281
+ _g = this;
1274
1282
  return [4 /*yield*/, QRCode__default["default"].toDataURL(totpCode)];
1275
1283
  case 3:
1276
- _h.qrCodeSource = _j.sent();
1284
+ _g.qrCodeSource = _h.sent();
1277
1285
  return [3 /*break*/, 5];
1278
1286
  case 4:
1279
- err_1 = _j.sent();
1287
+ err_1 = _h.sent();
1280
1288
  logger.error(err_1);
1281
1289
  return [3 /*break*/, 5];
1282
1290
  case 5: return [2 /*return*/];
@@ -1286,7 +1294,7 @@
1286
1294
  };
1287
1295
  SetupTotpComponent.prototype.onInput = function (event) {
1288
1296
  event.preventDefault();
1289
- var _g = event.target, name = _g.name, value = _g.value;
1297
+ var _c = event.target, name = _c.name, value = _c.value;
1290
1298
  this.authenticator.updateForm({ name: name, value: value });
1291
1299
  };
1292
1300
  SetupTotpComponent.prototype.onSubmit = function (event) {