Skip to content

Commit

Permalink
Merge pull request #387 from Sohith-code/self-registration-flow
Browse files Browse the repository at this point in the history
Telementry Changes
  • Loading branch information
vishnubansaltarento authored Dec 19, 2024
2 parents 75d2ac2 + ec7f920 commit 4c6a59d
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 17 deletions.
5 changes: 3 additions & 2 deletions src/app/routes/public/public-crp/public-crp.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@
</ng-container>

<ng-template #invalidLinkTemplate let-data>
<div class="flex flex-col justify-center items-center h-full items-center text-center">
{{ data }}
<div class="relative">
<div class="close-error-modal" *ngIf="data?.type === 'expiredLink'" (click)="dialogRef?.close()"><mat-icon>close</mat-icon></div>
<div class="flex flex-col justify-center items-center h-full items-center text-center mt-6" [innerHtml]="data?.message"></div>
</div>
</ng-template>
7 changes: 7 additions & 0 deletions src/app/routes/public/public-crp/public-crp.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -806,4 +806,11 @@ a.help-icon {
right: 0;
color: grey;
}
}

.close-error-modal {
position: absolute;
top: -32px;
right: 0;
cursor: pointer;
}
58 changes: 45 additions & 13 deletions src/app/routes/public/public-crp/public-crp.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class PublicCrpComponent {
selectedLanguage = 'en';
multiLang: any = [];
isMultiLangEnabled: any;

dialogRef: any
organizationDetails: IOrganizationDetails | null = null;
frameworkDetails: any;
organisationsList: any[] = [];
Expand All @@ -108,6 +108,7 @@ export class PublicCrpComponent {
@ViewChild('invalidLinkTemplate') invalidLinkTemplateRef!: TemplateRef<any>;
@ViewChild('emailOTPComponent') emailOTPComponent!: AppOtpReaderComponent;
@ViewChild('phoneOTPComponent') phoneOTPComponent!: AppOtpReaderComponent;
crpPath: string = '';

constructor(
private signupSvc: SignupService,
Expand Down Expand Up @@ -173,6 +174,14 @@ export class PublicCrpComponent {
this.configSvc.instanceConfig.isMultilingualEnabled;
}

const fullPath = this.activatedRoute.snapshot.url.map(segment => segment.path).join('/');
if(fullPath) {
const crpIndex = fullPath.indexOf('crp/');
if (crpIndex !== -1) {
this.crpPath = fullPath.slice(crpIndex);
}
}

this.raiseImpressionTelemetry()
}

Expand Down Expand Up @@ -201,10 +210,10 @@ export class PublicCrpComponent {
this.invalidLinkMessage !== 'Registration link is not active'
) {
setTimeout(() => {
this.dialog.open(this.invalidLinkTemplateRef, {
this.dialogRef = this.dialog.open(this.invalidLinkTemplateRef, {
width: '400px',
height: '200px',
data: this.invalidLinkMessage,
data: {message: this.invalidLinkMessage, type: 'invalidLink'},
disableClose: true,
});
}, 200);
Expand All @@ -213,10 +222,15 @@ export class PublicCrpComponent {
this.invalidLinkMessage == 'Registration link is not active'
) {
setTimeout(() => {
this.dialog.open(this.invalidLinkTemplateRef, {
const message = this.sanitizer.bypassSecurityTrustHtml(
'Registrations are closed as of now. Please reach out to your department MDO or write to us at ' +
'<a href="mailto:mission.karmayogi@gov.in?subject=Support Request&body=Please provide your organization and designation details." ' +
'target="_blank">mission.karmayogi@gov.in</a>'
);
this.dialogRef = this.dialog.open(this.invalidLinkTemplateRef, {
width: '400px',
height: '200px',
data: 'Registrations are closed as of now please reach out to your department MDO or please write us at mission.karmayogi@gov.in with organization and designation name',
data: { type: 'expiredLink', message : message},
disableClose: true,
});
}, 200)
Expand Down Expand Up @@ -514,7 +528,6 @@ export class PublicCrpComponent {
}

signup() {
this.raiseSignupInteractTelementry()
this.disableBtn = true;
// this.recaptchaSubscription = this.recaptchaV3Service
// .execute('importantAction')
Expand Down Expand Up @@ -549,6 +562,7 @@ export class PublicCrpComponent {
this.openDialog();
this.disableBtn = false;
this.isMobileVerified = true;
this.raiseSignupInteractTelementry()

},
(err: any) => {
Expand Down Expand Up @@ -760,19 +774,37 @@ export class PublicCrpComponent {
pageid: "/crp"
},
{},
{
module: "Self Registration",
}
)

setTimeout(() => {
this.telemetrySvc.end(
{
type: WsEvents.EnumInteractTypes.CLICK,
id: 'sign-up',
pageid: "/crp"
}, {},
{
module: "Self Registration",
})

}, 2000);

}

raiseImpressionTelemetry() {
this.telemetrySvc.impression(
setTimeout(() => {
this.telemetrySvc.end(
{
type: "view",
pageid: "/crp",
uri: this.router.url,
},{
type: "view",
pageid: "/crp",
uri: this.crpPath,
}, {}, {
module: "Self Registration",
}
)
})
}, 2000);
}

onFilterDesignation(value: string): void {
Expand Down
35 changes: 33 additions & 2 deletions src/app/routes/public/public-signup/public-signup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy, Inject, PLATFORM_ID } from '@angular/core
import { Subscription, Observable, interval } from 'rxjs'
import { UntypedFormGroup, UntypedFormControl, Validators, AbstractControl, ValidatorFn } from '@angular/forms'
import { SignupService } from './signup.service'
import { LoggerService, ConfigurationsService, NsInstanceConfig, MultilingualTranslationsService } from '@sunbird-cb/utils-v2'
import { LoggerService, ConfigurationsService, NsInstanceConfig, MultilingualTranslationsService, WsEvents, EventService, TelemetryService } from '@sunbird-cb/utils-v2'
import { startWith, map, pairwise } from 'rxjs/operators'
import { environment } from 'src/environments/environment'
import { ReCaptchaV3Service } from 'ng-recaptcha'
Expand Down Expand Up @@ -161,7 +161,9 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
private translate: TranslateService,
private langtranslations: MultilingualTranslationsService,
private http: HttpClient,
private sanitizer: DomSanitizer
private sanitizer: DomSanitizer,
private eventService: EventService,
private telemetrySvc: TelemetryService
) {
if (localStorage.getItem('websiteLanguage')) {
this.translate.setDefaultLang('en')
Expand Down Expand Up @@ -682,6 +684,7 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
this.openDialog()
this.disableBtn = false
this.isMobileVerified = true
this.raiseSignupInteractTelementry()
},
(err: any) => {
this.disableBtn = false
Expand Down Expand Up @@ -829,4 +832,32 @@ export class PublicSignupComponent implements OnInit, OnDestroy {
}
webFormxhr.send()
}

raiseSignupInteractTelementry() {
this.eventService.raiseInteractTelemetry(
{
type: WsEvents.EnumInteractTypes.CLICK,
id: 'sign-up',
pageid: "/public/signup"
},
{},
{
module: "User Registration",
}
)

setTimeout(() => {
this.telemetrySvc.end(
{
type: WsEvents.EnumInteractTypes.CLICK,
id: 'sign-up',
pageid: "/public/signup"
}, {},
{
module: "User Registration",
})

}, 2000);

}
}

0 comments on commit 4c6a59d

Please sign in to comment.