@aws-amplify/ui-angular 3.2.5 → 3.2.7

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 (21) hide show
  1. package/bundles/aws-amplify-ui-angular.umd.js +24 -20
  2. package/bundles/aws-amplify-ui-angular.umd.js.map +1 -1
  3. package/esm2015/lib/components/authenticator/components/setup-totp/setup-totp.component.js +9 -11
  4. package/esm2015/lib/services/authenticator.service.js +5 -1
  5. package/esm2015/version.js +2 -2
  6. package/fesm2015/aws-amplify-ui-angular.js +13 -11
  7. package/fesm2015/aws-amplify-ui-angular.js.map +1 -1
  8. package/lib/components/authenticator/components/authenticator/authenticator.component.d.ts +1 -0
  9. package/lib/components/authenticator/components/confirm-reset-password/amplify-confirm-reset-password.component.d.ts +1 -0
  10. package/lib/components/authenticator/components/confirm-sign-in/confirm-sign-in.component.d.ts +1 -0
  11. package/lib/components/authenticator/components/confirm-sign-up/confirm-sign-up.component.d.ts +1 -0
  12. package/lib/components/authenticator/components/confirm-verify-user/amplify-confirm-verify-user.component.d.ts +1 -0
  13. package/lib/components/authenticator/components/force-new-password/force-new-password.component.d.ts +1 -0
  14. package/lib/components/authenticator/components/reset-password/reset-password.component.d.ts +1 -0
  15. package/lib/components/authenticator/components/setup-totp/setup-totp.component.d.ts +2 -1
  16. package/lib/components/authenticator/components/sign-in/sign-in.component.d.ts +1 -0
  17. package/lib/components/authenticator/components/sign-up/sign-up.component.d.ts +1 -0
  18. package/lib/components/authenticator/components/verify-user/verify-user.component.d.ts +1 -0
  19. package/lib/services/authenticator.service.d.ts +2 -0
  20. package/package.json +2 -2
  21. package/version.d.ts +1 -1
@@ -408,7 +408,7 @@
408
408
  }]
409
409
  }] });
410
410
 
411
- var VERSION = '3.2.5';
411
+ var VERSION = '3.2.7';
412
412
 
413
413
  var logger$1 = new core.Logger('state-machine');
414
414
  /**
@@ -500,6 +500,14 @@
500
500
  enumerable: false,
501
501
  configurable: true
502
502
  });
503
+ Object.defineProperty(AuthenticatorService.prototype, "totpSecretCode", {
504
+ get: function () {
505
+ var _a;
506
+ return (_a = this._facade) === null || _a === void 0 ? void 0 : _a.totpSecretCode;
507
+ },
508
+ enumerable: false,
509
+ configurable: true
510
+ });
503
511
  Object.defineProperty(AuthenticatorService.prototype, "initializeMachine", {
504
512
  /**
505
513
  * Service facades
@@ -1423,7 +1431,7 @@
1423
1431
  this.dataAttr = '';
1424
1432
  this.headerText = getSetupTOTPText();
1425
1433
  this.qrCodeSource = '';
1426
- this.secretKey = '';
1434
+ this.totpSecretCode = '';
1427
1435
  this.copyTextLabel = getCopyText();
1428
1436
  // translated texts
1429
1437
  this.backToSignInText = getBackToSignInText$3();
@@ -1451,33 +1459,29 @@
1451
1459
  SetupTotpComponent.prototype.generateQRCode = function () {
1452
1460
  var _a, _b;
1453
1461
  return __awaiter(this, void 0, void 0, function () {
1454
- var state, actorContext, user, formFields, _c, _d, totpIssuer, _e, totpUsername, _f, totpCode, _g, err_1;
1462
+ var _c, state, totpSecretCode, user, formFields, _d, _e, totpIssuer, _f, totpUsername, totpCode, _g, err_1;
1455
1463
  return __generator(this, function (_h) {
1456
1464
  switch (_h.label) {
1457
1465
  case 0:
1458
- state = this.authenticator.authState;
1459
- actorContext = ui.getActorContext(state);
1460
- user = actorContext.user, formFields = actorContext.formFields;
1461
- _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;
1466
+ _c = this.authenticator, state = _c.authState, totpSecretCode = _c.totpSecretCode, user = _c.user;
1467
+ formFields = ui.getActorContext(state).formFields;
1468
+ _d = (_b = (_a = formFields === null || formFields === void 0 ? void 0 : formFields.setupTOTP) === null || _a === void 0 ? void 0 : _a.QR) !== null && _b !== void 0 ? _b : {}, _e = _d.totpIssuer, totpIssuer = _e === void 0 ? 'AWSCognito' : _e, _f = _d.totpUsername, totpUsername = _f === void 0 ? user === null || user === void 0 ? void 0 : user.username : _f;
1469
+ this.totpSecretCode = totpSecretCode;
1462
1470
  _h.label = 1;
1463
1471
  case 1:
1464
- _h.trys.push([1, 4, , 5]);
1465
- _f = this;
1466
- return [4 /*yield*/, awsAmplify.Auth.setupTOTP(user)];
1467
- case 2:
1468
- _f.secretKey = _h.sent();
1469
- totpCode = ui.getTotpCodeURL(totpIssuer, totpUsername, this.secretKey);
1472
+ _h.trys.push([1, 3, , 4]);
1473
+ totpCode = ui.getTotpCodeURL(totpIssuer, totpUsername, this.totpSecretCode);
1470
1474
  logger.info('totp code was generated:', totpCode);
1471
1475
  _g = this;
1472
1476
  return [4 /*yield*/, QRCode__default["default"].toDataURL(totpCode)];
1473
- case 3:
1477
+ case 2:
1474
1478
  _g.qrCodeSource = _h.sent();
1475
- return [3 /*break*/, 5];
1476
- case 4:
1479
+ return [3 /*break*/, 4];
1480
+ case 3:
1477
1481
  err_1 = _h.sent();
1478
1482
  logger.error(err_1);
1479
- return [3 /*break*/, 5];
1480
- case 5: return [2 /*return*/];
1483
+ return [3 /*break*/, 4];
1484
+ case 4: return [2 /*return*/];
1481
1485
  }
1482
1486
  });
1483
1487
  });
@@ -1492,13 +1496,13 @@
1492
1496
  this.authenticator.submitForm(ui.getFormDataFromEvent(event));
1493
1497
  };
1494
1498
  SetupTotpComponent.prototype.copyText = function () {
1495
- navigator.clipboard.writeText(this.secretKey);
1499
+ navigator.clipboard.writeText(this.totpSecretCode);
1496
1500
  this.copyTextLabel = getCopiedText();
1497
1501
  };
1498
1502
  return SetupTotpComponent;
1499
1503
  }());
1500
1504
  SetupTotpComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SetupTotpComponent, deps: [{ token: AuthenticatorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1501
- SetupTotpComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SetupTotpComponent, selector: "amplify-setup-totp", host: { properties: { "attr.data-amplify-authenticator-setup-totp": "this.dataAttr" } }, ngImport: i0__namespace, template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex amplify-authenticator__column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading amplify-heading--3\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <div class=\"amplify-flex\" data-amplify-copy>\n <div>{{ secretKey }}</div>\n <div data-amplify-copy-svg (click)=\"copyText()\">\n <div data-amplify-copy-tooltip>{{ copyTextLabel }}</div>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z\"\n />\n </svg>\n </div>\n </div>\n\n <amplify-base-form-fields route=\"setupTOTP\"></amplify-base-form-fields>\n <button\n amplify-button\n variation=\"primary\"\n fullWidth=\"true\"\n type=\"submit\"\n [isDisabled]=\"authenticator.isPending\"\n >\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n</form>\n", components: [{ type: AmplifySlotComponent, selector: "amplify-slot", inputs: ["name", "context"] }, { type: BaseFormFieldsComponent, selector: "amplify-base-form-fields", inputs: ["route"] }, { type: ButtonComponent, selector: "button[amplify-button]", inputs: ["type", "fullWidth", "isDisabled", "size", "variation", "fontWeight"] }, { type: ErrorComponent, selector: "amplify-error" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1505
+ SetupTotpComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SetupTotpComponent, selector: "amplify-setup-totp", host: { properties: { "attr.data-amplify-authenticator-setup-totp": "this.dataAttr" } }, ngImport: i0__namespace, template: "<form data-amplify-form (submit)=\"onSubmit($event)\" (input)=\"onInput($event)\">\n <fieldset\n class=\"amplify-flex amplify-authenticator__column\"\n data-amplify-fieldset\n [disabled]=\"authenticator.isPending\"\n >\n <amplify-slot name=\"setup-totp-header\" [context]=\"context\">\n <h3 class=\"amplify-heading amplify-heading--3\">{{ this.headerText }}</h3>\n </amplify-slot>\n <p *ngIf=\"!qrCodeSource\">Loading...</p>\n <img\n *ngIf=\"qrCodeSource\"\n [src]=\"qrCodeSource\"\n alt=\"qr code\"\n data-amplify-qrcode\n width=\"228\"\n height=\"228\"\n />\n <div class=\"amplify-flex\" data-amplify-copy>\n <div>{{ totpSecretCode }}</div>\n <div data-amplify-copy-svg (click)=\"copyText()\">\n <div data-amplify-copy-tooltip>{{ copyTextLabel }}</div>\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM15 5H8C6.9 5 6.01 5.9 6.01 7L6 21C6 22.1 6.89 23 7.99 23H19C20.1 23 21 22.1 21 21V11L15 5ZM8 21V7H14V12H19V21H8Z\"\n />\n </svg>\n </div>\n </div>\n\n <amplify-base-form-fields route=\"setupTOTP\"></amplify-base-form-fields>\n <button\n amplify-button\n variation=\"primary\"\n fullWidth=\"true\"\n type=\"submit\"\n [isDisabled]=\"authenticator.isPending\"\n >\n {{ confirmText }}\n </button>\n <button\n amplify-button\n size=\"small\"\n variation=\"link\"\n fontWeight=\"normal\"\n fullWidth=\"true\"\n (click)=\"authenticator.toSignIn()\"\n >\n {{ backToSignInText }}\n </button>\n <amplify-error *ngIf=\"authenticator.error\">\n {{ authenticator.error }}\n </amplify-error>\n </fieldset>\n <amplify-slot name=\"setup-totp-footer\" [context]=\"context\"> </amplify-slot>\n</form>\n", components: [{ type: AmplifySlotComponent, selector: "amplify-slot", inputs: ["name", "context"] }, { type: BaseFormFieldsComponent, selector: "amplify-base-form-fields", inputs: ["route"] }, { type: ButtonComponent, selector: "button[amplify-button]", inputs: ["type", "fullWidth", "isDisabled", "size", "variation", "fontWeight"] }, { type: ErrorComponent, selector: "amplify-error" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1502
1506
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SetupTotpComponent, decorators: [{
1503
1507
  type: i0.Component,
1504
1508
  args: [{