@annalib/anna-cognito-lib 2.2.9 → 2.2.11

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.
@@ -67,9 +67,6 @@ LoginConstant.stationSettingUrl = "/station-settings";
67
67
  /** Token to inject the auth service */
68
68
  const AUTH_SERVICE_TOKEN = new InjectionToken('Auth service token');
69
69
 
70
- /** Token to inject the auth service */
71
- const CONFIG_SERVICE_TOKEN = new InjectionToken('Cognito config service token');
72
-
73
70
  /** Token to inject the acl service */
74
71
  const ACL_SERVICE_TOKEN = new InjectionToken('ACL service token');
75
72
 
@@ -99,13 +96,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
99
96
 
100
97
  // Angular import statements
101
98
  class AnnaLibAuthService {
102
- constructor(router, aclService, httpClient, toastr, consumingProjectAuthService, consumingProjectConfigService) {
99
+ constructor(router, aclService, httpClient, toastr, consumingProjectAuthService) {
103
100
  this.router = router;
104
101
  this.aclService = aclService;
105
102
  this.httpClient = httpClient;
106
103
  this.toastr = toastr;
107
104
  this.consumingProjectAuthService = consumingProjectAuthService;
108
- this.consumingProjectConfigService = consumingProjectConfigService;
109
105
  this.noOfAttempts = 0;
110
106
  this.sessionLocked = false;
111
107
  if (!consumingProjectAuthService) {
@@ -119,7 +115,7 @@ class AnnaLibAuthService {
119
115
  return new Promise(async (resolve, reject) => {
120
116
  const session = await fetchAuthSession();
121
117
  if (session?.tokens) {
122
- this.IdToken = session?.tokens.idToken.toString();
118
+ this.consumingProjectAuthService.IdToken = session?.tokens.idToken.toString();
123
119
  this.getAllCognitoTokenAndGroups(session.tokens);
124
120
  resolve(true);
125
121
  }
@@ -140,7 +136,7 @@ class AnnaLibAuthService {
140
136
  sessionTimeout() {
141
137
  localStorage.clear();
142
138
  clearInterval(this.accessTokenTimerId);
143
- this.router.navigate([LoginConstant.loginPageUrl]);
139
+ this.router.navigate([this.consumingProjectAuthService.defaultLoginPageUrl ? this.consumingProjectAuthService.defaultLoginPageUrl : LoginConstant.loginPageUrl]);
144
140
  }
145
141
  computeTokenExpiration(idToken) {
146
142
  let currentTime = Math.floor(Date.now() / 1000);
@@ -154,18 +150,13 @@ class AnnaLibAuthService {
154
150
  switch (nextStep?.signInStep) {
155
151
  case "DONE":
156
152
  let session = await fetchAuthSession();
157
- let newExpTime = this.computeTokenExpiration(session.tokens.idToken);
158
- this.accessToken = session.tokens.accessToken.toString();
159
- this.IdToken = session.tokens.idToken.toString();
160
- localStorage.setItem("accessTokenExpiration", newExpTime.toString());
161
- this.refreshAccessToken();
162
- this.loginErrorMessage = null;
153
+ this.onLoginOrSetNewPassword(session);
163
154
  await this.consumingProjectAuthService.onSuccessfulAuthenticatingUser(false);
164
155
  this.getAllCognitoTokenAndGroups(session.tokens);
165
156
  break;
166
157
  case "CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED":
167
158
  this.consumingProjectAuthService.isLoggingIn = false;
168
- this.userName = username;
159
+ this.consumingProjectAuthService.userName = username;
169
160
  this.router.navigate([LoginConstant.setNewPasswordUrl]);
170
161
  this.setNewPasswordErrorMessage = null;
171
162
  break;
@@ -187,9 +178,17 @@ class AnnaLibAuthService {
187
178
  }
188
179
  }
189
180
  }
181
+ onLoginOrSetNewPassword(session) {
182
+ let newExpTime = this.computeTokenExpiration(session.tokens.idToken);
183
+ this.consumingProjectAuthService.accessToken = session.tokens.accessToken.toString();
184
+ this.consumingProjectAuthService.IdToken = session.tokens.idToken.toString();
185
+ localStorage.setItem("accessTokenExpiration", newExpTime.toString());
186
+ this.refreshAccessToken();
187
+ this.loginErrorMessage = null;
188
+ }
190
189
  async getAllCognitoTokenAndGroups(token) {
191
- this.accessToken = token.accessToken.toString();
192
- this.IdToken = token.idToken;
190
+ this.consumingProjectAuthService.accessToken = token.accessToken.toString();
191
+ this.consumingProjectAuthService.IdToken = token.idToken;
193
192
  if ("cognito:groups" in token.accessToken.payload) {
194
193
  let userGroupsInCognitoJWT = token.accessToken.payload["cognito:groups"];
195
194
  this.aclService.userGroupsInCognitoJWT = userGroupsInCognitoJWT;
@@ -209,7 +208,7 @@ class AnnaLibAuthService {
209
208
  let token = session.tokens;
210
209
  if (token) {
211
210
  this.getAllCognitoTokenAndGroups(token);
212
- let newExpTime = this.computeTokenExpiration(this.IdToken);
211
+ let newExpTime = this.computeTokenExpiration(this.consumingProjectAuthService.IdToken);
213
212
  if (newExpTime <= 0) {
214
213
  newExpTime = 1000;
215
214
  counter = 0;
@@ -242,6 +241,8 @@ class AnnaLibAuthService {
242
241
  const data = await confirmSignIn(inputParam);
243
242
  const { username } = await getCurrentUser();
244
243
  console.log(data);
244
+ let session = await fetchAuthSession();
245
+ this.onLoginOrSetNewPassword(session);
245
246
  this.consumingProjectAuthService.onPasswordUpdate(username);
246
247
  this.router.navigate([LoginConstant.loginPageUrl]);
247
248
  this.consumingProjectAuthService.newPasswordSetThenUpdateToBackend(username);
@@ -254,7 +255,7 @@ class AnnaLibAuthService {
254
255
  }
255
256
  async onForgotPasswordGenerateOTP(email) {
256
257
  let username = email;
257
- this.userName = email;
258
+ this.consumingProjectAuthService.userName = email;
258
259
  try {
259
260
  let result = await resetPassword({ username });
260
261
  this.verifyAndSetNewPasswordMessage =
@@ -267,16 +268,18 @@ class AnnaLibAuthService {
267
268
  }
268
269
  }
269
270
  async verifyCode(confirmationCode, newPassword) {
270
- const { username } = await getCurrentUser();
271
271
  try {
272
- confirmResetPassword({ username, newPassword, confirmationCode });
273
- this.consumingProjectAuthService.onPasswordUpdate(username);
274
- this.expiryAllExistingCurrentSession(username, newPassword);
272
+ // const { username } = await getCurrentUser();
273
+ confirmResetPassword({ username: this.consumingProjectAuthService.userName, newPassword: newPassword, confirmationCode: confirmationCode });
274
+ this.consumingProjectAuthService.onPasswordUpdate(this.consumingProjectAuthService.userName);
275
+ this.expiryAllExistingCurrentSession(this.consumingProjectAuthService.userName, newPassword);
275
276
  }
276
277
  catch (err) {
277
278
  console.log(err);
278
279
  this.noOfAttempts = this.noOfAttempts + 1;
279
280
  this.verifyAndSetNewPasswordErrorMessage = this.forgotPasswordError(err, this.noOfAttempts);
281
+ }
282
+ finally {
280
283
  this.forgotPasswordAndGlobalSignoutLoader = false;
281
284
  }
282
285
  }
@@ -338,7 +341,7 @@ class AnnaLibAuthService {
338
341
  }
339
342
  }
340
343
  }
341
- AnnaLibAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AnnaLibAuthService, deps: [{ token: i3.Router }, { token: AnnaLibAclService }, { token: i3$1.HttpClient }, { token: i4.ToastrService }, { token: AUTH_SERVICE_TOKEN }, { token: CONFIG_SERVICE_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
344
+ AnnaLibAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AnnaLibAuthService, deps: [{ token: i3.Router }, { token: AnnaLibAclService }, { token: i3$1.HttpClient }, { token: i4.ToastrService }, { token: AUTH_SERVICE_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
342
345
  AnnaLibAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AnnaLibAuthService, providedIn: "root" });
343
346
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AnnaLibAuthService, decorators: [{
344
347
  type: Injectable,
@@ -348,11 +351,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
348
351
  }], ctorParameters: function () { return [{ type: i3.Router }, { type: AnnaLibAclService }, { type: i3$1.HttpClient }, { type: i4.ToastrService }, { type: undefined, decorators: [{
349
352
  type: Inject,
350
353
  args: [AUTH_SERVICE_TOKEN]
351
- }] }, { type: undefined, decorators: [{
352
- type: Inject,
353
- args: [CONFIG_SERVICE_TOKEN]
354
354
  }] }]; } });
355
355
 
356
+ /** Token to inject the auth service */
357
+ const CONFIG_SERVICE_TOKEN = new InjectionToken('Cognito config service token');
358
+
356
359
  class SpinnerButtonDirective {
357
360
  constructor(el, renderer) {
358
361
  this.el = el;
@@ -485,10 +488,10 @@ class SsoLoginComponent {
485
488
  }
486
489
  }
487
490
  SsoLoginComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SsoLoginComponent, deps: [{ token: AnnaLibAuthService }, { token: CONFIG_SERVICE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
488
- SsoLoginComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SsoLoginComponent, selector: "anna-cognito-lib-sso-login", ngImport: i0, template: "<div class=\"main\">\r\n <section *ngIf=\"constants.forgotPassword\">\r\n <header>\r\n <img [ngSrc]=\"consumingProjectConfigService.appGenericConfig.loginPageLogoImgUrl\" width=\"145\" height=\"50\"\r\n alt=\"Anna Logo\" priority />\r\n </header>\r\n <article>\r\n <p class=\"sub-title\">Login</p>\r\n <p>Sign in to your account with SSO</p>\r\n <button class=\"login-btn\" (click)=\"signInWithSSO()\">Login</button>\r\n <div class=\"dashed-line\"></div>\r\n <!-- <a tabindex=\"4\" class=\"login-link\" [routerLink]=\"constants.loginPageUrl\">Sign in with username</a> -->\r\n </article>\r\n <footer>\r\n <anna-cognito-lib-powered-by-logo-template>\r\n </anna-cognito-lib-powered-by-logo-template>\r\n </footer>\r\n </section>\r\n</div>\r\n\r\n<div class=\"page-footer\">\r\n <anna-cognito-lib-surewaves-year-logo></anna-cognito-lib-surewaves-year-logo>\r\n <anna-cognito-lib-version-and-term-policy></anna-cognito-lib-version-and-term-policy>\r\n</div>", styles: ["@keyframes show{0%{opacity:0}50%{opacity:.5}to{opacity:1}}html{overflow-y:scroll}.main{background-color:#fff;background-size:cover;font-family:Roboto;height:calc(100vh - 50px)}section{top:45%;left:50%;position:absolute;transform:translate(-50%,-50%);width:20.875rem;animation:show .5s 1;-moz-animation:show .5s 1}.container{width:100%;height:100%;overflow:auto}header{height:auto;width:100%;text-align:center}article{margin-top:.9375rem;margin-bottom:.9375rem;border:1px solid #979797;background-color:#f4f4f4;padding:2rem 1.375rem;border-radius:.375rem;box-shadow:0 .125rem .4375rem #0000001a}article .sub-title{color:#6e6e6e;font-family:Roboto;font-size:1.25rem;font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}article #heading{color:#212121;text-align:center;margin-bottom:1.5rem;font-family:Roboto;font-size:1.125rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}p{text-align:center;margin-bottom:1rem}#alert-div{padding:.25rem 0 0;margin-bottom:.75rem;border-radius:.25rem;border:solid 1px #f9b3ae;background-color:#fde4e3}#alert-div .material-icons{color:#f44336;font-size:1rem;margin-left:.5rem}#alert-div .mdi-info{color:#268bff;font-size:1rem}#alert-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}#info-div{padding:6px 0;margin-bottom:.75rem;border-radius:.25rem;border:1px solid #268bff;background:#e3f0ff}#info-div .mdi-info{color:#268bff;font-size:1rem;margin-left:6px}#info-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}footer{align-items:baseline;color:#6e6e6e;opacity:.9;display:flex;font-family:Ubuntu;font-size:1.25rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal;justify-content:center}footer span{font-size:1.5625rem;margin-left:.25rem}input[type=password],input[type=text],input[type=number]{width:100%;height:30px;padding:.75rem 1rem;border:1px solid #979797;margin-bottom:.625rem;border-radius:.375rem}.login-btn{width:100%;height:2.5rem;border:0;color:#fff;background-color:#268bff;border-radius:.375rem;font-size:1rem}.login-btn:hover{background-color:#4099ff;cursor:pointer}.login-btn:disabled{background-color:#ccc;color:#fff;cursor:not-allowed}.input-invalid{border:1px solid #fe3824!important}input[type=password].ng-dirty.ng-invalid,input[type=text].ng-dirty.ng-invalid{border:1px solid #fe3824}input[type=submit]:focus,input[type=password]:focus,input[type=text]:focus,input[type=checkbox]:focus,button:focus{outline:none}input::placeholder{color:#a4a4a4}:host ::ng-deep .verison-and-policy{color:#8bac2a}\n"], dependencies: [{ kind: "directive", type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$1.NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "src", "srcset"] }, { kind: "component", type: VersionAndTermPolicyComponent, selector: "anna-cognito-lib-version-and-term-policy" }, { kind: "component", type: SurewavesYearLogoComponent, selector: "anna-cognito-lib-surewaves-year-logo" }, { kind: "component", type: PoweredByLogoTemplateComponent, selector: "anna-cognito-lib-powered-by-logo-template" }] });
491
+ SsoLoginComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SsoLoginComponent, selector: "anna-cognito-lib-sso-login", ngImport: i0, template: "<div class=\"main\">\n <section *ngIf=\"constants.forgotPassword\">\n <header>\n <img [ngSrc]=\"consumingProjectConfigService.appGenericConfig.loginPageLogoImgUrl\" width=\"145\" height=\"50\"\n alt=\"Anna Logo\" priority />\n </header>\n <article>\n <p class=\"sub-title\">Login</p>\n <p>Sign in to your account with SSO</p>\n <button class=\"login-btn\" (click)=\"signInWithSSO()\">Login</button>\n <div class=\"dashed-line\"></div>\n <!-- <a tabindex=\"4\" class=\"login-link\" [routerLink]=\"constants.loginPageUrl\">Sign in with username</a> -->\n </article>\n <footer>\n <anna-cognito-lib-powered-by-logo-template>\n </anna-cognito-lib-powered-by-logo-template>\n </footer>\n </section>\n</div>\n\n<div class=\"page-footer\">\n <anna-cognito-lib-surewaves-year-logo></anna-cognito-lib-surewaves-year-logo>\n <anna-cognito-lib-version-and-term-policy></anna-cognito-lib-version-and-term-policy>\n</div>", styles: ["@keyframes show{0%{opacity:0}50%{opacity:.5}to{opacity:1}}html{overflow-y:scroll}.main{background-color:#fff;background-size:cover;font-family:Roboto;height:calc(100vh - 50px)}section{top:45%;left:50%;position:absolute;transform:translate(-50%,-50%);width:20.875rem;animation:show .5s 1;-moz-animation:show .5s 1}.container{width:100%;height:100%;overflow:auto}header{height:auto;width:100%;text-align:center}article{margin-top:.9375rem;margin-bottom:.9375rem;border:1px solid #979797;background-color:#f4f4f4;padding:2rem 1.375rem;border-radius:.375rem;box-shadow:0 .125rem .4375rem #0000001a}article .sub-title{color:#6e6e6e;font-family:Roboto;font-size:1.25rem;font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}article #heading{color:#212121;text-align:center;margin-bottom:1.5rem;font-family:Roboto;font-size:1.125rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}p{text-align:center;margin-bottom:1rem}#alert-div{padding:.25rem 0 0;margin-bottom:.75rem;border-radius:.25rem;border:solid 1px #f9b3ae;background-color:#fde4e3}#alert-div .material-icons{color:#f44336;font-size:1rem;margin-left:.5rem}#alert-div .mdi-info{color:#268bff;font-size:1rem}#alert-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}#info-div{padding:6px 0;margin-bottom:.75rem;border-radius:.25rem;border:1px solid #268bff;background:#e3f0ff}#info-div .mdi-info{color:#268bff;font-size:1rem;margin-left:6px}#info-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}footer{align-items:baseline;color:#6e6e6e;opacity:.9;display:flex;font-family:Ubuntu;font-size:1.25rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal;justify-content:center}footer span{font-size:1.5625rem;margin-left:.25rem}input[type=password],input[type=text],input[type=number]{width:100%;height:30px;padding:.75rem 1rem;border:1px solid #979797;margin-bottom:.625rem;border-radius:.375rem}.login-btn{width:100%;height:2.5rem;border:0;color:#fff;background-color:#268bff;border-radius:.375rem;font-size:1rem}.login-btn:hover{background-color:#4099ff;cursor:pointer}.login-btn:disabled{background-color:#ccc;color:#fff;cursor:not-allowed}.input-invalid{border:1px solid #fe3824!important}input[type=password].ng-dirty.ng-invalid,input[type=text].ng-dirty.ng-invalid{border:1px solid #fe3824}input[type=submit]:focus,input[type=password]:focus,input[type=text]:focus,input[type=checkbox]:focus,button:focus{outline:none}input::placeholder{color:#a4a4a4}:host ::ng-deep .verison-and-policy{color:#8bac2a}\n"], dependencies: [{ kind: "directive", type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$1.NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "src", "srcset"] }, { kind: "component", type: VersionAndTermPolicyComponent, selector: "anna-cognito-lib-version-and-term-policy" }, { kind: "component", type: SurewavesYearLogoComponent, selector: "anna-cognito-lib-surewaves-year-logo" }, { kind: "component", type: PoweredByLogoTemplateComponent, selector: "anna-cognito-lib-powered-by-logo-template" }] });
489
492
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SsoLoginComponent, decorators: [{
490
493
  type: Component,
491
- args: [{ selector: 'anna-cognito-lib-sso-login', template: "<div class=\"main\">\r\n <section *ngIf=\"constants.forgotPassword\">\r\n <header>\r\n <img [ngSrc]=\"consumingProjectConfigService.appGenericConfig.loginPageLogoImgUrl\" width=\"145\" height=\"50\"\r\n alt=\"Anna Logo\" priority />\r\n </header>\r\n <article>\r\n <p class=\"sub-title\">Login</p>\r\n <p>Sign in to your account with SSO</p>\r\n <button class=\"login-btn\" (click)=\"signInWithSSO()\">Login</button>\r\n <div class=\"dashed-line\"></div>\r\n <!-- <a tabindex=\"4\" class=\"login-link\" [routerLink]=\"constants.loginPageUrl\">Sign in with username</a> -->\r\n </article>\r\n <footer>\r\n <anna-cognito-lib-powered-by-logo-template>\r\n </anna-cognito-lib-powered-by-logo-template>\r\n </footer>\r\n </section>\r\n</div>\r\n\r\n<div class=\"page-footer\">\r\n <anna-cognito-lib-surewaves-year-logo></anna-cognito-lib-surewaves-year-logo>\r\n <anna-cognito-lib-version-and-term-policy></anna-cognito-lib-version-and-term-policy>\r\n</div>", styles: ["@keyframes show{0%{opacity:0}50%{opacity:.5}to{opacity:1}}html{overflow-y:scroll}.main{background-color:#fff;background-size:cover;font-family:Roboto;height:calc(100vh - 50px)}section{top:45%;left:50%;position:absolute;transform:translate(-50%,-50%);width:20.875rem;animation:show .5s 1;-moz-animation:show .5s 1}.container{width:100%;height:100%;overflow:auto}header{height:auto;width:100%;text-align:center}article{margin-top:.9375rem;margin-bottom:.9375rem;border:1px solid #979797;background-color:#f4f4f4;padding:2rem 1.375rem;border-radius:.375rem;box-shadow:0 .125rem .4375rem #0000001a}article .sub-title{color:#6e6e6e;font-family:Roboto;font-size:1.25rem;font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}article #heading{color:#212121;text-align:center;margin-bottom:1.5rem;font-family:Roboto;font-size:1.125rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}p{text-align:center;margin-bottom:1rem}#alert-div{padding:.25rem 0 0;margin-bottom:.75rem;border-radius:.25rem;border:solid 1px #f9b3ae;background-color:#fde4e3}#alert-div .material-icons{color:#f44336;font-size:1rem;margin-left:.5rem}#alert-div .mdi-info{color:#268bff;font-size:1rem}#alert-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}#info-div{padding:6px 0;margin-bottom:.75rem;border-radius:.25rem;border:1px solid #268bff;background:#e3f0ff}#info-div .mdi-info{color:#268bff;font-size:1rem;margin-left:6px}#info-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}footer{align-items:baseline;color:#6e6e6e;opacity:.9;display:flex;font-family:Ubuntu;font-size:1.25rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal;justify-content:center}footer span{font-size:1.5625rem;margin-left:.25rem}input[type=password],input[type=text],input[type=number]{width:100%;height:30px;padding:.75rem 1rem;border:1px solid #979797;margin-bottom:.625rem;border-radius:.375rem}.login-btn{width:100%;height:2.5rem;border:0;color:#fff;background-color:#268bff;border-radius:.375rem;font-size:1rem}.login-btn:hover{background-color:#4099ff;cursor:pointer}.login-btn:disabled{background-color:#ccc;color:#fff;cursor:not-allowed}.input-invalid{border:1px solid #fe3824!important}input[type=password].ng-dirty.ng-invalid,input[type=text].ng-dirty.ng-invalid{border:1px solid #fe3824}input[type=submit]:focus,input[type=password]:focus,input[type=text]:focus,input[type=checkbox]:focus,button:focus{outline:none}input::placeholder{color:#a4a4a4}:host ::ng-deep .verison-and-policy{color:#8bac2a}\n"] }]
494
+ args: [{ selector: 'anna-cognito-lib-sso-login', template: "<div class=\"main\">\n <section *ngIf=\"constants.forgotPassword\">\n <header>\n <img [ngSrc]=\"consumingProjectConfigService.appGenericConfig.loginPageLogoImgUrl\" width=\"145\" height=\"50\"\n alt=\"Anna Logo\" priority />\n </header>\n <article>\n <p class=\"sub-title\">Login</p>\n <p>Sign in to your account with SSO</p>\n <button class=\"login-btn\" (click)=\"signInWithSSO()\">Login</button>\n <div class=\"dashed-line\"></div>\n <!-- <a tabindex=\"4\" class=\"login-link\" [routerLink]=\"constants.loginPageUrl\">Sign in with username</a> -->\n </article>\n <footer>\n <anna-cognito-lib-powered-by-logo-template>\n </anna-cognito-lib-powered-by-logo-template>\n </footer>\n </section>\n</div>\n\n<div class=\"page-footer\">\n <anna-cognito-lib-surewaves-year-logo></anna-cognito-lib-surewaves-year-logo>\n <anna-cognito-lib-version-and-term-policy></anna-cognito-lib-version-and-term-policy>\n</div>", styles: ["@keyframes show{0%{opacity:0}50%{opacity:.5}to{opacity:1}}html{overflow-y:scroll}.main{background-color:#fff;background-size:cover;font-family:Roboto;height:calc(100vh - 50px)}section{top:45%;left:50%;position:absolute;transform:translate(-50%,-50%);width:20.875rem;animation:show .5s 1;-moz-animation:show .5s 1}.container{width:100%;height:100%;overflow:auto}header{height:auto;width:100%;text-align:center}article{margin-top:.9375rem;margin-bottom:.9375rem;border:1px solid #979797;background-color:#f4f4f4;padding:2rem 1.375rem;border-radius:.375rem;box-shadow:0 .125rem .4375rem #0000001a}article .sub-title{color:#6e6e6e;font-family:Roboto;font-size:1.25rem;font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}article #heading{color:#212121;text-align:center;margin-bottom:1.5rem;font-family:Roboto;font-size:1.125rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}p{text-align:center;margin-bottom:1rem}#alert-div{padding:.25rem 0 0;margin-bottom:.75rem;border-radius:.25rem;border:solid 1px #f9b3ae;background-color:#fde4e3}#alert-div .material-icons{color:#f44336;font-size:1rem;margin-left:.5rem}#alert-div .mdi-info{color:#268bff;font-size:1rem}#alert-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}#info-div{padding:6px 0;margin-bottom:.75rem;border-radius:.25rem;border:1px solid #268bff;background:#e3f0ff}#info-div .mdi-info{color:#268bff;font-size:1rem;margin-left:6px}#info-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}footer{align-items:baseline;color:#6e6e6e;opacity:.9;display:flex;font-family:Ubuntu;font-size:1.25rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal;justify-content:center}footer span{font-size:1.5625rem;margin-left:.25rem}input[type=password],input[type=text],input[type=number]{width:100%;height:30px;padding:.75rem 1rem;border:1px solid #979797;margin-bottom:.625rem;border-radius:.375rem}.login-btn{width:100%;height:2.5rem;border:0;color:#fff;background-color:#268bff;border-radius:.375rem;font-size:1rem}.login-btn:hover{background-color:#4099ff;cursor:pointer}.login-btn:disabled{background-color:#ccc;color:#fff;cursor:not-allowed}.input-invalid{border:1px solid #fe3824!important}input[type=password].ng-dirty.ng-invalid,input[type=text].ng-dirty.ng-invalid{border:1px solid #fe3824}input[type=submit]:focus,input[type=password]:focus,input[type=text]:focus,input[type=checkbox]:focus,button:focus{outline:none}input::placeholder{color:#a4a4a4}:host ::ng-deep .verison-and-policy{color:#8bac2a}\n"] }]
492
495
  }], ctorParameters: function () { return [{ type: AnnaLibAuthService }, { type: undefined, decorators: [{
493
496
  type: Inject,
494
497
  args: [CONFIG_SERVICE_TOKEN]
@@ -648,12 +651,13 @@ class UserState {
648
651
 
649
652
  // Angular import statements
650
653
  class ForgotPasswordComponent {
651
- constructor(authService, fb, toastr, router, consumingProjectConfigService) {
654
+ constructor(authService, fb, toastr, router, consumingProjectConfigService, consumingProjectAuthService) {
652
655
  this.authService = authService;
653
656
  this.fb = fb;
654
657
  this.toastr = toastr;
655
658
  this.router = router;
656
659
  this.consumingProjectConfigService = consumingProjectConfigService;
660
+ this.consumingProjectAuthService = consumingProjectAuthService;
657
661
  this.passwordNotMatching = false;
658
662
  this.password = { value: null, status: null };
659
663
  this.confirmPassword = { value: null, status: null };
@@ -664,9 +668,10 @@ class ForgotPasswordComponent {
664
668
  this.infoMessageToRedirectLogin = null;
665
669
  this.constants = LoginConstant;
666
670
  this.onIntialiseForm();
667
- if (this.authService.userName) {
671
+ if (this.consumingProjectAuthService.userName) {
668
672
  this.onUpdateForm();
669
673
  }
674
+ this.authService.forgotPasswordAndGlobalSignoutLoader = false;
670
675
  }
671
676
  onIntialiseForm() {
672
677
  this.verifyRegisteredEmail = this.fb.group({
@@ -675,7 +680,7 @@ class ForgotPasswordComponent {
675
680
  }
676
681
  onUpdateForm() {
677
682
  this.verifyRegisteredEmail.patchValue({
678
- email: this.authService.userName,
683
+ email: this.consumingProjectAuthService.userName,
679
684
  });
680
685
  }
681
686
  isFormValid() {
@@ -727,7 +732,7 @@ class ForgotPasswordComponent {
727
732
  }
728
733
  }
729
734
  }
730
- ForgotPasswordComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ForgotPasswordComponent, deps: [{ token: AnnaLibAuthService }, { token: i2.FormBuilder }, { token: i4.ToastrService }, { token: i3.Router }, { token: CONFIG_SERVICE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
735
+ ForgotPasswordComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ForgotPasswordComponent, deps: [{ token: AnnaLibAuthService }, { token: i2.FormBuilder }, { token: i4.ToastrService }, { token: i3.Router }, { token: CONFIG_SERVICE_TOKEN }, { token: AUTH_SERVICE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
731
736
  ForgotPasswordComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ForgotPasswordComponent, selector: "anna-cognito-lib-forgot-password", ngImport: i0, template: "<div class=\"main\">\r\n <section>\r\n <header>\r\n <img [src]=\"consumingProjectConfigService.appGenericConfig.loginPageLogoImgUrl\" alt=\"Anna Logo\" />\r\n </header>\r\n <article>\r\n <form [formGroup]=\"verifyRegisteredEmail\">\r\n <ng-container *ngIf=\"!infoMessageToRedirectLogin\">\r\n <div id=\"heading\">\r\n {{ constants.forgotPasswordHeading }}\r\n </div>\r\n <p>\r\n {{ constants.forgotPasswordMessage }}\r\n </p>\r\n </ng-container>\r\n <div id=\"alert-div\" *ngIf=\"errorMessage\">\r\n <span class=\"material-icons\">report</span>\r\n <p id=\"alert-msg\">{{ errorMessage }}</p>\r\n </div>\r\n <div id=\"info-div\" *ngIf=\"infoMessageToRedirectLogin\">\r\n <i class=\"mi mdi-info\"></i>\r\n <p>{{ infoMessageToRedirectLogin }}</p>\r\n </div>\r\n\r\n <input *ngIf=\"!infoMessageToRedirectLogin\"\r\n type=\"text\"\r\n tabindex=\"1\"\r\n formControlName=\"email\"\r\n [placeholder]=\"constants.enterEmail\"\r\n [ngClass]=\"{\r\n 'input-invalid': verifyRegisteredEmail.get('email')?.dirty && verifyRegisteredEmail.get('email')?.errors\r\n }\"\r\n />\r\n\r\n <button\r\n tabindex=\"2\"\r\n type=\"submit\"\r\n class=\"login-btn\"\r\n [anna-cognito-lib-SpinnerButton]=\"isLoading\"\r\n (click)=\"onLoginOrGetOtpButtonClick()\"\r\n [spinnerButtonText]=\"infoMessageToRedirectLogin ? constants.login : constants.forgotPasswordButton\"\r\n ></button>\r\n </form>\r\n </article>\r\n <footer>\r\n <anna-cognito-lib-powered-by-logo-template>\r\n </anna-cognito-lib-powered-by-logo-template>\r\n </footer>\r\n </section>\r\n</div>\r\n\r\n<div class=\"page-footer\">\r\n <anna-cognito-lib-surewaves-year-logo></anna-cognito-lib-surewaves-year-logo>\r\n <anna-cognito-lib-version-and-term-policy></anna-cognito-lib-version-and-term-policy>\r\n</div>\r\n", styles: ["@keyframes show{0%{opacity:0}50%{opacity:.5}to{opacity:1}}html{overflow-y:scroll}.main{background-color:#fff;background-size:cover;font-family:Roboto;height:calc(100vh - 50px)}section{top:45%;left:50%;position:absolute;transform:translate(-50%,-50%);width:20.875rem;animation:show .5s 1;-moz-animation:show .5s 1}.container{width:100%;height:100%;overflow:auto}header{height:auto;width:100%;text-align:center}article{margin-top:.9375rem;margin-bottom:.9375rem;border:1px solid #979797;background-color:#f4f4f4;padding:2rem 1.375rem;border-radius:.375rem;box-shadow:0 .125rem .4375rem #0000001a}article .sub-title{color:#6e6e6e;font-family:Roboto;font-size:1.25rem;font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}article #heading{color:#212121;text-align:center;margin-bottom:1.5rem;font-family:Roboto;font-size:1.125rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}p{text-align:center;margin-bottom:1rem}#alert-div{padding:.25rem 0 0;margin-bottom:.75rem;border-radius:.25rem;border:solid 1px #f9b3ae;background-color:#fde4e3}#alert-div .material-icons{color:#f44336;font-size:1rem;margin-left:.5rem}#alert-div .mdi-info{color:#268bff;font-size:1rem}#alert-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}#info-div{padding:6px 0;margin-bottom:.75rem;border-radius:.25rem;border:1px solid #268bff;background:#e3f0ff}#info-div .mdi-info{color:#268bff;font-size:1rem;margin-left:6px}#info-div p{margin:-1.5625rem 0 0 1.8rem;padding:.3125rem 0;color:#4a4a4a;font-family:Roboto;font-size:.75rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}footer{align-items:baseline;color:#6e6e6e;opacity:.9;display:flex;font-family:Ubuntu;font-size:1.25rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal;justify-content:center}footer span{font-size:1.5625rem;margin-left:.25rem}input[type=password],input[type=text],input[type=number]{width:100%;height:30px;padding:.75rem 1rem;border:1px solid #979797;margin-bottom:.625rem;border-radius:.375rem}.login-btn{width:100%;height:2.5rem;border:0;color:#fff;background-color:#268bff;border-radius:.375rem;font-size:1rem}.login-btn:hover{background-color:#4099ff;cursor:pointer}.login-btn:disabled{background-color:#ccc;color:#fff;cursor:not-allowed}.input-invalid{border:1px solid #fe3824!important}input[type=password].ng-dirty.ng-invalid,input[type=text].ng-dirty.ng-invalid{border:1px solid #fe3824}input[type=submit]:focus,input[type=password]:focus,input[type=text]:focus,input[type=checkbox]:focus,button:focus{outline:none}input::placeholder{color:#a4a4a4}:host ::ng-deep .verison-and-policy{color:#8bac2a}p{color:#4a4a4a;font-family:Roboto;font-size:1rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}input[type=text]{margin-bottom:16px}input[type=text]:focus{box-shadow:none}.back-btn{font-size:27px;position:relative;color:#268bff;float:left;top:-30px;left:-15px;font-weight:400!important}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i4$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: SpinnerButtonDirective, selector: "[anna-cognito-lib-SpinnerButton]", inputs: ["anna-cognito-lib-SpinnerButton", "spinnerButtonText"] }, { kind: "component", type: VersionAndTermPolicyComponent, selector: "anna-cognito-lib-version-and-term-policy" }, { kind: "component", type: SurewavesYearLogoComponent, selector: "anna-cognito-lib-surewaves-year-logo" }, { kind: "component", type: PoweredByLogoTemplateComponent, selector: "anna-cognito-lib-powered-by-logo-template" }] });
732
737
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ForgotPasswordComponent, decorators: [{
733
738
  type: Component,
@@ -735,6 +740,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
735
740
  }], ctorParameters: function () { return [{ type: AnnaLibAuthService }, { type: i2.FormBuilder }, { type: i4.ToastrService }, { type: i3.Router }, { type: undefined, decorators: [{
736
741
  type: Inject,
737
742
  args: [CONFIG_SERVICE_TOKEN]
743
+ }] }, { type: undefined, decorators: [{
744
+ type: Inject,
745
+ args: [AUTH_SERVICE_TOKEN]
738
746
  }] }]; } });
739
747
 
740
748
  // Angular import statements