@@ -42,13 +42,13 @@ module.exports = async function(vlocity, currentContextData, jobInfo, callback)
4242
4343 // add the OmniScript itself
4444 const currentOmniScriptLwc = await fetchOmniOutContents ( record [ vlocity . namespace + '__Type__c' ] + record [ vlocity . namespace + '__SubType__c' ] + record [ vlocity . namespace + '__Language__c' ] , vlocity ) ;
45- const parsedOmniScriptRes = await extractSources ( currentOmniScriptLwc [ 'compositeResponse' ] [ 1 ] [ 'body' ] [ 'records' ] ) ;
45+ const parsedOmniScriptRes = await extractSources ( currentOmniScriptLwc [ 'compositeResponse' ] [ 1 ] [ 'body' ] [ 'records' ] , vlocity . namespace ) ;
4646 await createFiles ( parsedOmniScriptRes , vlocity , 'modules' , `vlocityomniscript/${ record [ vlocity . namespace + '__Type__c' ] + record [ vlocity . namespace + '__SubType__c' ] + record [ vlocity . namespace + '__Language__c' ] } ` ) ;
4747
4848 // add all custom LWCs as well
4949 for ( const element of listOfCustomLwc ) {
5050 let retrieveLwcFile = await fetchOmniOutContents ( element , vlocity ) ;
51- let parsedSources = await extractSources ( retrieveLwcFile [ 'compositeResponse' ] [ 1 ] [ 'body' ] [ 'records' ] ) ;
51+ let parsedSources = await extractSources ( retrieveLwcFile [ 'compositeResponse' ] [ 1 ] [ 'body' ] [ 'records' ] , vlocity . namespace ) ;
5252 await createFiles ( parsedSources , vlocity , 'modules' , `c/${ element } ` ) ;
5353 }
5454
@@ -156,9 +156,10 @@ const fetchOmniOutContents = async(lwc, vlocity) => {
156156/**
157157 *
158158 * @param {* } items
159+ * @param {* } namespace
159160 * @returns
160161 */
161- const extractSources = async ( items ) => {
162+ const extractSources = async ( items , namespace ) => {
162163 return new Promise ( async ( resolve , reject ) => {
163164
164165 let parsed = [ ] ;
@@ -176,7 +177,7 @@ const extractSources = async (items) => {
176177 if ( i [ 'Source' ] === "(hidden)" ) {
177178 console . log ( 'Skipping path' ) ;
178179 } else {
179- parsed [ path ] = await parseSource ( i [ 'Source' ] ) ;
180+ parsed [ path ] = await parseSource ( i [ 'Source' ] , namespace ) ;
180181 }
181182 } ) ;
182183 }
@@ -188,12 +189,13 @@ const extractSources = async (items) => {
188189/**
189190 *
190191 * @param {* } source
192+ * @param {* } namespace
191193 * @returns
192194 */
193- const parseSource = async ( source ) => {
195+ const parseSource = async ( source , namespace ) => {
194196 return new Promise ( ( resolve , reject ) => {
195- /* Rename imports vlocity_cmt -> c */
196- source = source . replace ( new RegExp ( 'vlocity_cmt' , 'g' ) , 'c' ) ;
197+ /* Rename imports like vlocity_cmt -> c */
198+ source = source . replace ( new RegExp ( namespace , 'g' ) , 'c' ) ;
197199
198200 resolve ( source ) ;
199201 } ) ;
0 commit comments