Skip to content

Commit

Permalink
Merge pull request #141 from Sitecore/read-connectors-used
Browse files Browse the repository at this point in the history
Read data about selected integration connectors
  • Loading branch information
jst-cyr committed Mar 14, 2024
2 parents ca10b97 + 826a2df commit 63bfac5
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/OutcomeFlow/outcome.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ describe('Outcome Page', () => {
cy.get('[value="xm"]').click();
cy.get('[value="nosecuredpages"]').click();
cy.get('[value="search-no"]').click();
cy.get('[value="xp-connect-none"]').click();
cy.get('.css-gmuwbf > .chakra-button').click();
cy.get('[value="scs"]').click();
cy.get('[value="vuejs"]').click();
cy.get('.css-gmuwbf > .chakra-button').click();
Expand Down Expand Up @@ -44,6 +46,8 @@ describe('Outcome Page', () => {
cy.get('[value="securityloginrequired"]').click();
cy.get('[value="historicalpersonalize90"]').click();
cy.get('[value="search-index"]').click();
cy.get('[value="xp-connect-none"]').click();
cy.get('.css-gmuwbf > .chakra-button').click();
cy.get('[value="unicorn"]').click();
cy.get('[value="netcore"]').click();
cy.get('.css-gmuwbf > .chakra-button').click();
Expand Down
46 changes: 46 additions & 0 deletions src/lib/GameContextParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class GameContextParser {
this.parseContext_ExperienceEdge(gameInfoContext, outcomeConditions);
this.parseContext_SiteSearchUsed(gameInfoContext, outcomeConditions);
this.parseContext_SerializationUsed(gameInfoContext, outcomeConditions);
this.parseContext_ConnectorsUsed(gameInfoContext, outcomeConditions);
}

/**
Expand Down Expand Up @@ -223,4 +224,49 @@ export class GameContextParser {
outcomeConditions.serializationUsed.unicorn = serializationUsedOptions.value.includes('unicorn');
}
}

/**
* Check for what type of integration connection modules are in the solution.
* This will drive them towards a Connect implementation (likely)
* @param gameInfoContext: This is the current context which contains the prompts and answers
* @param outcomeConditions: This is where the results should be stored
*/
parseContext_ConnectorsUsed(gameInfoContext: GameInfoContextType, outcomeConditions: OutcomeConditions) {
var connectorsUsedOptions = gameInfoContext.answers?.find(
(x: IAnswer) => x.promptQuestionId == PromptMappings.connectorsUsed
);
if (connectorsUsedOptions != undefined) {
outcomeConditions.connectorsUsed.none = connectorsUsedOptions.value.includes('xp-connect-none');

//Only read the other options if None is not selected. Blank out all selections if user selected None
//Technically, because it's a multi-select, they could select a connector and None, but we will use 'None' to rule out other selections
if (outcomeConditions.connectorsUsed.none) {
outcomeConditions.connectorsUsed = {
none: true,
sfmc: false,
sfcrm: false,
contenthub: false,
dam: false,
cmp: false,
dynamics365commerce: false,
dynamics365sales: false,
komfo: false,
sharepoint: false
};
}
//If they didn't select None, read the rest of their selections
else {
outcomeConditions.connectorsUsed.sfmc = connectorsUsedOptions.value.includes('xp-connect-sfmc');
outcomeConditions.connectorsUsed.sfcrm = connectorsUsedOptions.value.includes('xp-connect-sfcrm');
outcomeConditions.connectorsUsed.contenthub = connectorsUsedOptions.value.includes('xp-connect-contenthub');
outcomeConditions.connectorsUsed.dam = connectorsUsedOptions.value.includes('xp-connect-dam');
outcomeConditions.connectorsUsed.cmp = connectorsUsedOptions.value.includes('xp-connect-cmp');
outcomeConditions.connectorsUsed.dynamics365commerce = connectorsUsedOptions.value.includes('xp-commerce-dynamics365-commerce');
outcomeConditions.connectorsUsed.dynamics365sales = connectorsUsedOptions.value.includes('xp-connect-dynamics365sales');
outcomeConditions.connectorsUsed.komfo = connectorsUsedOptions.value.includes('xp-komfo');
outcomeConditions.connectorsUsed.sharepoint = connectorsUsedOptions.value.includes('xp-sharepoint');
}

}
}
}
4 changes: 2 additions & 2 deletions src/models/OutcomeConditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface IConnectorsUsed {
contenthub: boolean,
dam: boolean,
cmp: boolean,
dynamics365: boolean,
dynamics365commerce: boolean,
dynamics365sales: boolean,
komfo: boolean,
sharepoint: boolean,
Expand Down Expand Up @@ -181,7 +181,7 @@ export class OutcomeConditions {
contenthub: false,
dam: false,
cmp: false,
dynamics365: false,
dynamics365commerce: false,
dynamics365sales: false,
komfo: false,
sharepoint: false
Expand Down
1 change: 1 addition & 0 deletions src/models/PromptMappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export enum PromptMappings {
siteSearchUsed = 'sitesearch',
historicalPersonalization = 'historicalpersonalizationneeds',
serializationUsed = 'serialization',
connectorsUsed = 'integrationmodules',
}

0 comments on commit 63bfac5

Please sign in to comment.