1- /* eslint-disable */
2-
3- import { Connection , Messages , Org } from '@salesforce/core' ;
1+ import { Connection , Messages } from '@salesforce/core' ;
42import { UX } from '@salesforce/command' ;
53import { Logger } from '../utils/logger' ;
64import { Constants } from '../utils/constants/stringContants' ;
75import { OrgPreferences } from '../utils/orgPreferences' ;
8- import { BaseMigrationTool } from './base' ;
96import { askStringWithTimeout } from '../utils/promptUtil' ;
7+ import { YES_SHORT , YES_LONG , NO_SHORT , NO_LONG } from '../utils/projectPathUtil' ;
8+ import { BaseMigrationTool } from './base' ;
109
1110export class PreMigrate extends BaseMigrationTool {
12- private readonly org : Org ;
13-
1411 // Source Custom Object Names
15- constructor ( org : Org , namespace : string , connection : Connection , logger : Logger , messages : Messages , ux : UX ) {
12+ public constructor ( namespace : string , connection : Connection , logger : Logger , messages : Messages , ux : UX ) {
1613 super ( namespace , connection , logger , messages , ux ) ;
17- this . org = org ;
18- }
19-
20- // Just to disable org is unused error coming
21- public printOrgDetails ( ) : void {
22- try {
23- Logger . log ( JSON . stringify ( this . org ) ) ;
24- } catch ( e ) {
25- Logger . log ( e ) ;
26- }
2714 }
2815
2916 public async handleExperienceSitePrerequisites (
@@ -67,8 +54,9 @@ export class PreMigrate extends BaseMigrationTool {
6754 // This needs to be behind timeout
6855 private async getExpSiteMetadataEnableConsent ( ) : Promise < boolean > {
6956 const question = this . messages . getMessage ( 'consentForExperienceSites' ) ;
57+ const validResponse = false ;
7058
71- while ( true ) {
59+ while ( ! validResponse ) {
7260 try {
7361 // Get string input from user with timeout
7462 const userInput = await askStringWithTimeout (
@@ -80,19 +68,18 @@ export class PreMigrate extends BaseMigrationTool {
8068 // Validate and convert the input
8169 const normalizedInput = userInput . trim ( ) . toLowerCase ( ) ;
8270
83- if ( normalizedInput === 'y' || normalizedInput === 'yes' ) {
71+ if ( normalizedInput === YES_SHORT || normalizedInput === YES_LONG ) {
8472 return true ;
85- } else if ( normalizedInput === 'n' || normalizedInput === 'no' ) {
73+ } else if ( normalizedInput === NO_SHORT || normalizedInput === NO_LONG ) {
8674 return false ;
8775 } else {
8876 // Invalid input - show error and continue loop to re-prompt
8977 Logger . error ( this . messages . getMessage ( 'invalidYesNoResponse' ) ) ;
90- Logger . log ( 'Please enter "y" or "yes" to consent, "n" or "no" to decline.' ) ;
9178 }
9279 } catch ( error ) {
9380 // Handle timeout or other errors
94- Logger . error ( this . messages . getMessage ( 'failedToGetConsentError' , [ error . message ] ) ) ;
95- throw error ; // Re-throw to let caller handle timeout
81+ Logger . error ( this . messages . getMessage ( 'requestTimedOut' ) ) ;
82+ process . exit ( 1 ) ;
9683 }
9784 }
9885 }
0 commit comments