@@ -608,27 +608,6 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
608608 if ( ! flexCardAssessmentInfo . dependenciesLWC . includes ( lwcName ) ) {
609609 flexCardAssessmentInfo . dependenciesLWC . push ( lwcName ) ;
610610 }
611- } else if ( ! flexCardAssessmentInfo . dependenciesLWC . includes ( lwcName ) ) {
612- // Regular LWC dependency
613- flexCardAssessmentInfo . dependenciesLWC . push ( lwcName ) ;
614- // Check if this is a FlexCard reference (starts with "cf" prefix)
615- if ( lwcName . startsWith ( 'cf' ) ) {
616- const originalFlexCardName = lwcName . substring ( 2 ) ;
617- const cleanedFlexCardName = this . cleanName ( originalFlexCardName ) ;
618- if ( originalFlexCardName !== cleanedFlexCardName ) {
619- flexCardAssessmentInfo . warnings . push (
620- this . messages . getMessage ( 'cardLWCNameChangeMessage' , [ originalFlexCardName , cleanedFlexCardName ] )
621- ) ;
622- flexCardAssessmentInfo . migrationStatus = getUpdatedAssessmentStatus (
623- flexCardAssessmentInfo . migrationStatus as
624- | 'Warnings'
625- | 'Needs manual intervention'
626- | 'Ready for migration'
627- | 'Failed' ,
628- 'Warnings'
629- ) ;
630- }
631- }
632611 }
633612 }
634613
@@ -1825,47 +1804,29 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
18251804 }
18261805 }
18271806
1828- // 4. Handle flyoutLwc (Custom LWC or FlexCard reference)
1829- if ( stateAction . flyoutLwc ) {
1830- const lwcName = stateAction . flyoutLwc ;
1807+ // 4. Handle omniType.Name (OmniScript)
1808+ if ( stateAction . omniType && stateAction . omniType . Name ) {
1809+ this . updateOmniTypeNameWithRegistry ( stateAction . omniType ) ;
1810+ }
18311811
1832- // Check if this is a FlexCard reference when flyoutType is "childCard"
1812+ // 5. Handle osName (OmniScript - Flyout OmniScripts)
1813+ if ( stateAction . osName && typeof stateAction . osName === 'string' ) {
1814+ this . updateOsNameWithRegistry ( stateAction , 'osName' ) ;
1815+ }
1816+
1817+ // 6. Handle flyoutLwc (Custom LWC or FlexCard reference)
1818+ if ( stateAction . flyoutLwc ) {
18331819 if ( stateAction . flyoutType === 'childCard' ) {
18341820 // flyoutLwc is a direct FlexCard name reference
1821+ const lwcName = stateAction . flyoutLwc ;
18351822 if ( this . nameRegistry . hasFlexCardMapping ( lwcName ) ) {
18361823 stateAction . flyoutLwc = this . nameRegistry . getFlexCardCleanedName ( lwcName ) ;
18371824 } else {
18381825 Logger . logVerbose ( `\n${ this . messages . getMessage ( 'componentMappingNotFound' , [ 'Flexcard' , lwcName ] ) } ` ) ;
18391826 stateAction . flyoutLwc = this . cleanName ( lwcName ) ;
18401827 }
18411828 } else if ( stateAction . flyoutType === Constants . OmniScriptPluralName && stateAction . osName ) {
1842- // flyoutLwc is an OmniScript-derived LWC name - will be updated after osName is processed
1843- // (handled below after osName update)
1844- } else if ( lwcName . startsWith ( 'cf' ) ) {
1845- // Check if this is a FlexCard reference (starts with "cf" prefix)
1846- const originalFlexCardName = lwcName . substring ( 2 ) ;
1847- if ( this . nameRegistry . hasFlexCardMapping ( originalFlexCardName ) ) {
1848- stateAction . flyoutLwc = `cf${ this . nameRegistry . getFlexCardCleanedName ( originalFlexCardName ) } ` ;
1849- } else {
1850- Logger . logVerbose (
1851- `\n${ this . messages . getMessage ( 'componentMappingNotFound' , [ 'Flexcard' , originalFlexCardName ] ) } `
1852- ) ;
1853- stateAction . flyoutLwc = `cf${ this . cleanName ( originalFlexCardName ) } ` ;
1854- }
1855- }
1856- // Note: Non-cf LWC names that are not childCard flyouts don't need cleaning
1857- }
1858-
1859- // 5. Handle omniType.Name (OmniScript)
1860- if ( stateAction . omniType && stateAction . omniType . Name ) {
1861- this . updateOmniTypeNameWithRegistry ( stateAction . omniType ) ;
1862- }
1863-
1864- // 6. Handle osName (OmniScript - Flyout OmniScripts)
1865- if ( stateAction . osName && typeof stateAction . osName === 'string' ) {
1866- this . updateOsNameWithRegistry ( stateAction , 'osName' ) ;
1867- // Also update flyoutLwc if it's an OmniScript-derived LWC name
1868- if ( stateAction . flyoutLwc && stateAction . flyoutType === Constants . OmniScriptPluralName ) {
1829+ // flyoutLwc is an OmniScript-derived LWC name - derive from already-updated osName
18691830 stateAction . flyoutLwc = this . convertOsNameToLwcName ( stateAction . osName ) ;
18701831 }
18711832 }
@@ -2077,6 +2038,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
20772038 component . property . stateAction . osName
20782039 ) {
20792040 this . updateOsNameWithRegistry ( component . property . stateAction , 'osName' ) ;
2041+ // Also update flyoutLwc - it's the kebab-case LWC name derived from OmniScript
2042+ if ( component . property . stateAction . flyoutLwc ) {
2043+ component . property . stateAction . flyoutLwc = this . convertOsNameToLwcName ( component . property . stateAction . osName ) ;
2044+ }
20802045 }
20812046 // Handle Flyout childCard reference - flyoutLwc is a direct FlexCard name
20822047 if (
@@ -2140,6 +2105,13 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
21402105 ? `${ this . cleanName ( parts [ 0 ] ) } /${ this . cleanName ( parts [ 1 ] ) } /${ parts [ 2 ] } `
21412106 : parts . map ( ( p ) => this . cleanName ( p ) ) . join ( '/' ) ;
21422107 }
2108+
2109+ // Also update flyoutLwc if it exists - it's the kebab-case LWC name derived from OmniScript
2110+ if ( component . property . flyoutOmniScript . flyoutLwc ) {
2111+ component . property . flyoutOmniScript . flyoutLwc = this . convertOsNameToLwcName (
2112+ component . property . flyoutOmniScript . osName
2113+ ) ;
2114+ }
21432115 }
21442116 }
21452117 }
@@ -2223,9 +2195,14 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
22232195
22242196 /**
22252197 * Convert OmniScript name (Type/SubType/Language) to kebab-case LWC component name
2198+ * The flyoutLwc is derived by converting each part of osName to kebab-case and joining with hyphens
22262199 * Example: "docGenerationSample/CoreSingleDocxLWC/English" -> "doc-generation-sample-core-single-docx-l-w-c-english"
2200+ * Example: "flexcard/dev/English" -> "flexcard-dev-english"
22272201 */
22282202 private convertOsNameToLwcName ( osName : string ) : string {
2203+ if ( ! osName ) {
2204+ return '' ;
2205+ }
22292206 // Split by / and convert each part to kebab-case, then join with -
22302207 const parts = osName . split ( '/' ) ;
22312208 const kebabParts = parts . map ( ( part ) => this . camelToKebab ( part ) ) ;
@@ -2234,9 +2211,13 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
22342211
22352212 /**
22362213 * Convert camelCase or PascalCase string to kebab-case
2214+ * Example: "docGenerationSample" -> "doc-generation-sample"
22372215 * Example: "CoreSingleDocxLWC" -> "core-single-docx-l-w-c"
22382216 */
22392217 private camelToKebab ( str : string ) : string {
2218+ if ( ! str ) {
2219+ return '' ;
2220+ }
22402221 return str
22412222 . replace ( / ( [ a - z 0 - 9 ] ) ( [ A - Z ] ) / g, '$1-$2' ) // Insert hyphen between lowercase/digit and uppercase
22422223 . replace ( / ( [ A - Z ] ) ( [ A - Z ] [ a - z ] ) / g, '$1-$2' ) // Insert hyphen between consecutive uppercase followed by lowercase
0 commit comments