@@ -1620,8 +1620,14 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
16201620 content = JSON . parse ( content ) ;
16211621 if ( content && content [ 'sOmniScriptId' ] ) {
16221622 content [ 'sOmniScriptId' ] = omniProcessId ;
1623- mappedObject [ OmniScriptDefinitionMappings . Content__c ] = JSON . stringify ( content ) ;
16241623 }
1624+
1625+ // Process the nested JSON structure to update bundle/reference names
1626+ if ( content && content [ 'children' ] ) {
1627+ this . processContentChildren ( content [ 'children' ] ) ;
1628+ }
1629+
1630+ mappedObject [ OmniScriptDefinitionMappings . Content__c ] = JSON . stringify ( content ) ;
16251631 } catch ( ex ) {
16261632 // Log
16271633 }
@@ -1636,6 +1642,210 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
16361642 return mappedObject ;
16371643 }
16381644
1645+ /**
1646+ * Recursively processes children elements in the content JSON to update bundle/reference names
1647+ * @param children Array of child elements from the content JSON
1648+ */
1649+ private processContentChildren ( children : any [ ] ) : void {
1650+ if ( ! Array . isArray ( children ) ) {
1651+ return ;
1652+ }
1653+
1654+ children . forEach ( ( child ) => {
1655+ if ( child && child . type && child . propSetMap ) {
1656+ this . processContentElement ( child ) ;
1657+ }
1658+
1659+ // Process nested children in Step elements
1660+ if ( child && child . children && Array . isArray ( child . children ) ) {
1661+ child . children . forEach ( ( nestedChild ) => {
1662+ if ( nestedChild && nestedChild . eleArray && Array . isArray ( nestedChild . eleArray ) ) {
1663+ nestedChild . eleArray . forEach ( ( element ) => {
1664+ if ( element && element . type && element . propSetMap ) {
1665+ this . processContentElement ( element ) ;
1666+ }
1667+ } ) ;
1668+ }
1669+ } ) ;
1670+ }
1671+ } ) ;
1672+ }
1673+
1674+ /**
1675+ * Processes individual content element to update bundle/reference names based on type
1676+ * @param element Individual element from the content JSON
1677+ */
1678+ private processContentElement ( element : any ) : void {
1679+ const elementType = element . type ;
1680+ const propSetMap = element . propSetMap ;
1681+
1682+ if ( ! elementType || ! propSetMap ) {
1683+ return ;
1684+ }
1685+
1686+ switch ( elementType ) {
1687+ case 'Integration Procedure Action' :
1688+ this . processIntegrationProcedureAction ( propSetMap ) ;
1689+ break ;
1690+ case 'DataRaptor Turbo Action' :
1691+ case 'DataRaptor Transform Action' :
1692+ case 'DataRaptor Post Action' :
1693+ case 'DataRaptor Extract Action' :
1694+ this . processDataRaptorAction ( propSetMap ) ;
1695+ break ;
1696+ case 'OmniScript' :
1697+ this . processOmniScriptAction ( propSetMap ) ;
1698+ break ;
1699+ case 'Step' :
1700+ this . processStepAction ( propSetMap ) ;
1701+ break ;
1702+ default :
1703+ // Handle other element types if needed
1704+ break ;
1705+ }
1706+ }
1707+
1708+ /**
1709+ * Processes Integration Procedure Action elements to update reference names
1710+ * @param propSetMap Property set map from the element
1711+ */
1712+ private processIntegrationProcedureAction ( propSetMap : any ) : void {
1713+ // Handle remoteOptions pre/post transform bundles
1714+ if ( propSetMap . remoteOptions ) {
1715+ if ( propSetMap . remoteOptions . preTransformBundle ) {
1716+ const bundleName = propSetMap . remoteOptions . preTransformBundle ;
1717+ if ( this . nameRegistry . hasDataMapperMapping ( bundleName ) ) {
1718+ propSetMap . remoteOptions . preTransformBundle = this . nameRegistry . getDataMapperCleanedName ( bundleName ) ;
1719+ } else {
1720+ propSetMap . remoteOptions . preTransformBundle = this . cleanName ( bundleName ) ;
1721+ }
1722+ }
1723+
1724+ if ( propSetMap . remoteOptions . postTransformBundle ) {
1725+ const bundleName = propSetMap . remoteOptions . postTransformBundle ;
1726+ if ( this . nameRegistry . hasDataMapperMapping ( bundleName ) ) {
1727+ propSetMap . remoteOptions . postTransformBundle = this . nameRegistry . getDataMapperCleanedName ( bundleName ) ;
1728+ } else {
1729+ propSetMap . remoteOptions . postTransformBundle = this . cleanName ( bundleName ) ;
1730+ }
1731+ }
1732+ }
1733+
1734+ // Handle direct pre/post transform bundles
1735+ if ( propSetMap . preTransformBundle ) {
1736+ const bundleName = propSetMap . preTransformBundle ;
1737+ if ( this . nameRegistry . hasDataMapperMapping ( bundleName ) ) {
1738+ propSetMap . preTransformBundle = this . nameRegistry . getDataMapperCleanedName ( bundleName ) ;
1739+ } else {
1740+ propSetMap . preTransformBundle = this . cleanName ( bundleName ) ;
1741+ }
1742+ }
1743+
1744+ if ( propSetMap . postTransformBundle ) {
1745+ const bundleName = propSetMap . postTransformBundle ;
1746+ if ( this . nameRegistry . hasDataMapperMapping ( bundleName ) ) {
1747+ propSetMap . postTransformBundle = this . nameRegistry . getDataMapperCleanedName ( bundleName ) ;
1748+ } else {
1749+ propSetMap . postTransformBundle = this . cleanName ( bundleName ) ;
1750+ }
1751+ }
1752+
1753+ // Handle integrationProcedureKey
1754+ if ( propSetMap . integrationProcedureKey ) {
1755+ const key = propSetMap . integrationProcedureKey ;
1756+ if ( this . nameRegistry . hasIntegrationProcedureMapping ( key ) ) {
1757+ propSetMap . integrationProcedureKey = this . nameRegistry . getIntegrationProcedureCleanedName ( key ) ;
1758+ } else {
1759+ const parts = key . split ( '_' ) ;
1760+ // Integration Procedures should have Type_SubType format (2 parts)
1761+ if ( parts . length > 2 ) {
1762+ Logger . logVerbose ( this . messages . getMessage ( 'integrationProcedureInvalidUnderscoreFormat' , [ key ] ) ) ;
1763+ return ;
1764+ }
1765+
1766+ propSetMap . integrationProcedureKey = parts . map ( ( p ) => this . cleanName ( p , true ) ) . join ( '_' ) ;
1767+ }
1768+ }
1769+ }
1770+
1771+ /**
1772+ * Processes DataRaptor Action elements to update bundle names
1773+ * @param propSetMap Property set map from the element
1774+ */
1775+ private processDataRaptorAction ( propSetMap : any ) : void {
1776+ if ( propSetMap . bundle ) {
1777+ const bundleName = propSetMap . bundle ;
1778+ if ( this . nameRegistry . hasDataMapperMapping ( bundleName ) ) {
1779+ propSetMap . bundle = this . nameRegistry . getDataMapperCleanedName ( bundleName ) ;
1780+ } else {
1781+ propSetMap . bundle = this . cleanName ( bundleName ) ;
1782+ }
1783+ }
1784+ }
1785+
1786+ /**
1787+ * Processes OmniScript Action elements to update reference names
1788+ * @param propSetMap Property set map from the element
1789+ */
1790+ private processOmniScriptAction ( propSetMap : any ) : void {
1791+ const osType = propSetMap [ 'Type' ] || '' ;
1792+ const osSubType = propSetMap [ 'Sub Type' ] || '' ;
1793+ const osLanguage = propSetMap [ 'Language' ] || 'English' ;
1794+
1795+ // Construct full OmniScript name to check registry
1796+ const fullOmniScriptName = `${ osType } _${ osSubType } _${ osLanguage } ` ;
1797+
1798+ if ( this . nameRegistry . isAngularOmniScript ( fullOmniScriptName ) ) {
1799+ // Keep original reference as-is since Angular OmniScript won't be migrated
1800+ return ;
1801+ } else if ( this . nameRegistry . hasOmniScriptMapping ( fullOmniScriptName ) ) {
1802+ // Registry has mapping for this LWC OmniScript - extract cleaned parts
1803+ const cleanedFullName = this . nameRegistry . getCleanedName ( fullOmniScriptName , 'OmniScript' ) ;
1804+ const parts = cleanedFullName . split ( '_' ) ;
1805+
1806+ if ( parts . length >= 2 ) {
1807+ propSetMap [ 'Type' ] = parts [ 0 ] ;
1808+ propSetMap [ 'Sub Type' ] = parts [ 1 ] ;
1809+ // Language doesn't typically change, but update if provided
1810+ if ( parts . length >= 3 ) {
1811+ propSetMap [ 'Language' ] = parts [ 2 ] ;
1812+ }
1813+ }
1814+ } else {
1815+ // No registry mapping - use original fallback approach
1816+ propSetMap [ 'Type' ] = this . cleanName ( osType ) ;
1817+ propSetMap [ 'Sub Type' ] = this . cleanName ( osSubType ) ;
1818+ }
1819+ }
1820+
1821+ /**
1822+ * Processes Step elements to update reference names
1823+ * @param propSetMap Property set map from the element
1824+ */
1825+ private processStepAction ( propSetMap : any ) : void {
1826+ // Handle remoteOptions pre/post transform bundles if they exist in Step elements
1827+ // Note: remoteClass and remoteMethod cleaning is not required for omniscript content step dependencies
1828+ if ( propSetMap . remoteOptions ) {
1829+ if ( propSetMap . remoteOptions . preTransformBundle ) {
1830+ const bundleName = propSetMap . remoteOptions . preTransformBundle ;
1831+ if ( this . nameRegistry . hasDataMapperMapping ( bundleName ) ) {
1832+ propSetMap . remoteOptions . preTransformBundle = this . nameRegistry . getDataMapperCleanedName ( bundleName ) ;
1833+ } else {
1834+ propSetMap . remoteOptions . preTransformBundle = this . cleanName ( bundleName ) ;
1835+ }
1836+ }
1837+
1838+ if ( propSetMap . remoteOptions . postTransformBundle ) {
1839+ const bundleName = propSetMap . remoteOptions . postTransformBundle ;
1840+ if ( this . nameRegistry . hasDataMapperMapping ( bundleName ) ) {
1841+ propSetMap . remoteOptions . postTransformBundle = this . nameRegistry . getDataMapperCleanedName ( bundleName ) ;
1842+ } else {
1843+ propSetMap . remoteOptions . postTransformBundle = this . cleanName ( bundleName ) ;
1844+ }
1845+ }
1846+ }
1847+ }
1848+
16391849 private getOmniScriptFields ( ) : string [ ] {
16401850 return Object . keys ( OmniScriptMappings ) ;
16411851 }
0 commit comments