Skip to content
Merged

Stage #645

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
7 changes: 7 additions & 0 deletions apps/36-blocks-widget/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions apps/36-blocks-widget/src/app/init-verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export class UserProfileComponent extends BaseComponent implements OnInit, After
public target = input<string>();
public showCard = input<boolean>();
public theme = input<string>();
public openEditProfile = input<boolean>(false);
private hasAutoOpenedEditDialog = false;
protected readonly WidgetTheme = WidgetTheme;
private readonly themeService = inject(WidgetThemeService);
readonly isDark = computed(() => this.themeService.isDark$());
Expand Down Expand Up @@ -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();
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
<organization-details [authToken]="authToken" [theme]="theme"></organization-details>
}
@case (PublicScriptType.UserProfile) {
<user-profile [authToken]="authToken" [theme]="theme"></user-profile>
<user-profile
[authToken]="authToken"
[theme]="theme"
[openEditProfile]="openEditProfile"
></user-profile>
}
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined>(undefined);
Expand Down
1 change: 1 addition & 0 deletions libs/constant/src/verification/verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading