@salesforce/plugin-omnistudio-migration-tool 2.0.0-preview.27 → 2.0.0-preview.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -237,59 +237,45 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
237
237
  };
238
238
  flexCardAssessmentInfo.migrationStatus = assessmentStatus;
239
239
  this.updateDependencies(flexCard, flexCardAssessmentInfo);
240
+ // Deduplicate all dependency arrays to ensure no duplicates
241
+ flexCardAssessmentInfo.dependenciesIP = [...new Set(flexCardAssessmentInfo.dependenciesIP)];
242
+ flexCardAssessmentInfo.dependenciesDR = [...new Set(flexCardAssessmentInfo.dependenciesDR)];
243
+ flexCardAssessmentInfo.dependenciesFC = [...new Set(flexCardAssessmentInfo.dependenciesFC)];
244
+ flexCardAssessmentInfo.dependenciesOS = [...new Set(flexCardAssessmentInfo.dependenciesOS)];
245
+ flexCardAssessmentInfo.dependenciesLWC = [...new Set(flexCardAssessmentInfo.dependenciesLWC)];
246
+ flexCardAssessmentInfo.dependenciesApexRemoteAction = [
247
+ ...new Set(flexCardAssessmentInfo.dependenciesApexRemoteAction),
248
+ ];
240
249
  return flexCardAssessmentInfo;
241
250
  }
242
251
  updateDependencies(flexCard, flexCardAssessmentInfo) {
243
252
  var _a, _b, _c, _d;
244
- let dataSource = JSON.parse(flexCard[this.getFieldKey('Datasource__c')] || '{}');
245
- // Handle both camelCase and lowercase variants
246
- if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.dataSource) {
247
- dataSource = dataSource.dataSource;
248
- }
249
- else if (dataSource === null || dataSource === void 0 ? void 0 : dataSource.datasource) {
250
- dataSource = dataSource.datasource;
251
- }
252
- // Check if it's a DataRaptor source
253
- if (dataSource.type === stringContants_1.Constants.DataRaptorComponentName) {
254
- const originalBundle = (_a = dataSource.value) === null || _a === void 0 ? void 0 : _a.bundle;
255
- if (originalBundle) {
256
- const cleanedBundle = this.cleanName(originalBundle);
257
- // Push original name instead of cleaned name for assessment consistency
258
- flexCardAssessmentInfo.dependenciesDR.push(originalBundle);
259
- // Add warning if DataRaptor name will change
260
- if (originalBundle !== cleanedBundle) {
261
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('dataRaptorNameChangeMessage', [originalBundle, cleanedBundle]));
262
- flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
263
- }
264
- }
265
- }
266
- else if (dataSource.type === stringContants_1.Constants.IntegrationProcedurePluralName) {
267
- const originalIpMethod = (_b = dataSource.value) === null || _b === void 0 ? void 0 : _b.ipMethod;
268
- if (originalIpMethod) {
269
- const parts = originalIpMethod.split('_');
270
- const cleanedParts = parts.map((p) => this.cleanName(p, true));
271
- const cleanedIpMethod = cleanedParts.join('_');
272
- // Push original name instead of cleaned name for assessment consistency
273
- flexCardAssessmentInfo.dependenciesIP.push(originalIpMethod);
274
- // Add warning if IP name will change
275
- if (originalIpMethod !== cleanedIpMethod) {
276
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('integrationProcedureNameChangeMessage', [originalIpMethod, cleanedIpMethod]));
277
- flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
278
- }
279
- // Add warning for IP references with more than 2 parts (which potentially need manual updates)
280
- if (parts.length > 2) {
281
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('integrationProcedureManualUpdateMessage', [originalIpMethod]));
282
- flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Needs manual intervention');
253
+ const dataSourceConfig = JSON.parse(flexCard[this.getFieldKey('Datasource__c')] || '{}');
254
+ // Collect all data sources - any nested object with a 'type' property is a data source
255
+ // This handles: dataSource, datasource, event-0_0, event-1_0, etc.
256
+ const dataSources = Object.values(dataSourceConfig).filter((value) => value && typeof value === 'object' && value.type);
257
+ for (const ds of dataSources) {
258
+ // Check if it's a DataRaptor source
259
+ if (ds.type === stringContants_1.Constants.DataRaptorComponentName) {
260
+ const originalBundle = (_a = ds.value) === null || _a === void 0 ? void 0 : _a.bundle;
261
+ if (originalBundle) {
262
+ this.addDataRaptorDependency(originalBundle, flexCardAssessmentInfo);
283
263
  }
284
264
  }
285
- }
286
- else if (dataSource.type === stringContants_1.Constants.ApexRemoteComponentName) {
287
- const remoteClass = (_c = dataSource.value) === null || _c === void 0 ? void 0 : _c.remoteClass;
288
- const remoteMethod = (_d = dataSource.value) === null || _d === void 0 ? void 0 : _d.remoteMethod;
289
- logger_1.Logger.info(`Remote Action name: ${remoteClass}.${remoteMethod}`);
290
- // Avoid duplicates
291
- if (!flexCardAssessmentInfo.dependenciesApexRemoteAction.includes(`${remoteClass}.${remoteMethod}`)) {
292
- flexCardAssessmentInfo.dependenciesApexRemoteAction.push(`${remoteClass}.${remoteMethod}`);
265
+ else if (ds.type === stringContants_1.Constants.IntegrationProcedurePluralName) {
266
+ const originalIpMethod = (_b = ds.value) === null || _b === void 0 ? void 0 : _b.ipMethod;
267
+ if (originalIpMethod) {
268
+ this.addIntegrationProcedureDependency(originalIpMethod, flexCardAssessmentInfo);
269
+ }
270
+ }
271
+ else if (ds.type === stringContants_1.Constants.ApexRemoteComponentName) {
272
+ const remoteClass = (_c = ds.value) === null || _c === void 0 ? void 0 : _c.remoteClass;
273
+ const remoteMethod = (_d = ds.value) === null || _d === void 0 ? void 0 : _d.remoteMethod;
274
+ if (remoteClass &&
275
+ remoteMethod &&
276
+ !flexCardAssessmentInfo.dependenciesApexRemoteAction.includes(`${remoteClass}.${remoteMethod}`)) {
277
+ flexCardAssessmentInfo.dependenciesApexRemoteAction.push(`${remoteClass}.${remoteMethod}`);
278
+ }
293
279
  }
294
280
  }
295
281
  // Check for Omniscript dependencies in the card's definition
@@ -300,15 +286,7 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
300
286
  if (state.omniscripts && Array.isArray(state.omniscripts)) {
301
287
  for (const os of state.omniscripts) {
302
288
  if (os.type && os.subtype) {
303
- const originalOsRef = `${os.type}_${os.subtype}_${os.language || 'English'}`;
304
- const cleanedOsRef = `${this.cleanName(os.type)}_${this.cleanName(os.subtype)}_${os.language || 'English'}`;
305
- // Push original name for consistency
306
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
307
- // Add warning if OmniScript name will change
308
- if (originalOsRef !== cleanedOsRef) {
309
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
310
- flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
311
- }
289
+ this.addOmniScriptDependencyFromParts(os.type, os.subtype, os.language, flexCardAssessmentInfo);
312
290
  }
313
291
  }
314
292
  }
@@ -326,14 +304,11 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
326
304
  let childCards = this.readChildCardsFromDefinition(flexCard);
327
305
  // Add warnings for child card name changes
328
306
  for (const childCardName of childCards) {
329
- const cleanedChildCardName = this.cleanName(childCardName);
330
- // Push original child card name for consistency
331
- flexCardAssessmentInfo.dependenciesFC.push(childCardName);
332
- // Add warning if child card name will change
333
- if (childCardName !== cleanedChildCardName) {
334
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('cardNameChangeMessage', [childCardName, cleanedChildCardName]));
335
- flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
336
- }
307
+ this.addFlexCardDependency(childCardName, flexCardAssessmentInfo);
308
+ }
309
+ // Check for dependencies in events[] array
310
+ if (definition.events && Array.isArray(definition.events)) {
311
+ this.checkEventsForDependencies(definition.events, flexCardAssessmentInfo);
337
312
  }
338
313
  }
339
314
  catch (err) {
@@ -341,6 +316,230 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
341
316
  logger_1.Logger.error(`Error parsing definition for card ${flexCard.Name}: ${err.message}`);
342
317
  }
343
318
  }
319
+ /**
320
+ * Check events array for dependencies (Assessment)
321
+ * Handles: events[].actionList[].stateAction references
322
+ */
323
+ checkEventsForDependencies(events, flexCardAssessmentInfo) {
324
+ for (const event of events) {
325
+ if (!event.actionList || !Array.isArray(event.actionList)) {
326
+ continue;
327
+ }
328
+ for (const action of event.actionList) {
329
+ if (!action.stateAction) {
330
+ continue;
331
+ }
332
+ const stateAction = action.stateAction;
333
+ // 1-2. Handle message.value.bundle (DataRaptor) and message.value.ipMethod (Integration Procedure)
334
+ this.processStateActionMessageForDependencies(stateAction, flexCardAssessmentInfo);
335
+ // 3. Handle cardName (FlexCard - Flyout childCard)
336
+ if (stateAction.cardName) {
337
+ this.addFlexCardDependency(stateAction.cardName, flexCardAssessmentInfo);
338
+ }
339
+ // 4. Handle flyoutLwc - FlexCard child cards
340
+ if (this.hasFlexCardFlyoutDependency(stateAction)) {
341
+ this.addFlexCardDependency(stateAction.flyoutLwc, flexCardAssessmentInfo);
342
+ }
343
+ // Handle flyoutLwc - CustomLwc with potential "cf" prefix for FlexCard reference
344
+ else if (this.hasCustomLwcFlyoutDependency(stateAction)) {
345
+ this.addCfPrefixedFlexCardDependency(stateAction.flyoutLwc, flexCardAssessmentInfo);
346
+ }
347
+ // 5. Handle osName
348
+ else if (this.hasOmniscriptFlyoutDependency(stateAction)) {
349
+ this.addOmniScriptDependency(stateAction.osName, flexCardAssessmentInfo);
350
+ }
351
+ // 6. Handle omniType.Name (OmniScript)
352
+ if (stateAction.omniType && stateAction.omniType.Name) {
353
+ this.addOmniScriptDependency(stateAction.omniType.Name, flexCardAssessmentInfo);
354
+ }
355
+ }
356
+ }
357
+ }
358
+ /**
359
+ * Shared helper to check if a "cf" prefixed LWC name references a FlexCard and add dependency (assessment phase)
360
+ * @param cfPrefixedLwcName LWC name with "cf" prefix (e.g., "cfMyFlexCard")
361
+ * @param flexCardAssessmentInfo Assessment info to add dependencies and warnings
362
+ */
363
+ addCfPrefixedFlexCardDependency(cfPrefixedLwcName, flexCardAssessmentInfo) {
364
+ if (cfPrefixedLwcName.startsWith('cf')) {
365
+ // Remove "cf" prefix to get the original FlexCard name
366
+ const originalFlexCardName = cfPrefixedLwcName.substring(2);
367
+ // Check if the FlexCard name will change and add warning
368
+ const cleanedFlexCardName = this.cleanName(originalFlexCardName);
369
+ this.addFlexCardDependency(originalFlexCardName, flexCardAssessmentInfo);
370
+ if (originalFlexCardName !== cleanedFlexCardName) {
371
+ flexCardAssessmentInfo.warnings.push(this.messages.getMessage('cardLWCNameChangeMessage', [originalFlexCardName, cleanedFlexCardName]));
372
+ flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
373
+ }
374
+ }
375
+ }
376
+ /**
377
+ * Shared helper to update a "cf" prefixed LWC name with registry (migration phase)
378
+ * @param cfPrefixedLwcName LWC name with "cf" prefix (e.g., "cfMyFlexCard")
379
+ * @returns Updated LWC name with "cf" prefix
380
+ */
381
+ updateCfPrefixedFlexCardName(cfPrefixedLwcName) {
382
+ if (cfPrefixedLwcName.startsWith('cf')) {
383
+ // Remove "cf" prefix to get the original FlexCard name
384
+ const originalFlexCardName = cfPrefixedLwcName.substring(2);
385
+ // Look up the cleaned name from registry
386
+ let cleanedFlexCardName;
387
+ if (this.nameRegistry.hasFlexCardMapping(originalFlexCardName)) {
388
+ cleanedFlexCardName = this.nameRegistry.getFlexCardCleanedName(originalFlexCardName);
389
+ }
390
+ else {
391
+ logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['Flexcard', originalFlexCardName])}`);
392
+ cleanedFlexCardName = this.cleanName(originalFlexCardName);
393
+ }
394
+ return `cf${cleanedFlexCardName}`;
395
+ }
396
+ return cfPrefixedLwcName;
397
+ }
398
+ /**
399
+ * Shared helper to check Custom LWC component for FlexCard dependencies (assessment phase)
400
+ * Handles customlwcname with "cf" prefix indicating FlexCard reference
401
+ */
402
+ checkCustomLwcForDependencies(component, flexCardAssessmentInfo) {
403
+ if (component.element === stringContants_1.Constants.CustomLwc && component.property) {
404
+ if (component.property.customlwcname) {
405
+ const customLwcName = component.property.customlwcname;
406
+ logger_1.Logger.info(`Custom LWC name: ${customLwcName}`);
407
+ // Check if this is a FlexCard reference (starts with "cf" prefix)
408
+ this.addCfPrefixedFlexCardDependency(customLwcName, flexCardAssessmentInfo);
409
+ // Add to LWC dependencies for tracking (avoid duplicates)
410
+ if (!flexCardAssessmentInfo.dependenciesLWC.includes(customLwcName)) {
411
+ flexCardAssessmentInfo.dependenciesLWC.push(customLwcName);
412
+ }
413
+ }
414
+ }
415
+ }
416
+ /**
417
+ * Shared helper to update Custom LWC component with registry (migration phase)
418
+ * Handles customlwcname with "cf" prefix indicating FlexCard reference
419
+ */
420
+ updateCustomLwcWithRegistry(component) {
421
+ if (component.element === stringContants_1.Constants.CustomLwc && component.property) {
422
+ if (component.property.customlwcname) {
423
+ const customLwcName = component.property.customlwcname;
424
+ // Check if this is a FlexCard reference (starts with "cf" prefix) and update it
425
+ if (customLwcName === null || customLwcName === void 0 ? void 0 : customLwcName.startsWith('cf')) {
426
+ const updatedLwcName = this.updateCfPrefixedFlexCardName(customLwcName);
427
+ component.property.customlwcname = updatedLwcName;
428
+ if (customLwcName !== updatedLwcName) {
429
+ const cleanedFlexCardName = updatedLwcName.substring(2);
430
+ logger_1.Logger.logVerbose(this.messages.getMessage('customLWCFlexCardReferenceUpdated', [customLwcName, cleanedFlexCardName]));
431
+ }
432
+ }
433
+ // Note: Other custom LWC names (not starting with "cf") typically don't need cleaning
434
+ }
435
+ }
436
+ }
437
+ /**
438
+ * Shared helper to update flyoutLwc value with registry (migration phase)
439
+ * Handles FlexCard child cards references
440
+ */
441
+ updateFlyoutLwcValue(stateAction) {
442
+ if (stateAction.flyoutLwc) {
443
+ if (stateAction.flyoutType === stringContants_1.Constants.ChildCard) {
444
+ // flyoutLwc is a direct FlexCard name reference
445
+ const lwcName = stateAction.flyoutLwc;
446
+ if (this.nameRegistry.hasFlexCardMapping(lwcName)) {
447
+ stateAction.flyoutLwc = this.nameRegistry.getFlexCardCleanedName(lwcName);
448
+ }
449
+ else {
450
+ logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['Flexcard', lwcName])}`);
451
+ stateAction.flyoutLwc = this.cleanName(lwcName);
452
+ }
453
+ }
454
+ else if (stateAction.flyoutType === stringContants_1.Constants.CustomLwc) {
455
+ // flyoutType is customLwc - update if it's a FlexCard reference with "cf" prefix
456
+ stateAction.flyoutLwc = this.updateCfPrefixedFlexCardName(stateAction.flyoutLwc);
457
+ // Note: Non-"cf" prefixed names are returned unchanged by the helper
458
+ }
459
+ }
460
+ }
461
+ /**
462
+ * Shared helper to process stateAction.message JSON for dependencies
463
+ * Handles DataRaptor bundle and Integration Procedure ipMethod references
464
+ */
465
+ processStateActionMessageForDependencies(stateAction, flexCardAssessmentInfo) {
466
+ // Only parse message for DataAction or cardAction types
467
+ if (stateAction.message &&
468
+ typeof stateAction.message === 'string' &&
469
+ stateAction.message.trim().length > 0 &&
470
+ (stateAction.type === stringContants_1.Constants.DataAction || stateAction.type === stringContants_1.Constants.CardAction)) {
471
+ try {
472
+ const messageObj = JSON.parse(stateAction.message);
473
+ if (messageObj.value) {
474
+ // DataRaptor bundle
475
+ if (messageObj.value.bundle) {
476
+ this.addDataRaptorDependency(messageObj.value.bundle, flexCardAssessmentInfo);
477
+ }
478
+ // Integration Procedure ipMethod
479
+ if (messageObj.value.ipMethod) {
480
+ this.addIntegrationProcedureDependency(messageObj.value.ipMethod, flexCardAssessmentInfo);
481
+ }
482
+ }
483
+ }
484
+ catch (e) {
485
+ // message is not valid JSON, skip
486
+ logger_1.Logger.error(`Failed to parse stateAction.message as JSON: ${e.message}`);
487
+ }
488
+ }
489
+ }
490
+ /**
491
+ * Shared helper to process stateAction.message JSON with registry updates
492
+ * Handles DataRaptor bundle and Integration Procedure ipMethod references
493
+ */
494
+ processStateActionMessageWithRegistry(stateAction, invalidIpNames) {
495
+ // Only parse message for DataAction or cardAction types
496
+ if (stateAction.message &&
497
+ typeof stateAction.message === 'string' &&
498
+ stateAction.message.trim().length > 0 &&
499
+ (stateAction.type === stringContants_1.Constants.DataAction || stateAction.type === stringContants_1.Constants.CardAction)) {
500
+ try {
501
+ const messageObj = JSON.parse(stateAction.message);
502
+ let messageUpdated = false;
503
+ if (messageObj.value) {
504
+ // DataRaptor bundle
505
+ if (messageObj.value.bundle) {
506
+ const originalBundle = messageObj.value.bundle;
507
+ if (this.nameRegistry.hasDataMapperMapping(originalBundle)) {
508
+ messageObj.value.bundle = this.nameRegistry.getDataMapperCleanedName(originalBundle);
509
+ }
510
+ else {
511
+ logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', originalBundle])}`);
512
+ messageObj.value.bundle = this.cleanName(originalBundle);
513
+ }
514
+ messageUpdated = true;
515
+ }
516
+ // Integration Procedure ipMethod
517
+ if (messageObj.value.ipMethod) {
518
+ const ipMethod = messageObj.value.ipMethod;
519
+ if (this.nameRegistry.hasIntegrationProcedureMapping(ipMethod)) {
520
+ messageObj.value.ipMethod = this.nameRegistry.getIntegrationProcedureCleanedName(ipMethod);
521
+ }
522
+ else {
523
+ logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['IntegrationProcedure', ipMethod])}`);
524
+ const parts = ipMethod.split('_');
525
+ messageObj.value.ipMethod = parts.map((p) => this.cleanName(p, true)).join('_');
526
+ if (parts.length > 2 && invalidIpNames) {
527
+ invalidIpNames.set(`event.actionList.stateAction.message`, ipMethod);
528
+ }
529
+ }
530
+ messageUpdated = true;
531
+ }
532
+ }
533
+ if (messageUpdated) {
534
+ stateAction.message = JSON.stringify(messageObj);
535
+ }
536
+ }
537
+ catch (e) {
538
+ // message is not valid JSON, skip
539
+ logger_1.Logger.error(`Failed to parse stateAction.message as JSON: ${e.message}`);
540
+ }
541
+ }
542
+ }
344
543
  handleAssessmentForStdDataModelOrgsWithMetadataAPIEnabled(flexCards) {
345
544
  logger_1.Logger.logVerbose(this.messages.getMessage('preparingStorageForMetadataEnabledOrg', [stringContants_1.Constants.Flexcard]));
346
545
  let storage = storageUtil_1.StorageUtil.getOmnistudioAssessmentStorage();
@@ -380,27 +579,13 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
380
579
  // Process each action in the actionList
381
580
  for (const action of component.property.actionList) {
382
581
  if (action.stateAction) {
582
+ // Handle message field (contains DataRaptor/IP references as JSON string)
583
+ this.processStateActionMessageForDependencies(action.stateAction, flexCardAssessmentInfo);
383
584
  // Case 1: Direct OmniScript reference
384
585
  if (action.stateAction.type === stringContants_1.Constants.OmniScriptComponentName && action.stateAction.omniType) {
385
586
  const omniType = action.stateAction.omniType;
386
587
  if (omniType.Name && typeof omniType.Name === 'string') {
387
- const originalName = omniType.Name;
388
- const parts = originalName.split('/');
389
- if (parts.length >= 2) {
390
- // Create both original and cleaned references for comparison
391
- const originalOsRef = parts.join('_');
392
- const cleanedParts = parts.length >= 3
393
- ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
394
- : parts.map((p) => this.cleanName(p));
395
- const cleanedOsRef = cleanedParts.join('_');
396
- // Push original name for consistency
397
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
398
- // Add warning only if the overall name will change
399
- if (originalOsRef !== cleanedOsRef) {
400
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
401
- flexCardAssessmentInfo.migrationStatus = 'Warnings';
402
- }
403
- }
588
+ this.addOmniScriptDependency(omniType.Name, flexCardAssessmentInfo);
404
589
  }
405
590
  }
406
591
  // MISSING PATTERN FIXED: Case 1b: Direct OmniScript reference without type check (for test compatibility)
@@ -417,96 +602,35 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
417
602
  else {
418
603
  continue; // Skip if we can't extract the name
419
604
  }
420
- const parts = omniTypeName.split('/');
421
- if (parts.length >= 2) {
422
- const originalOsRef = parts.join('_');
423
- const cleanedParts = parts.length >= 3
424
- ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
425
- : parts.map((p) => this.cleanName(p));
426
- const cleanedOsRef = cleanedParts.join('_');
427
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
428
- if (originalOsRef !== cleanedOsRef) {
429
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
430
- flexCardAssessmentInfo.migrationStatus = 'Warnings';
431
- }
432
- }
605
+ this.addOmniScriptDependency(omniTypeName, flexCardAssessmentInfo);
433
606
  }
434
607
  // Case 2: Flyout OmniScript reference
435
- else if (action.stateAction.type === 'Flyout' &&
436
- action.stateAction.flyoutType === stringContants_1.Constants.OmniScriptPluralName &&
437
- action.stateAction.osName) {
608
+ else if (this.hasOmniscriptFlyoutDependency(action.stateAction)) {
438
609
  const osName = action.stateAction.osName;
439
610
  if (typeof osName === 'string') {
440
- // osName is typically in format "Omniscript/Testing/English"
441
- const originalName = osName;
442
- const parts = originalName.split('/');
443
- if (parts.length >= 2) {
444
- // Create both original and cleaned references for comparison
445
- const originalOsRef = parts.join('_');
446
- const cleanedParts = parts.length >= 3
447
- ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
448
- : parts.map((p) => this.cleanName(p));
449
- const cleanedOsRef = cleanedParts.join('_');
450
- // Push original name for consistency
451
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
452
- // Add warning only if the overall name will change
453
- if (originalOsRef !== cleanedOsRef) {
454
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
455
- flexCardAssessmentInfo.migrationStatus = 'Warnings';
456
- }
457
- }
611
+ this.addOmniScriptDependency(osName, flexCardAssessmentInfo);
458
612
  }
459
613
  }
460
- }
461
- }
462
- }
463
- // Check for Custom LWC component
464
- if (component.element === 'customLwc' && component.property) {
465
- // Check customlwcname property first
466
- if (component.property.customlwcname) {
467
- const customLwcName = component.property.customlwcname;
468
- logger_1.Logger.info(`Custom LWC name: ${customLwcName}`);
469
- // Check if this is a FlexCard reference (starts with "cf" prefix)
470
- if (customLwcName.startsWith('cf')) {
471
- // Remove "cf" prefix to get the original FlexCard name
472
- const originalFlexCardName = customLwcName.substring(2);
473
- // Check if the FlexCard name will change and add warning
474
- const cleanedFlexCardName = this.cleanName(originalFlexCardName);
475
- if (originalFlexCardName !== cleanedFlexCardName) {
476
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('cardLWCNameChangeMessage', [originalFlexCardName, cleanedFlexCardName]));
477
- flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
614
+ // Case 3: Flyout childCard reference - flyoutLwc is a direct FlexCard name
615
+ else if (this.hasFlexCardFlyoutDependency(action.stateAction)) {
616
+ this.addFlexCardDependency(action.stateAction.flyoutLwc, flexCardAssessmentInfo);
617
+ }
618
+ // Case 4: Flyout CustomLwc reference - check for FlexCard reference with "cf" prefix
619
+ else if (this.hasCustomLwcFlyoutDependency(action.stateAction)) {
620
+ this.addCfPrefixedFlexCardDependency(action.stateAction.flyoutLwc, flexCardAssessmentInfo);
478
621
  }
479
- }
480
- // Regular custom LWC (and FlexCard reference)
481
- // Avoid duplicates
482
- if (!flexCardAssessmentInfo.dependenciesLWC.includes(customLwcName)) {
483
- flexCardAssessmentInfo.dependenciesLWC.push(customLwcName);
484
622
  }
485
623
  }
486
624
  }
625
+ // Check for Custom LWC component
626
+ this.checkCustomLwcForDependencies(component, flexCardAssessmentInfo);
487
627
  // Check standard component actions if they exist
488
628
  if (component.actions && Array.isArray(component.actions)) {
489
629
  for (const action of component.actions) {
490
630
  if (action.stateAction && action.stateAction.omniType) {
491
631
  const omniType = action.stateAction.omniType;
492
632
  if (omniType.Name && typeof omniType.Name === 'string') {
493
- const originalName = omniType.Name;
494
- const parts = originalName.split('/');
495
- if (parts.length >= 2) {
496
- // Create both original and cleaned references for comparison
497
- const originalOsRef = parts.join('_');
498
- const cleanedParts = parts.length >= 3
499
- ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
500
- : parts.map((p) => this.cleanName(p));
501
- const cleanedOsRef = cleanedParts.join('_');
502
- // Push original name for consistency
503
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
504
- // Add warning if OmniScript name will change
505
- if (originalOsRef !== cleanedOsRef) {
506
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
507
- flexCardAssessmentInfo.migrationStatus = 'Warnings';
508
- }
509
- }
633
+ this.addOmniScriptDependency(omniType.Name, flexCardAssessmentInfo);
510
634
  }
511
635
  }
512
636
  }
@@ -517,65 +641,38 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
517
641
  if (component.property.stateAction.omniType) {
518
642
  const omniType = component.property.stateAction.omniType;
519
643
  if (omniType.Name && typeof omniType.Name === 'string') {
520
- const originalName = omniType.Name;
521
- const parts = originalName.split('/');
522
- if (parts.length >= 2) {
523
- const originalOsRef = parts.join('_');
524
- const cleanedParts = parts.length >= 3
525
- ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
526
- : parts.map((p) => this.cleanName(p));
527
- const cleanedOsRef = cleanedParts.join('_');
528
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
529
- if (originalOsRef !== cleanedOsRef) {
530
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
531
- flexCardAssessmentInfo.migrationStatus = 'Warnings';
532
- }
533
- }
644
+ this.addOmniScriptDependency(omniType.Name, flexCardAssessmentInfo);
534
645
  }
535
646
  }
536
647
  // Case 2: Flyout OmniScript reference on component property
537
- if (component.property.stateAction.type === 'Flyout' &&
538
- component.property.stateAction.flyoutType === 'OmniScripts' &&
539
- component.property.stateAction.osName) {
648
+ if (this.hasOmniscriptFlyoutDependency(component.property.stateAction)) {
540
649
  const osName = component.property.stateAction.osName;
541
650
  if (typeof osName === 'string') {
542
- const parts = osName.split('/');
543
- if (parts.length >= 2) {
544
- const originalOsRef = parts.join('_');
545
- const cleanedParts = parts.length >= 3
546
- ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
547
- : parts.map((p) => this.cleanName(p));
548
- const cleanedOsRef = cleanedParts.join('_');
549
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
550
- if (originalOsRef !== cleanedOsRef) {
551
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
552
- flexCardAssessmentInfo.migrationStatus = 'Warnings';
553
- }
554
- }
651
+ this.addOmniScriptDependency(osName, flexCardAssessmentInfo);
555
652
  }
556
653
  }
654
+ // Case 3: Flyout childCard reference on component property - flyoutLwc is a direct FlexCard name
655
+ if (this.hasFlexCardFlyoutDependency(component.property.stateAction)) {
656
+ this.addFlexCardDependency(component.property.stateAction.flyoutLwc, flexCardAssessmentInfo);
657
+ }
658
+ // Case 4: Flyout CustomLwc reference on component property - check for FlexCard reference with "cf" prefix
659
+ if (this.hasCustomLwcFlyoutDependency(component.property.stateAction)) {
660
+ this.addCfPrefixedFlexCardDependency(component.property.stateAction.flyoutLwc, flexCardAssessmentInfo);
661
+ }
557
662
  }
558
663
  // MISSING PATTERN FIXED: Handle omni-flyout elements (from tests)
559
- if (component.element === 'omni-flyout' && component.property && component.property.flyoutOmniScript) {
664
+ if (component.element === stringContants_1.Constants.OmniFlyout && component.property && component.property.flyoutOmniScript) {
560
665
  if (component.property.flyoutOmniScript.osName) {
561
666
  const osName = component.property.flyoutOmniScript.osName;
562
667
  if (typeof osName === 'string') {
563
- const parts = osName.split('/');
564
- if (parts.length >= 2) {
565
- const originalOsRef = parts.join('_');
566
- const cleanedParts = parts.length >= 3
567
- ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
568
- : parts.map((p) => this.cleanName(p));
569
- const cleanedOsRef = cleanedParts.join('_');
570
- flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
571
- if (originalOsRef !== cleanedOsRef) {
572
- flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
573
- flexCardAssessmentInfo.migrationStatus = 'Warnings';
574
- }
575
- }
668
+ this.addOmniScriptDependency(osName, flexCardAssessmentInfo);
576
669
  }
577
670
  }
578
671
  }
672
+ // MISSING PATTERN FIXED: Handle childCardPreview elements with cardName property
673
+ if (component.element === stringContants_1.Constants.ChildCardPreview && component.property && component.property.cardName) {
674
+ this.addFlexCardDependency(component.property.cardName, flexCardAssessmentInfo);
675
+ }
579
676
  // Check child components recursively
580
677
  if (component.children && Array.isArray(component.children)) {
581
678
  for (const child of component.children) {
@@ -906,6 +1003,7 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
906
1003
  }
907
1004
  // Maps an indivitdual VlocityCard__c record to an OmniUiCard record.
908
1005
  mapVlocityCardRecord(cardRecord, cardsUploadInfo, invalidIpNames) {
1006
+ var _a, _b;
909
1007
  // Transformed object
910
1008
  let mappedObject = {};
911
1009
  if (!this.IS_STANDARD_DATA_MODEL) {
@@ -951,24 +1049,36 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
951
1049
  '.0';
952
1050
  }
953
1051
  }
954
- // Update the datasource
1052
+ // Update the datasource - process any nested object with a 'type' property
955
1053
  const datasource = JSON.parse(mappedObject[VlocityCard_1.default.Datasource__c] || '{}');
956
- if (datasource.dataSource) {
957
- const type = datasource.dataSource.type;
958
- if (type === stringContants_1.Constants.DataRaptorComponentName) {
959
- datasource.dataSource.value.bundle = this.cleanName(datasource.dataSource.value.bundle);
960
- }
961
- else if (type === stringContants_1.Constants.IntegrationProcedurePluralName) {
962
- const ipMethod = datasource.dataSource.value.ipMethod || '';
963
- const parts = ipMethod.split('_');
964
- const newKey = parts.map((p) => this.cleanName(p, true)).join('_');
965
- datasource.dataSource.value.ipMethod = newKey;
966
- if (parts.length > 2) {
967
- invalidIpNames.set('DataSource', ipMethod);
1054
+ let updated = false;
1055
+ // Process all keys that have objects with type property
1056
+ for (const key of Object.keys(datasource)) {
1057
+ const ds = datasource[key];
1058
+ if (!ds || typeof ds !== 'object' || !ds.type)
1059
+ continue;
1060
+ if (ds.type === stringContants_1.Constants.DataRaptorComponentName && ((_a = ds.value) === null || _a === void 0 ? void 0 : _a.bundle)) {
1061
+ ds.value.bundle = this.nameRegistry.hasDataMapperMapping(ds.value.bundle)
1062
+ ? this.nameRegistry.getDataMapperCleanedName(ds.value.bundle)
1063
+ : this.cleanName(ds.value.bundle);
1064
+ updated = true;
1065
+ }
1066
+ else if (ds.type === stringContants_1.Constants.IntegrationProcedurePluralName && ((_b = ds.value) === null || _b === void 0 ? void 0 : _b.ipMethod)) {
1067
+ const ipMethod = ds.value.ipMethod;
1068
+ if (this.nameRegistry.hasIntegrationProcedureMapping(ipMethod)) {
1069
+ ds.value.ipMethod = this.nameRegistry.getIntegrationProcedureCleanedName(ipMethod);
968
1070
  }
1071
+ else {
1072
+ const parts = ipMethod.split('_');
1073
+ ds.value.ipMethod = parts.map((p) => this.cleanName(p, true)).join('_');
1074
+ if (parts.length > 2)
1075
+ invalidIpNames.set(key, ipMethod);
1076
+ }
1077
+ updated = true;
969
1078
  }
970
- mappedObject[VlocityCard_1.default.Datasource__c] = JSON.stringify(datasource);
971
1079
  }
1080
+ if (updated)
1081
+ mappedObject[VlocityCard_1.default.Datasource__c] = JSON.stringify(datasource);
972
1082
  const isCardActive = cardRecord[this.getFieldKey('Active__c')];
973
1083
  this.ensureCommunityTargets(mappedObject, isCardActive);
974
1084
  // Update all dependencies comprehensively
@@ -983,19 +1093,17 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
983
1093
  * Comprehensive dependency update using NameMappingRegistry - mirrors assessment logic
984
1094
  */
985
1095
  updateAllDependenciesWithRegistry(mappedObject, invalidIpNames) {
986
- // 1. Handle propertySet (Definition) datasource
1096
+ // Handle propertySet (Definition) - update all dependency references
987
1097
  const propertySet = JSON.parse(mappedObject[VlocityCard_1.default.Definition__c] || '{}');
988
1098
  if (propertySet) {
989
- // Use NameMappingRegistry to update all dependency references first
990
- const updatedPropertySet = this.nameRegistry.updateDependencyReferences(propertySet);
991
1099
  // Handle dataSource in propertySet
992
- if (updatedPropertySet.dataSource) {
993
- this.updateDataSourceWithRegistry(updatedPropertySet.dataSource, invalidIpNames, 'PropertySet');
1100
+ if (propertySet.dataSource) {
1101
+ this.updateDataSourceWithRegistry(propertySet.dataSource, invalidIpNames, 'PropertySet');
994
1102
  }
995
1103
  // Handle states comprehensively
996
- if (updatedPropertySet.states && Array.isArray(updatedPropertySet.states)) {
997
- for (let i = 0; i < updatedPropertySet.states.length; i++) {
998
- const state = updatedPropertySet.states[i];
1104
+ if (propertySet.states && Array.isArray(propertySet.states)) {
1105
+ for (let i = 0; i < propertySet.states.length; i++) {
1106
+ const state = propertySet.states[i];
999
1107
  // Handle child cards using registry
1000
1108
  if (state.childCards && Array.isArray(state.childCards)) {
1001
1109
  state.childCards = state.childCards.map((c) => {
@@ -1025,7 +1133,50 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1025
1133
  }
1026
1134
  }
1027
1135
  }
1028
- mappedObject[VlocityCard_1.default.Definition__c] = JSON.stringify(updatedPropertySet);
1136
+ // Handle events[] array references (Migration)
1137
+ if (propertySet.events && Array.isArray(propertySet.events)) {
1138
+ this.updateEventsWithRegistry(propertySet.events, invalidIpNames);
1139
+ }
1140
+ mappedObject[VlocityCard_1.default.Definition__c] = JSON.stringify(propertySet);
1141
+ }
1142
+ }
1143
+ /**
1144
+ * Update events array references (Migration)
1145
+ * Handles: events[].actionList[].stateAction references
1146
+ */
1147
+ updateEventsWithRegistry(events, invalidIpNames) {
1148
+ for (const event of events) {
1149
+ if (!event.actionList || !Array.isArray(event.actionList)) {
1150
+ continue;
1151
+ }
1152
+ for (const action of event.actionList) {
1153
+ if (!action.stateAction) {
1154
+ continue;
1155
+ }
1156
+ const stateAction = action.stateAction;
1157
+ // 1-2. Handle message.value.bundle (DataRaptor) and message.value.ipMethod (Integration Procedure)
1158
+ this.processStateActionMessageWithRegistry(stateAction, invalidIpNames);
1159
+ // 3. Handle cardName (FlexCard - Flyout childCard)
1160
+ if (stateAction.cardName) {
1161
+ const originalCardName = stateAction.cardName;
1162
+ if (this.nameRegistry.hasFlexCardMapping(originalCardName)) {
1163
+ stateAction.cardName = this.nameRegistry.getFlexCardCleanedName(originalCardName);
1164
+ }
1165
+ else {
1166
+ logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['Flexcard', originalCardName])}`);
1167
+ stateAction.cardName = this.cleanName(originalCardName);
1168
+ }
1169
+ }
1170
+ // 4. Handle flyoutLwc (FlexCard child card and custom LWC references)
1171
+ this.updateFlyoutLwcValue(stateAction);
1172
+ if (this.hasOmniscriptFlyoutDependency(stateAction)) {
1173
+ this.updateOsNameWithRegistry(stateAction, 'osName');
1174
+ }
1175
+ // 6. Handle omniType.Name (OmniScript)
1176
+ if (stateAction.omniType && stateAction.omniType.Name) {
1177
+ this.updateOmniTypeNameWithRegistry(stateAction.omniType);
1178
+ }
1179
+ }
1029
1180
  }
1030
1181
  }
1031
1182
  /**
@@ -1034,7 +1185,7 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1034
1185
  updateDataSourceWithRegistry(dataSource, invalidIpNames, context) {
1035
1186
  var _a, _b;
1036
1187
  const type = dataSource.type;
1037
- if (type === stringContants_1.Constants.DataRaptorComponentName || type === 'DataRaptor') {
1188
+ if (type === stringContants_1.Constants.DataRaptorComponentName) {
1038
1189
  // Handle DataRaptor using registry
1039
1190
  const originalBundle = ((_a = dataSource.value) === null || _a === void 0 ? void 0 : _a.bundle) || '';
1040
1191
  if (originalBundle && this.nameRegistry.hasDataMapperMapping(originalBundle)) {
@@ -1045,7 +1196,7 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1045
1196
  dataSource.value.bundle = this.cleanName(originalBundle);
1046
1197
  }
1047
1198
  }
1048
- else if (type === stringContants_1.Constants.IntegrationProcedurePluralName || type === 'IntegrationProcedures') {
1199
+ else if (type === stringContants_1.Constants.IntegrationProcedurePluralName) {
1049
1200
  // Handle Integration Procedures using registry
1050
1201
  const ipMethod = ((_b = dataSource.value) === null || _b === void 0 ? void 0 : _b.ipMethod) || '';
1051
1202
  const hasRegistryMapping = this.nameRegistry.hasIntegrationProcedureMapping(ipMethod);
@@ -1101,36 +1252,25 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1101
1252
  if (component.element === 'action' && component.property && component.property.actionList) {
1102
1253
  for (const action of component.property.actionList) {
1103
1254
  if (action.stateAction) {
1255
+ // Handle message field (contains DataRaptor/IP references as JSON string)
1256
+ this.processStateActionMessageWithRegistry(action.stateAction);
1104
1257
  // Case 1: Direct OmniScript reference
1105
1258
  if (action.stateAction.type === stringContants_1.Constants.OmniScriptComponentName && action.stateAction.omniType) {
1106
1259
  this.updateOmniTypeNameWithRegistry(action.stateAction.omniType);
1107
1260
  }
1108
1261
  // Case 2: Flyout OmniScript reference
1109
- else if (action.stateAction.type === 'Flyout' &&
1110
- action.stateAction.flyoutType === stringContants_1.Constants.OmniScriptPluralName &&
1111
- action.stateAction.osName) {
1262
+ else if (this.hasOmniscriptFlyoutDependency(action.stateAction)) {
1112
1263
  this.updateOsNameWithRegistry(action.stateAction, 'osName');
1113
1264
  }
1265
+ // Case 3: Flyout with flyoutLwc (ChildCard or CustomLwc)
1266
+ else if (this.hasFlyoutLwc(action.stateAction)) {
1267
+ this.updateFlyoutLwcValue(action.stateAction);
1268
+ }
1114
1269
  }
1115
1270
  }
1116
1271
  }
1117
1272
  // Handle Custom LWC components - special case for FlexCard references
1118
- if (component.element === 'customLwc' && component.property) {
1119
- if (component.property.customlwcname) {
1120
- const customLwcName = component.property.customlwcname;
1121
- // Check if this is a FlexCard reference (starts with "cf" prefix)
1122
- if (customLwcName === null || customLwcName === void 0 ? void 0 : customLwcName.startsWith('cf')) {
1123
- // Remove "cf" prefix to get the original FlexCard name
1124
- const originalFlexCardName = customLwcName.substring(2);
1125
- // Look up the cleaned name from registry
1126
- const cleanedFlexCardName = this.nameRegistry.getFlexCardCleanedName(originalFlexCardName);
1127
- // Update the customlwcname with the cleaned FlexCard name
1128
- component.property.customlwcname = `cf${cleanedFlexCardName}`;
1129
- logger_1.Logger.logVerbose(this.messages.getMessage('customLWCFlexCardReferenceUpdated', [customLwcName, cleanedFlexCardName]));
1130
- }
1131
- // Note: Other custom LWC names (not starting with "cf") typically don't need cleaning
1132
- }
1133
- }
1273
+ this.updateCustomLwcWithRegistry(component);
1134
1274
  // Handle standard component actions (like assessment)
1135
1275
  if (component.actions && Array.isArray(component.actions)) {
1136
1276
  for (const action of component.actions) {
@@ -1144,14 +1284,16 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1144
1284
  if (component.property.stateAction.omniType) {
1145
1285
  this.updateOmniTypeNameWithRegistry(component.property.stateAction.omniType);
1146
1286
  }
1147
- if (component.property.stateAction.type === 'Flyout' &&
1148
- component.property.stateAction.flyoutType === 'OmniScripts' &&
1149
- component.property.stateAction.osName) {
1287
+ if (this.hasOmniscriptFlyoutDependency(component.property.stateAction)) {
1150
1288
  this.updateOsNameWithRegistry(component.property.stateAction, 'osName');
1151
1289
  }
1290
+ // Handle Flyout with flyoutLwc (ChildCard or CustomLwc)
1291
+ if (this.hasFlyoutLwc(component.property.stateAction)) {
1292
+ this.updateFlyoutLwcValue(component.property.stateAction);
1293
+ }
1152
1294
  }
1153
1295
  // Handle childCardPreview elements (from old fixChildren method)
1154
- if (component.element === 'childCardPreview' && component.property) {
1296
+ if (component.element === stringContants_1.Constants.ChildCardPreview && component.property) {
1155
1297
  if (component.property.cardName) {
1156
1298
  const originalCardName = component.property.cardName;
1157
1299
  if (this.nameRegistry.hasFlexCardMapping(originalCardName)) {
@@ -1164,7 +1306,7 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1164
1306
  }
1165
1307
  }
1166
1308
  // Handle omni-flyout elements (missing from migration logic)
1167
- if (component.element === 'omni-flyout' && component.property && component.property.flyoutOmniScript) {
1309
+ if (component.element === stringContants_1.Constants.OmniFlyout && component.property && component.property.flyoutOmniScript) {
1168
1310
  if (component.property.flyoutOmniScript.osName) {
1169
1311
  const osName = component.property.flyoutOmniScript.osName;
1170
1312
  if (typeof osName === 'string') {
@@ -1261,6 +1403,121 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1261
1403
  stateAction[fieldName] = parts.map((p) => this.cleanName(p)).join('/');
1262
1404
  }
1263
1405
  }
1406
+ // ==================== Assessment Helper Methods ====================
1407
+ /**
1408
+ * Helper method to add OmniScript dependency and warnings during assessment
1409
+ * Handles osName in format "Type/SubType/Language" or "Type/SubType"
1410
+ * @param osName - OmniScript name in format "Type/SubType" or "Type/SubType/Language"
1411
+ * @param flexCardAssessmentInfo - Assessment info to update
1412
+ */
1413
+ addOmniScriptDependency(osName, flexCardAssessmentInfo) {
1414
+ if (!osName || typeof osName !== 'string') {
1415
+ return;
1416
+ }
1417
+ const parts = osName.split('/');
1418
+ if (parts.length < 2) {
1419
+ return;
1420
+ }
1421
+ const originalOsRef = parts.join('_');
1422
+ // Skip if already processed
1423
+ if (flexCardAssessmentInfo.dependenciesOS.includes(originalOsRef)) {
1424
+ return;
1425
+ }
1426
+ // Clean parts - preserve language (3rd part) as-is
1427
+ const cleanedParts = parts.length >= 3
1428
+ ? [this.cleanName(parts[0]), this.cleanName(parts[1]), parts[2]]
1429
+ : parts.map((p) => this.cleanName(p));
1430
+ const cleanedOsRef = cleanedParts.join('_');
1431
+ // Add to dependencies
1432
+ flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
1433
+ // Add warning if name will change
1434
+ if (originalOsRef !== cleanedOsRef) {
1435
+ flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
1436
+ flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
1437
+ }
1438
+ }
1439
+ /**
1440
+ * Helper method to add OmniScript dependency from type/subtype/language fields
1441
+ * @param type - OmniScript type
1442
+ * @param subtype - OmniScript subtype
1443
+ * @param language - OmniScript language (defaults to 'English')
1444
+ * @param flexCardAssessmentInfo - Assessment info to update
1445
+ */
1446
+ addOmniScriptDependencyFromParts(type, subtype, language, flexCardAssessmentInfo) {
1447
+ if (!type || !subtype) {
1448
+ return;
1449
+ }
1450
+ const lang = language || 'English';
1451
+ const originalOsRef = `${type}_${subtype}_${lang}`;
1452
+ // Skip if already processed
1453
+ if (flexCardAssessmentInfo.dependenciesOS.includes(originalOsRef)) {
1454
+ return;
1455
+ }
1456
+ const cleanedOsRef = `${this.cleanName(type)}_${this.cleanName(subtype)}_${lang}`;
1457
+ // Add to dependencies
1458
+ flexCardAssessmentInfo.dependenciesOS.push(originalOsRef);
1459
+ // Add warning if name will change
1460
+ if (originalOsRef !== cleanedOsRef) {
1461
+ flexCardAssessmentInfo.warnings.push(this.messages.getMessage('omniScriptNameChangeMessage', [originalOsRef, cleanedOsRef]));
1462
+ flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
1463
+ }
1464
+ }
1465
+ /**
1466
+ * Helper method to add DataRaptor dependency and warnings during assessment
1467
+ * @param bundle - DataRaptor bundle name
1468
+ * @param flexCardAssessmentInfo - Assessment info to update
1469
+ */
1470
+ addDataRaptorDependency(bundle, flexCardAssessmentInfo) {
1471
+ if (!bundle || flexCardAssessmentInfo.dependenciesDR.includes(bundle)) {
1472
+ return;
1473
+ }
1474
+ const cleanedBundle = this.cleanName(bundle);
1475
+ flexCardAssessmentInfo.dependenciesDR.push(bundle);
1476
+ if (bundle !== cleanedBundle) {
1477
+ flexCardAssessmentInfo.warnings.push(this.messages.getMessage('dataRaptorNameChangeMessage', [bundle, cleanedBundle]));
1478
+ flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
1479
+ }
1480
+ }
1481
+ /**
1482
+ * Helper method to add Integration Procedure dependency and warnings during assessment
1483
+ * @param ipMethod - Integration Procedure method name (Type_SubType format)
1484
+ * @param flexCardAssessmentInfo - Assessment info to update
1485
+ */
1486
+ addIntegrationProcedureDependency(ipMethod, flexCardAssessmentInfo) {
1487
+ if (!ipMethod || flexCardAssessmentInfo.dependenciesIP.includes(ipMethod)) {
1488
+ return;
1489
+ }
1490
+ const parts = ipMethod.split('_');
1491
+ const cleanedParts = parts.map((p) => this.cleanName(p, true));
1492
+ const cleanedIpMethod = cleanedParts.join('_');
1493
+ flexCardAssessmentInfo.dependenciesIP.push(ipMethod);
1494
+ if (ipMethod !== cleanedIpMethod) {
1495
+ flexCardAssessmentInfo.warnings.push(this.messages.getMessage('integrationProcedureNameChangeMessage', [ipMethod, cleanedIpMethod]));
1496
+ flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
1497
+ }
1498
+ // Add manual intervention warning if IP has more than 2 parts
1499
+ if (parts.length > 2) {
1500
+ flexCardAssessmentInfo.warnings.push(this.messages.getMessage('integrationProcedureManualUpdateMessage', [ipMethod]));
1501
+ flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Needs manual intervention');
1502
+ }
1503
+ }
1504
+ /**
1505
+ * Helper method to add FlexCard dependency and warnings during assessment
1506
+ * @param cardName - FlexCard name
1507
+ * @param flexCardAssessmentInfo - Assessment info to update
1508
+ */
1509
+ addFlexCardDependency(cardName, flexCardAssessmentInfo) {
1510
+ if (!cardName || flexCardAssessmentInfo.dependenciesFC.includes(cardName)) {
1511
+ return;
1512
+ }
1513
+ const cleanedCardName = this.cleanName(cardName);
1514
+ flexCardAssessmentInfo.dependenciesFC.push(cardName);
1515
+ if (cardName !== cleanedCardName) {
1516
+ flexCardAssessmentInfo.warnings.push(this.messages.getMessage('cardNameChangeMessage', [cardName, cleanedCardName]));
1517
+ flexCardAssessmentInfo.migrationStatus = (0, stringUtils_1.getUpdatedAssessmentStatus)(flexCardAssessmentInfo.migrationStatus, 'Warnings');
1518
+ }
1519
+ }
1520
+ // ==================== End Assessment Helper Methods ====================
1264
1521
  getCardFields() {
1265
1522
  return this.IS_STANDARD_DATA_MODEL
1266
1523
  ? Object.values(VlocityCard_1.default).filter((value) => value !== '')
@@ -1307,12 +1564,60 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1307
1564
  }
1308
1565
  }
1309
1566
  }
1567
+ // Check OmniScript references in events[] array
1568
+ if (definition && definition.events && Array.isArray(definition.events)) {
1569
+ if (this.eventsHaveAngularOmniScriptDependency(definition.events)) {
1570
+ return true;
1571
+ }
1572
+ }
1310
1573
  }
1311
1574
  catch (err) {
1312
1575
  logger_1.Logger.error(`Error checking Angular dependencies for card ${card['Name']}: ${err.message}`);
1313
1576
  }
1314
1577
  return false;
1315
1578
  }
1579
+ /**
1580
+ * Check if events array has Angular OmniScript dependencies
1581
+ */
1582
+ eventsHaveAngularOmniScriptDependency(events) {
1583
+ for (const event of events) {
1584
+ if (!event.actionList || !Array.isArray(event.actionList)) {
1585
+ continue;
1586
+ }
1587
+ for (const action of event.actionList) {
1588
+ if (!action.stateAction) {
1589
+ continue;
1590
+ }
1591
+ const stateAction = action.stateAction;
1592
+ // Check omniType.Name
1593
+ if (stateAction.omniType) {
1594
+ if (this.checkOmniTypeForAngular(stateAction.omniType)) {
1595
+ return true;
1596
+ }
1597
+ }
1598
+ if (this.hasOmniscriptFlyoutDependency(stateAction)) {
1599
+ if (this.checkOsNameForAngular(stateAction.osName)) {
1600
+ return true;
1601
+ }
1602
+ }
1603
+ }
1604
+ }
1605
+ return false;
1606
+ }
1607
+ hasOmniscriptFlyoutDependency(stateAction) {
1608
+ return (stateAction.type === stringContants_1.Constants.Flyout &&
1609
+ stateAction.flyoutType === stringContants_1.Constants.OmniScriptPluralName &&
1610
+ stateAction.osName);
1611
+ }
1612
+ hasFlexCardFlyoutDependency(stateAction) {
1613
+ return (stateAction.type === stringContants_1.Constants.Flyout && stateAction.flyoutType === stringContants_1.Constants.ChildCard && stateAction.flyoutLwc);
1614
+ }
1615
+ hasCustomLwcFlyoutDependency(stateAction) {
1616
+ return (stateAction.type === stringContants_1.Constants.Flyout && stateAction.flyoutType === stringContants_1.Constants.CustomLwc && stateAction.flyoutLwc);
1617
+ }
1618
+ hasFlyoutLwc(stateAction) {
1619
+ return stateAction.type === stringContants_1.Constants.Flyout && stateAction.flyoutLwc;
1620
+ }
1316
1621
  /**
1317
1622
  * Recursively check if a component has Angular Omniscript dependencies
1318
1623
  */
@@ -1334,9 +1639,7 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1334
1639
  }
1335
1640
  }
1336
1641
  // Case 2: Flyout OmniScript reference
1337
- else if (action.stateAction.type === 'Flyout' &&
1338
- action.stateAction.flyoutType === stringContants_1.Constants.OmniScriptPluralName &&
1339
- action.stateAction.osName) {
1642
+ else if (this.hasOmniscriptFlyoutDependency(action.stateAction)) {
1340
1643
  if (this.checkOsNameForAngular(action.stateAction.osName)) {
1341
1644
  return true;
1342
1645
  }
@@ -1361,16 +1664,14 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1361
1664
  return true;
1362
1665
  }
1363
1666
  }
1364
- if (component.property.stateAction.type === 'Flyout' &&
1365
- component.property.stateAction.flyoutType === 'OmniScripts' &&
1366
- component.property.stateAction.osName) {
1667
+ if (this.hasOmniscriptFlyoutDependency(component.property.stateAction)) {
1367
1668
  if (this.checkOsNameForAngular(component.property.stateAction.osName)) {
1368
1669
  return true;
1369
1670
  }
1370
1671
  }
1371
1672
  }
1372
1673
  // Pattern 4: Handle omni-flyout elements (for test compatibility)
1373
- if (component.element === 'omni-flyout' && component.property && component.property.flyoutOmniScript) {
1674
+ if (component.element === stringContants_1.Constants.OmniFlyout && component.property && component.property.flyoutOmniScript) {
1374
1675
  if (component.property.flyoutOmniScript.osName) {
1375
1676
  if (this.checkOsNameForAngular(component.property.flyoutOmniScript.osName)) {
1376
1677
  return true;
@@ -1395,6 +1696,10 @@ class CardMigrationTool extends base_1.BaseMigrationTool {
1395
1696
  if (!omniType) {
1396
1697
  return false;
1397
1698
  }
1699
+ // Check if IsWebCompEnabled is explicitly false (Angular OmniScript)
1700
+ if (typeof omniType === 'object' && omniType.IsWebCompEnabled === false) {
1701
+ return true;
1702
+ }
1398
1703
  let omniTypeName;
1399
1704
  // Handle both string omniType and object with Name property
1400
1705
  if (typeof omniType === 'string') {