@idsoftsource/initial-process 1.0.5 → 1.0.6

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.
@@ -619,6 +619,9 @@ class UserDetailService {
619
619
  AddUserIndustry(payload) {
620
620
  return this.http.post(`${this.baseUrl}/AddUserIndustry`, payload);
621
621
  }
622
+ reSendVerificationEmail() {
623
+ return this.http.post(`${this.baseUrl}/resend-verification`, {});
624
+ }
622
625
  /* ==============================
623
626
  INITIAL SETUP
624
627
  ============================== */
@@ -30562,6 +30565,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
30562
30565
  args: [{ selector: 'app-must-change-password', standalone: true, imports: [CommonModule, FormsModule, ReactiveFormsModule], template: "<div class=\"container\">\r\n <div class=\"row justify-content-center align-items-center vh-100\">\r\n <div class=\"col-md-6 col-lg-5\">\r\n <div class=\"card shadow-lg border-0\">\r\n <div class=\"card-body p-4\">\r\n <div class=\"text-center mb-4\">\r\n <span class=\"logout-wrapper\" (click)=\"logout()\">\r\n <span class=\"logout-icon\"></span>\r\n <span class=\"logout-text\">Logout</span>\r\n </span>\r\n <h4 class=\"fw-bold\">Change Your Password</h4>\r\n <p class=\"text-muted small\">\r\n For security reasons, you must change your password before continuing.\r\n </p>\r\n </div>\r\n <div *ngIf=\"errorMessage\" class=\"alert alert-danger\">\r\n {{ errorMessage }}\r\n </div>\r\n <form [formGroup]=\"changePasswordForm\" (ngSubmit)=\"onSubmit()\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\">New Password</label>\r\n <input type=\"password\" class=\"form-control\" formControlName=\"newPassword\"\r\n [ngClass]=\"{'is-invalid': submitted && f['newPassword'].errors}\">\r\n\r\n <div *ngIf=\"submitted && f['newPassword'].errors\" class=\"invalid-feedback\">\r\n <div *ngIf=\"f['newPassword'].errors['required']\">\r\n New password is required.\r\n </div>\r\n <div *ngIf=\"f['newPassword'].errors['minlength']\">\r\n Minimum 8 characters required.\r\n </div>\r\n <div *ngIf=\"f['newPassword'].errors['pattern']\">\r\n Must include uppercase, lowercase, number & symbol.\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\">Confirm Password</label>\r\n <input type=\"password\" class=\"form-control\" formControlName=\"confirmPassword\"\r\n [ngClass]=\"{'is-invalid': submitted && changePasswordForm.errors?.['mismatch']}\">\r\n\r\n <div *ngIf=\"submitted && changePasswordForm.errors?.['mismatch']\" class=\"invalid-feedback\">\r\n Passwords do not match.\r\n </div>\r\n </div>\r\n <div class=\"d-grid\">\r\n <button type=\"submit\" class=\"btn btn-primary\" style=\"background: #4077AD;color: white;border-radius: 5px;\"\r\n [disabled]=\"isLoading\">\r\n <span *ngIf=\"isLoading\" class=\"spinner-border spinner-border-sm me-2\"></span>\r\n Update Password\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n <div class=\"text-center mt-3\">\r\n <small class=\"text-muted\">\r\n If you face issues, contact your administrator.\r\n </small>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".logout-wrapper{display:inline-flex;align-items:center;gap:6px;cursor:pointer;color:#212529bf;font-weight:500;font-size:18px}.logout-wrapper:hover{color:#4077ad}.logout-icon{width:20px;height:20px;background:url(/assets/images/icons/logoutt.svg) no-repeat center;background-size:contain}\n"] }]
30563
30566
  }], ctorParameters: () => [{ type: i3.FormBuilder }, { type: i9.AuthService }, { type: UserDetailService }, { type: i6.TokenService }] });
30564
30567
 
30568
+ class VerifyEmailComponent {
30569
+ userService;
30570
+ authLogoutService;
30571
+ loading = false;
30572
+ successMessage = false;
30573
+ errorMessage = false;
30574
+ // ✅ cooldown (30 seconds)
30575
+ cooldown = 0;
30576
+ interval;
30577
+ constructor(userService, authLogoutService) {
30578
+ this.userService = userService;
30579
+ this.authLogoutService = authLogoutService;
30580
+ }
30581
+ async resendVerification() {
30582
+ // 🚫 prevent spam clicking
30583
+ if (this.cooldown > 0)
30584
+ return;
30585
+ this.loading = true;
30586
+ this.successMessage = false;
30587
+ this.errorMessage = false;
30588
+ this.userService.reSendVerificationEmail().subscribe({
30589
+ next: (data) => {
30590
+ this.loading = false;
30591
+ if (!data?.failed) {
30592
+ this.successMessage = true;
30593
+ this.startCooldown(); // ✅ start timer after success
30594
+ }
30595
+ else {
30596
+ this.errorMessage = true;
30597
+ }
30598
+ },
30599
+ error: () => {
30600
+ this.loading = false; // ✅ fix: stop loading on error
30601
+ this.errorMessage = true;
30602
+ }
30603
+ });
30604
+ }
30605
+ // ✅ cooldown logic
30606
+ startCooldown() {
30607
+ this.cooldown = 30;
30608
+ this.interval = setInterval(() => {
30609
+ this.cooldown--;
30610
+ if (this.cooldown <= 0) {
30611
+ clearInterval(this.interval);
30612
+ }
30613
+ }, 1000);
30614
+ }
30615
+ async logout() {
30616
+ try {
30617
+ await this.authLogoutService.logout();
30618
+ window.localStorage.clear();
30619
+ }
30620
+ finally { }
30621
+ }
30622
+ ngOnDestroy() {
30623
+ if (this.interval) {
30624
+ clearInterval(this.interval);
30625
+ }
30626
+ }
30627
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: VerifyEmailComponent, deps: [{ token: UserDetailService }, { token: i6.AuthLogoutService }], target: i0.ɵɵFactoryTarget.Component });
30628
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: VerifyEmailComponent, isStandalone: true, selector: "app-verify-email", ngImport: i0, template: "<div class=\"container d-flex justify-content-center align-items-center vh-100\">\r\n <div class=\"card shadow p-4 text-center\" style=\"max-width: 420px; width: 100%;\">\r\n \r\n <div class=\"icon mb-3 text-warning\" style=\"font-size: 60px;\">\r\n \u26A0\r\n </div>\r\n\r\n <h4 class=\"mb-3\">Email Not Verified</h4>\r\n\r\n <p class=\"text-muted\">\r\n Your email is not verified yet. Please check your inbox and click the verification link.\r\n <br><br>\r\n If you didn\u2019t receive the email, click the button below to resend the verification link.\r\n </p>\r\n\r\n <button \r\n class=\"btn btn-warning w-100 mt-3\"\r\n (click)=\"resendVerification()\"\r\n [disabled]=\"loading || cooldown > 0\">\r\n\r\n <!-- Normal -->\r\n <span *ngIf=\"!loading && cooldown === 0\">\r\n Resend Verification Email\r\n </span>\r\n\r\n <!-- Loading -->\r\n <span *ngIf=\"loading\">\r\n Sending...\r\n </span>\r\n\r\n <!-- Cooldown -->\r\n <span *ngIf=\"cooldown > 0 && !loading\">\r\n Retry in {{ cooldown }}s\r\n </span>\r\n\r\n </button>\r\n\r\n <div *ngIf=\"successMessage\" class=\"mt-3 text-success\">\r\n \u2705 Verification email sent! Please check your inbox.\r\n </div>\r\n\r\n <div *ngIf=\"errorMessage\" class=\"mt-3 text-danger\">\r\n \u274C Failed to resend email. Try again.\r\n </div>\r\n\r\n <!-- Optional logout -->\r\n <button class=\"btn btn-link mt-3\" (click)=\"logout()\">\r\n Logout\r\n </button>\r\n\r\n </div>\r\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }] });
30629
+ }
30630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: VerifyEmailComponent, decorators: [{
30631
+ type: Component,
30632
+ args: [{ selector: 'app-verify-email', standalone: true, imports: [CommonModule, FormsModule, ReactiveFormsModule], template: "<div class=\"container d-flex justify-content-center align-items-center vh-100\">\r\n <div class=\"card shadow p-4 text-center\" style=\"max-width: 420px; width: 100%;\">\r\n \r\n <div class=\"icon mb-3 text-warning\" style=\"font-size: 60px;\">\r\n \u26A0\r\n </div>\r\n\r\n <h4 class=\"mb-3\">Email Not Verified</h4>\r\n\r\n <p class=\"text-muted\">\r\n Your email is not verified yet. Please check your inbox and click the verification link.\r\n <br><br>\r\n If you didn\u2019t receive the email, click the button below to resend the verification link.\r\n </p>\r\n\r\n <button \r\n class=\"btn btn-warning w-100 mt-3\"\r\n (click)=\"resendVerification()\"\r\n [disabled]=\"loading || cooldown > 0\">\r\n\r\n <!-- Normal -->\r\n <span *ngIf=\"!loading && cooldown === 0\">\r\n Resend Verification Email\r\n </span>\r\n\r\n <!-- Loading -->\r\n <span *ngIf=\"loading\">\r\n Sending...\r\n </span>\r\n\r\n <!-- Cooldown -->\r\n <span *ngIf=\"cooldown > 0 && !loading\">\r\n Retry in {{ cooldown }}s\r\n </span>\r\n\r\n </button>\r\n\r\n <div *ngIf=\"successMessage\" class=\"mt-3 text-success\">\r\n \u2705 Verification email sent! Please check your inbox.\r\n </div>\r\n\r\n <div *ngIf=\"errorMessage\" class=\"mt-3 text-danger\">\r\n \u274C Failed to resend email. Try again.\r\n </div>\r\n\r\n <!-- Optional logout -->\r\n <button class=\"btn btn-link mt-3\" (click)=\"logout()\">\r\n Logout\r\n </button>\r\n\r\n </div>\r\n</div>" }]
30633
+ }], ctorParameters: () => [{ type: UserDetailService }, { type: i6.AuthLogoutService }] });
30634
+
30565
30635
  // app-type.enum.ts
30566
30636
  var AppType;
30567
30637
  (function (AppType) {
@@ -30589,5 +30659,5 @@ var AppType;
30589
30659
  * Generated bundle index. Do not edit.
30590
30660
  */
30591
30661
 
30592
- export { AppType, InitialProcessComponent, InitialProcessModule, LIBRARY_CONFIG, MustChangePasswordComponent };
30662
+ export { AppType, InitialProcessComponent, InitialProcessModule, LIBRARY_CONFIG, MustChangePasswordComponent, VerifyEmailComponent };
30593
30663
  //# sourceMappingURL=idsoftsource-initial-process.mjs.map