diff --git a/apps/36-blocks-widget/src/app/app.component.ts b/apps/36-blocks-widget/src/app/app.component.ts index 9b66aed2..65b222f5 100644 --- a/apps/36-blocks-widget/src/app/app.component.ts +++ b/apps/36-blocks-widget/src/app/app.component.ts @@ -8,6 +8,7 @@ import { WidgetThemeService } from './otp/service/widget-theme.service'; const REFERENCE_ID = '4512365b177668815069e61c1692def'; const THEME: WidgetTheme = WidgetTheme.System; const TYPE: PublicScriptType = PublicScriptType.UserProfile; +const OPEN_EDIT_PROFILE = true; const AUTH_TOKEN = 'VnNwWTNwWEZYV2VicU1mWElaNjU2S08vZS94N3JxVVhCcUt2RU9KVy9JZ1BlWEJPczlTeU1ZNlowRVRrbVFPVGNIT09XNjJRelB3VXg0V0kyR1NGSEc3Q1VjRTNKVGJrVnk4WWMwdWJWYTBrUGJYYSs4UXpqdVkwOGVnOHI4Sk1DRW5lZDdxODFTTk14SC9UczVFTGJReWZyTmg4NHRKZVBOTFRPdzlMS2xOb29IcmZZWkhTd0FwUnBoRTY5TjJJOU1VbUdKeEhRdzRhTHFlSFpxaTByQT09'; @@ -54,6 +55,7 @@ export class AppComponent extends BaseComponent implements OnInit, OnDestroy { if (!environment.production) { const widgetConfig: WidgetConfig = { referenceId: REFERENCE_ID, // Always pass referenceId + target: '_self', // '_blank' | '_self' success: (data: unknown) => { console.log('Success response:', data); @@ -78,6 +80,11 @@ export class AppComponent extends BaseComponent implements OnInit, OnDestroy { widgetConfig['isRolePermission'] = false; } + if (TYPE === PublicScriptType.UserProfile) { + // Auto-open the Edit Profile dialog on load + widgetConfig['openEditProfile'] = false; + } + // Note: Currently Subscription widget is not in use. if (TYPE === PublicScriptType.Subscription) { // Use in Subscription widget to redirect diff --git a/apps/36-blocks-widget/src/app/init-verification.ts b/apps/36-blocks-widget/src/app/init-verification.ts index 05f7b746..c5a8cf49 100644 --- a/apps/36-blocks-widget/src/app/init-verification.ts +++ b/apps/36-blocks-widget/src/app/init-verification.ts @@ -84,6 +84,7 @@ if (!window.initVerification) { widgetElement.isRolePermission = config?.isRolePermission; widgetElement.isPreview = config?.isPreview; widgetElement.isLogin = config?.isLogin; + widgetElement.openEditProfile = config?.openEditProfile; widgetElement.loginRedirectUrl = config?.loginRedirectUrl; widgetElement.theme = config?.theme; widgetElement.version = config?.version; diff --git a/apps/36-blocks-widget/src/app/otp/user-profile/user-profile.component.ts b/apps/36-blocks-widget/src/app/otp/user-profile/user-profile.component.ts index 077f249a..75e4b136 100644 --- a/apps/36-blocks-widget/src/app/otp/user-profile/user-profile.component.ts +++ b/apps/36-blocks-widget/src/app/otp/user-profile/user-profile.component.ts @@ -83,6 +83,8 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After public target = input(); public showCard = input(); public theme = input(); + public openEditProfile = input(false); + private hasAutoOpenedEditDialog = false; protected readonly WidgetTheme = WidgetTheme; private readonly themeService = inject(WidgetThemeService); readonly isDark = computed(() => this.themeService.isDark$()); @@ -238,6 +240,11 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After const mobile = res?.mobile && res.mobile !== '--Not Provided--' ? res.mobile : ''; this.previousMobile = mobile; this.clientForm.get('mobile').setValue(mobile); + + if (this.openEditProfile() && !this.hasAutoOpenedEditDialog) { + this.hasAutoOpenedEditDialog = true; + this.openEditDialog(); + } } }); diff --git a/apps/36-blocks-widget/src/app/otp/widget/widget.component.html b/apps/36-blocks-widget/src/app/otp/widget/widget.component.html index 88435228..bd57af5d 100644 --- a/apps/36-blocks-widget/src/app/otp/widget/widget.component.html +++ b/apps/36-blocks-widget/src/app/otp/widget/widget.component.html @@ -28,7 +28,11 @@ } @case (PublicScriptType.UserProfile) { - + } } diff --git a/apps/36-blocks-widget/src/app/otp/widget/widget.component.ts b/apps/36-blocks-widget/src/app/otp/widget/widget.component.ts index edf96c3e..033297fc 100644 --- a/apps/36-blocks-widget/src/app/otp/widget/widget.component.ts +++ b/apps/36-blocks-widget/src/app/otp/widget/widget.component.ts @@ -102,6 +102,7 @@ export class ProxyAuthWidgetComponent extends BaseComponent implements OnInit, O @Input() public type: string; @Input() public isPreview: boolean = false; @Input() public isLogin: boolean = false; + @Input() public openEditProfile: boolean = false; @Input() public theme: string; private readonly _authToken$ = signal(undefined); diff --git a/libs/constant/src/verification/verification.ts b/libs/constant/src/verification/verification.ts index 5e8fa25c..8ff6973c 100644 --- a/libs/constant/src/verification/verification.ts +++ b/libs/constant/src/verification/verification.ts @@ -22,6 +22,7 @@ export type WidgetConfig = { theme?: WidgetTheme; isPreview?: boolean; isLogin?: boolean; + openEditProfile?: boolean; // Auto-open the Edit Profile dialog on load (user-profile widget) loginRedirectUrl?: string; redirect_path?: string; // Optional: Path to redirect after login (e.g., '/dashboard') only used get proxy_auth_token in admin panel while preview target?: '_self' | '_blank';