Skip to content
Merged

Stage #644

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/36-blocks-widget/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { WidgetThemeService } from './otp/service/widget-theme.service';

const REFERENCE_ID = '4512365b177668815069e61c1692def';
const THEME: WidgetTheme = WidgetTheme.System;
const TYPE: PublicScriptType = PublicScriptType.Authorization;
const AUTH_TOKEN = '';
const TYPE: PublicScriptType = PublicScriptType.UserProfile;
const AUTH_TOKEN =
'VnNwWTNwWEZYV2VicU1mWElaNjU2S08vZS94N3JxVVhCcUt2RU9KVy9JZ1BlWEJPczlTeU1ZNlowRVRrbVFPVGNIT09XNjJRelB3VXg0V0kyR1NGSEc3Q1VjRTNKVGJrVnk4WWMwdWJWYTBrUGJYYSs4UXpqdVkwOGVnOHI4Sk1DRW5lZDdxODFTTk14SC9UczVFTGJReWZyTmg4NHRKZVBOTFRPdzlMS2xOb29IcmZZWkhTd0FwUnBoRTY5TjJJOU1VbUdKeEhRdzRhTHFlSFpxaTByQT09';

@Component({
selector: 'proxy-root',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,13 @@ <h2 id="edit-profile-title" class="w-dialog-title">Edit Profile</h2>
id="profile-mobile-readonly"
type="text"
[value]="displayMobile"
placeholder="Not provided"
placeholder="Enter your mobile number"
readonly
aria-readonly="true"
class="w-input-readonly"
(click)="startEditMobile()"
class="w-input-readonly read-only:cursor-pointer! read-only:opacity-100!"
/>
</div>
<button type="button" (click)="startEditMobile()" class="w-btn-secondary-sm shrink-0">
Edit
</button>
</div>
} @else {
<p class="text-xs text-gray-500 dark:text-gray-400 mb-1">
Expand All @@ -338,8 +336,7 @@ <h2 id="edit-profile-title" class="w-dialog-title">Edit Profile</h2>
autocomplete="off"
class="w-input"
[class.border-red-500]="
getOtpError ||
(clientForm.get('mobile')?.touched && !isProfileMobileValid())
getOtpError || (showMobileValidation && !isProfileMobileValid())
"
(keypress)="onMobileKeypress($event)"
(input)="onMobileInput()"
Expand Down Expand Up @@ -393,10 +390,7 @@ <h2 id="edit-profile-title" class="w-dialog-title">Edit Profile</h2>
</div>
@if (getOtpError) {
<p role="alert" class="w-field-error">{{ getOtpError }}</p>
} @else if (
clientForm.get('mobile')?.touched && getProfileMobileValidationError();
as mobileError
) {
} @else if (showMobileValidation && getProfileMobileValidationError(); as mobileError) {
<p role="alert" class="w-field-error">{{ mobileError }}</p>
} @else if (clientForm.get('mobile')?.errors?.otpVerificationFailed) {
<p role="alert" class="w-field-error">Please verify the mobile number.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After
public isMobileOtpVerified = false;
public isMobileOtpSent = false;
public isNumberChanged = false;
public showMobileValidation = false;
public otpError = '';
public getOtpError = '';
public resendTimer = 0;
Expand Down Expand Up @@ -349,7 +350,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After
public get displayMobile(): string {
const value = this.clientForm.get('mobile')?.value;
if (!value || value === '--Not Provided--') {
return 'Not provided';
return '';
}
return value;
}
Expand Down Expand Up @@ -419,7 +420,6 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After

public onMobileBlur(): void {
const mobileControl = this.clientForm.get('mobile');
mobileControl?.markAsTouched();
const digits = this.getMobileIdentifier();
if (digits !== mobileControl?.value) {
mobileControl?.setValue(digits, { emitEvent: false });
Expand Down Expand Up @@ -469,6 +469,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After
mobileControl.setErrors(null);
}
mobileControl.markAsTouched();
this.showMobileValidation = true;
if (!this.isProfileMobileValid()) {
this.cdr.detectChanges();
return;
Expand Down Expand Up @@ -519,6 +520,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After
this.isMobileOtpVerified = false;
this.otpVerificationToken = '';
this.getOtpError = '';
this.showMobileValidation = false;
this.otpForm.reset();
const value = this.getMobileIdentifier();
if (value !== this.lastSentMobileNumber) {
Expand Down Expand Up @@ -622,6 +624,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After
private resetMobileOtpState(): void {
this.isMobileOtpVerified = false;
this.isMobileOtpSent = false;
this.showMobileValidation = false;
this.otpError = '';
this.getOtpError = '';
this.lastSentMobileNumber = '';
Expand Down Expand Up @@ -698,6 +701,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After

if (mobileChanged && enteredMobile && !this.isProfileMobileValid()) {
mobileControl.markAsTouched();
this.showMobileValidation = true;
this.cdr.detectChanges();
return;
}
Expand Down
Loading