Skip to content

Commit c8cabe7

Browse files
committed
Merge branch 'prerelease/develop-ga' into assessment_fixes
2 parents 3b60c06 + f50c99a commit c8cabe7

File tree

7 files changed

+357
-47
lines changed

7 files changed

+357
-47
lines changed

messages/migrate.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@
205205
"startingComponentPreProcessing": "Pre-processing components for name mapping",
206206
"completeComponentMappingMessage": "Registered name mappings for %s components",
207207
"componentMappingNotFound": "No registry mapping found for %s component: %s, using fallback cleaning",
208-
"flexCardWithAngularOmniScriptWarning": "FlexCard has dependencies on Angular OmniScript(s) which are not migrated. Please convert OmniScript(s) to LWC before migrating this FlexCard.",
209-
"angularOmniScriptDependencyWarning": "Element '%s' references Angular OmniScript '%s' which will not be migrated. Consider converting the referenced OmniScript to LWC",
210-
"skipFlexcardAngularOmniScriptDependencyWarning": "Skipping FlexCard %s due to Angular OmniScript dependencies",
208+
"flexCardWithAngularOmniScriptWarning": "FlexCard has dependencies on Angular Omniscript(s) which are not migrated. Please convert OmniScript(s) to LWC before migrating this FlexCard.",
209+
"angularOmniScriptDependencyWarning": "Element '%s' references Angular Omniscript '%s' which will not be migrated. Consider converting the referenced OmniScript to LWC",
210+
"skipFlexcardAngularOmniScriptDependencyWarning": "Skipping FlexCard %s due to Angular Omniscript dependencies",
211211
"flexCardMigrationProcessingMessage": "Processing %s FlexCards for migration (%s skipped due to Angular dependencies)",
212212
"noMetadataToDeploy": "No metadata to deploy",
213213
"manifestDeployementStarted": "Manifest deployment started with ID: %s",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/plugin-omnistudio-migration-tool",
33
"description": "This SFDX plugin migrates FlexCard, OmniScript, DataRaptor, and Integration Procedure custom objects to standard objects.",
4-
"version": "2.0.0-rc.19",
4+
"version": "2.0.0-rc.20",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {
@@ -128,4 +128,4 @@
128128
"pre-push": "sf-husky-pre-push"
129129
}
130130
}
131-
}
131+
}

src/migration/flexcard.ts

Lines changed: 222 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
270270
const originalBundle = dataSource.value?.bundle;
271271
if (originalBundle) {
272272
const cleanedBundle: string = this.cleanName(originalBundle);
273-
flexCardAssessmentInfo.dependenciesDR.push(cleanedBundle);
273+
274+
// Push original name instead of cleaned name for assessment consistency
275+
flexCardAssessmentInfo.dependenciesDR.push(originalBundle);
274276

275277
// Add warning if DataRaptor name will change
276278
if (originalBundle !== cleanedBundle) {
@@ -287,7 +289,8 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
287289
const cleanedParts = parts.map((p) => this.cleanName(p, true));
288290
const cleanedIpMethod = cleanedParts.join('_');
289291

290-
flexCardAssessmentInfo.dependenciesIP.push(cleanedIpMethod);
292+
// Push original name instead of cleaned name for assessment consistency
293+
flexCardAssessmentInfo.dependenciesIP.push(originalIpMethod);
291294

292295
// Add warning if IP name will change
293296
if (originalIpMethod !== cleanedIpMethod) {
@@ -316,16 +319,29 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
316319
}
317320
}
318321

319-
// Check for OmniScript dependencies in the card's definition
322+
// Check for Omniscript dependencies in the card's definition
320323
try {
321324
const definition = JSON.parse(flexCard[this.namespacePrefix + 'Definition__c'] || '{}');
322325
if (definition && definition.states) {
323326
for (const state of definition.states) {
324327
if (state.omniscripts && Array.isArray(state.omniscripts)) {
325328
for (const os of state.omniscripts) {
326329
if (os.type && os.subtype) {
327-
const osRef = `${os.type}_${os.subtype}_${os.language || 'English'}`;
328-
flexCardAssessmentInfo.dependenciesOS.push(osRef);
330+
const originalOsRef = `${os.type}_${os.subtype}_${os.language || 'English'}`;
331+
const cleanedOsRef = `${this.cleanName(os.type)}_${this.cleanName(os.subtype)}_${
332+
os.language || 'English'
333+
}`;
334+
335+
// Push original name for consistency
336+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
337+
338+
// Add warning if OmniScript name will change
339+
if (originalOsRef !== cleanedOsRef) {
340+
flexCardAssessmentInfo.warnings.push(
341+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
342+
);
343+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
344+
}
329345
}
330346
}
331347
}
@@ -343,7 +359,21 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
343359
}
344360

345361
let childCards = this.readChildCardsFromDefinition(flexCard);
346-
flexCardAssessmentInfo.dependenciesFC.push(...childCards);
362+
// Add warnings for child card name changes
363+
for (const childCardName of childCards) {
364+
const cleanedChildCardName = this.cleanName(childCardName);
365+
366+
// Push original child card name for consistency
367+
flexCardAssessmentInfo.dependenciesFC.push(childCardName);
368+
369+
// Add warning if child card name will change
370+
if (childCardName !== cleanedChildCardName) {
371+
flexCardAssessmentInfo.warnings.push(
372+
this.messages.getMessage('cardNameChangeMessage', [childCardName, cleanedChildCardName])
373+
);
374+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
375+
}
376+
}
347377
} catch (err) {
348378
// Log the error but continue processing
349379
Logger.error(`Error parsing definition for card ${flexCard.Name}: ${err.message}`);
@@ -378,24 +408,56 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
378408
const parts = originalName.split('/');
379409

380410
if (parts.length >= 2) {
381-
// Check for name changes in each part
411+
// Create both original and cleaned references for comparison
412+
const originalOsRef = parts.join('_');
382413
const cleanedParts = parts.map((p) => this.cleanName(p));
383-
const cleanedName = cleanedParts.join('_');
384-
flexCardAssessmentInfo.dependenciesOS.push(cleanedName);
385-
386-
// Add warning if any part of the name will change
387-
for (let i = 0; i < parts.length; i++) {
388-
if (parts[i] !== cleanedParts[i]) {
389-
flexCardAssessmentInfo.warnings.push(
390-
this.messages.getMessage('omniScriptNameChangeMessage', [parts[i], cleanedParts[i]])
391-
);
392-
flexCardAssessmentInfo.migrationStatus = 'Warnings';
393-
}
414+
const cleanedOsRef = cleanedParts.join('_');
415+
416+
// Push original name for consistency
417+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
418+
419+
// Add warning only if the overall name will change
420+
if (originalOsRef !== cleanedOsRef) {
421+
flexCardAssessmentInfo.warnings.push(
422+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
423+
);
424+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
394425
}
395426
}
396427
}
397428
}
398429

430+
// MISSING PATTERN FIXED: Case 1b: Direct OmniScript reference without type check (for test compatibility)
431+
else if (action.stateAction.omniType && !action.stateAction.type) {
432+
const omniType = action.stateAction.omniType;
433+
// Handle both string omniType and object with Name property
434+
let omniTypeName: string;
435+
436+
if (typeof omniType === 'string') {
437+
omniTypeName = omniType;
438+
} else if (omniType.Name && typeof omniType.Name === 'string') {
439+
omniTypeName = omniType.Name;
440+
} else {
441+
continue; // Skip if we can't extract the name
442+
}
443+
444+
const parts = omniTypeName.split('/');
445+
if (parts.length >= 2) {
446+
const originalOsRef = parts.join('_');
447+
const cleanedParts = parts.map((p) => this.cleanName(p));
448+
const cleanedOsRef = cleanedParts.join('_');
449+
450+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
451+
452+
if (originalOsRef !== cleanedOsRef) {
453+
flexCardAssessmentInfo.warnings.push(
454+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
455+
);
456+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
457+
}
458+
}
459+
}
460+
399461
// Case 2: Flyout OmniScript reference
400462
else if (
401463
action.stateAction.type === 'Flyout' &&
@@ -409,19 +471,20 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
409471
const parts = originalName.split('/');
410472

411473
if (parts.length >= 2) {
412-
// Check for name changes in each part
474+
// Create both original and cleaned references for comparison
475+
const originalOsRef = parts.join('_');
413476
const cleanedParts = parts.map((p) => this.cleanName(p));
414-
const cleanedName = cleanedParts.join('_');
415-
flexCardAssessmentInfo.dependenciesOS.push(cleanedName);
416-
417-
// Add warning if any part of the name will change
418-
for (let i = 0; i < parts.length; i++) {
419-
if (parts[i] !== cleanedParts[i]) {
420-
flexCardAssessmentInfo.warnings.push(
421-
this.messages.getMessage('omniScriptNameChangeMessage', [parts[i], cleanedParts[i]])
422-
);
423-
flexCardAssessmentInfo.migrationStatus = 'Warnings';
424-
}
477+
const cleanedOsRef = cleanedParts.join('_');
478+
479+
// Push original name for consistency
480+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
481+
482+
// Add warning only if the overall name will change
483+
if (originalOsRef !== cleanedOsRef) {
484+
flexCardAssessmentInfo.warnings.push(
485+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
486+
);
487+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
425488
}
426489
}
427490
}
@@ -450,10 +513,103 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
450513
if (action.stateAction && action.stateAction.omniType) {
451514
const omniType = action.stateAction.omniType;
452515
if (omniType.Name && typeof omniType.Name === 'string') {
453-
const parts = omniType.Name.split('/');
516+
const originalName = omniType.Name;
517+
const parts = originalName.split('/');
454518
if (parts.length >= 2) {
455-
const osRef = parts.join('_');
456-
flexCardAssessmentInfo.dependenciesOS.push(osRef);
519+
// Create both original and cleaned references for comparison
520+
const originalOsRef = parts.join('_');
521+
const cleanedParts = parts.map((p) => this.cleanName(p));
522+
const cleanedOsRef = cleanedParts.join('_');
523+
524+
// Push original name for consistency
525+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
526+
527+
// Add warning if OmniScript name will change
528+
if (originalOsRef !== cleanedOsRef) {
529+
flexCardAssessmentInfo.warnings.push(
530+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
531+
);
532+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
533+
}
534+
}
535+
}
536+
}
537+
}
538+
}
539+
540+
// MISSING PATTERN FIXED: Handle direct stateAction on component property
541+
if (component.property && component.property.stateAction) {
542+
// Case 1: Direct OmniScript reference on component property
543+
if (component.property.stateAction.omniType) {
544+
const omniType = component.property.stateAction.omniType;
545+
if (omniType.Name && typeof omniType.Name === 'string') {
546+
const originalName = omniType.Name;
547+
const parts = originalName.split('/');
548+
549+
if (parts.length >= 2) {
550+
const originalOsRef = parts.join('_');
551+
const cleanedParts = parts.map((p) => this.cleanName(p));
552+
const cleanedOsRef = cleanedParts.join('_');
553+
554+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
555+
556+
if (originalOsRef !== cleanedOsRef) {
557+
flexCardAssessmentInfo.warnings.push(
558+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
559+
);
560+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
561+
}
562+
}
563+
}
564+
}
565+
566+
// Case 2: Flyout OmniScript reference on component property
567+
if (
568+
component.property.stateAction.type === 'Flyout' &&
569+
component.property.stateAction.flyoutType === 'OmniScripts' &&
570+
component.property.stateAction.osName
571+
) {
572+
const osName = component.property.stateAction.osName;
573+
if (typeof osName === 'string') {
574+
const parts = osName.split('/');
575+
576+
if (parts.length >= 2) {
577+
const originalOsRef = parts.join('_');
578+
const cleanedParts = parts.map((p) => this.cleanName(p));
579+
const cleanedOsRef = cleanedParts.join('_');
580+
581+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
582+
583+
if (originalOsRef !== cleanedOsRef) {
584+
flexCardAssessmentInfo.warnings.push(
585+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
586+
);
587+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
588+
}
589+
}
590+
}
591+
}
592+
}
593+
594+
// MISSING PATTERN FIXED: Handle omni-flyout elements (from tests)
595+
if (component.element === 'omni-flyout' && component.property && component.property.flyoutOmniScript) {
596+
if (component.property.flyoutOmniScript.osName) {
597+
const osName = component.property.flyoutOmniScript.osName;
598+
if (typeof osName === 'string') {
599+
const parts = osName.split('/');
600+
601+
if (parts.length >= 2) {
602+
const originalOsRef = parts.join('_');
603+
const cleanedParts = parts.map((p) => this.cleanName(p));
604+
const cleanedOsRef = cleanedParts.join('_');
605+
606+
flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
607+
608+
if (originalOsRef !== cleanedOsRef) {
609+
flexCardAssessmentInfo.warnings.push(
610+
this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef])
611+
);
612+
flexCardAssessmentInfo.migrationStatus = 'Warnings';
457613
}
458614
}
459615
}
@@ -1050,7 +1206,38 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
10501206
}
10511207
}
10521208

1053-
// Handle child components recursively
1209+
// Handle omni-flyout elements (missing from migration logic)
1210+
if (component.element === 'omni-flyout' && component.property && component.property.flyoutOmniScript) {
1211+
if (component.property.flyoutOmniScript.osName) {
1212+
const osName = component.property.flyoutOmniScript.osName;
1213+
if (typeof osName === 'string') {
1214+
const parts = osName.split('/');
1215+
1216+
if (parts.length >= 2) {
1217+
// Construct full OmniScript name: Type_SubType_Language
1218+
const originalOsRef = parts.join('_');
1219+
1220+
if (this.nameRegistry.hasOmniScriptMapping(originalOsRef)) {
1221+
// Registry has mapping - extract cleaned parts and convert back to / format
1222+
const cleanedFullName = this.nameRegistry.getCleanedName(originalOsRef, 'OmniScript');
1223+
const cleanedParts = cleanedFullName.split('_');
1224+
1225+
if (cleanedParts.length >= 2) {
1226+
component.property.flyoutOmniScript.osName = cleanedParts.join('/');
1227+
}
1228+
} else {
1229+
// No registry mapping - use original fallback approach
1230+
Logger.logVerbose(
1231+
`\n${this.messages.getMessage('componentMappingNotFound', ['OmniScript', originalOsRef])}`
1232+
);
1233+
component.property.flyoutOmniScript.osName = parts.map((p) => this.cleanName(p)).join('/');
1234+
}
1235+
}
1236+
}
1237+
}
1238+
}
1239+
1240+
// Check child components recursively
10541241
if (component.children && Array.isArray(component.children)) {
10551242
for (const child of component.children) {
10561243
this.updateComponentDependenciesWithRegistry(child);
@@ -1165,7 +1352,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
11651352
}
11661353

11671354
/**
1168-
* Recursively check if a component has Angular OmniScript dependencies
1355+
* Recursively check if a component has Angular Omniscript dependencies
11691356
*/
11701357
private componentHasAngularOmniScriptDependency(component: any): boolean {
11711358
// Pattern 1: Handle action elements with actionList (like migration logic)

src/migration/omniscript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
534534
}
535535
if (existingOmniscriptNames.has(recordName)) {
536536
warnings.push(this.messages.getMessage('duplicatedName') + ' ' + recordName);
537-
assessmentStatus = 'Warnings';
537+
assessmentStatus = 'Needs Manual Intervention';
538538
} else {
539539
existingOmniscriptNames.add(recordName);
540540
}

src/utils/resultsbuilder/FlexcardAssessmentReporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class FlexcardAssessmentReporter {
8989
rowspan: 2,
9090
},
9191
{
92-
name: 'OmniScript Dependencies',
92+
name: 'Omniscript Dependencies',
9393
colspan: 1,
9494
rowspan: 2,
9595
},

0 commit comments

Comments
 (0)