@aws-amplify/ui-angular 2.4.17 → 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 (25) hide show
  1. package/aws-amplify-ui-angular.metadata.json +1 -1
  2. package/bundles/aws-amplify-ui-angular.umd.js +29 -21
  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/primitives/error/error.component.js +2 -2
  9. package/esm2015/lib/primitives/phone-number-field/phone-number-field.component.js +2 -2
  10. package/esm2015/lib/services/authenticator.service.js +1 -1
  11. package/fesm2015/aws-amplify-ui-angular.js +12 -11
  12. package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
  13. package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +11 -15
  14. package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +10 -14
  15. package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +10 -14
  16. package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +10 -14
  17. package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +10 -14
  18. package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +10 -14
  19. package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +10 -14
  20. package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +12 -17
  21. package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +10 -14
  22. package/lib/components/authenticator/components/sign-up/sign-up.component.d.ts +10 -14
  23. package/lib/components/authenticator/components/verify-user/verify-user.component.d.ts +10 -14
  24. package/lib/services/authenticator.service.d.ts +15 -25
  25. package/package.json +3 -3
@@ -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) {
@@ -1625,7 +1633,7 @@
1625
1633
  ErrorComponent.decorators = [
1626
1634
  { type: i0.Component, args: [{
1627
1635
  selector: 'amplify-error',
1628
- template: "<div\n class=\"amplify-flex amplify-alert amplify-alert--error\"\n data-variation=\"error\"\n style=\"align-items: center; justify-content: space-between\"\n *ngIf=\"isVisible\"\n role=\"alert\"\n>\n <div class=\"amplify-flex\" style=\"align-items: center\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path\n d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"\n ></path>\n </svg>\n <div><ng-content></ng-content></div>\n </div>\n <button\n amplify-button\n class=\"amplify-field-group__control amplify-alert__dismiss\"\n [attr.aria-label]=\"dismissAriaLabel\"\n variation=\"link\"\n [fullWidth]=\"false\"\n (click)=\"close()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"\n ></path>\n </svg>\n </button>\n</div>\n"
1636
+ template: "<div\n class=\"amplify-flex amplify-alert amplify-alert--error\"\n data-variation=\"error\"\n style=\"align-items: center; justify-content: space-between\"\n *ngIf=\"isVisible\"\n role=\"alert\"\n>\n <div class=\"amplify-flex\" style=\"align-items: center\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n [attr.aria-hidden]=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path\n d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\"\n ></path>\n </svg>\n <div><ng-content></ng-content></div>\n </div>\n <button\n amplify-button\n class=\"amplify-field-group__control amplify-alert__dismiss\"\n [attr.aria-label]=\"dismissAriaLabel\"\n variation=\"link\"\n [fullWidth]=\"false\"\n (click)=\"close()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"amplify-icon\"\n [attr.aria-hidden]=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n >\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"\n ></path>\n </svg>\n </button>\n</div>\n"
1629
1637
  },] }
1630
1638
  ];
1631
1639
 
@@ -1696,7 +1704,7 @@
1696
1704
  PhoneNumberFieldComponent.decorators = [
1697
1705
  { type: i0.Component, args: [{
1698
1706
  selector: 'amplify-phone-number-field',
1699
- template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"textFieldId\"\n>\n {{ label }}\n</label>\n<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\"\n amplify-flex amplify-field amplify-selectfield amplify-countrycodeselect\n \"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"countryDialCodesValues\"\n [defaultValue]=\"defaultCountryCode\"\n ></amplify-form-select>\n </div>\n </div>\n\n <input\n class=\"amplify-input\"\n [id]=\"textFieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [autocomplete]=\"autocomplete\"\n [attr.disabled]=\"disabled ? '' : null\"\n [attr.aria-invalid]=\"hasError ? 'true' : 'false'\"\n [attr.aria-describedby]=\"describedBy\"\n />\n</div>\n"
1707
+ template: "<label\n class=\"amplify-label\"\n [class.amplify-visually-hidden]=\"labelHidden\"\n [for]=\"textFieldId\"\n>\n {{ label }}\n</label>\n<div\n class=\"amplify-flex amplify-phonenumberfield\"\n amplify-field-group\n style=\"gap: 0px\"\n>\n <div class=\"amplify-field-group__outer-start\">\n <div\n class=\"\n amplify-flex\n amplify-field\n amplify-selectfield\n amplify-countrycodeselect\n amplify-dialcodeselect\n \"\n style=\"flex-direction: column\"\n >\n <amplify-form-select\n name=\"country_code\"\n label=\"Country Code\"\n [id]=\"selectFieldId\"\n [items]=\"countryDialCodesValues\"\n [defaultValue]=\"defaultCountryCode\"\n ></amplify-form-select>\n </div>\n </div>\n\n <input\n class=\"amplify-input\"\n [id]=\"textFieldId\"\n [type]=\"type\"\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [value]=\"initialValue\"\n [autocomplete]=\"autocomplete\"\n [attr.disabled]=\"disabled ? '' : null\"\n [attr.aria-invalid]=\"hasError ? 'true' : 'false'\"\n [attr.aria-describedby]=\"describedBy\"\n />\n</div>\n"
1700
1708
  },] }
1701
1709
  ];
1702
1710
  PhoneNumberFieldComponent.propDecorators = {