Appearance
Experience manager
@investec/plugins-experience-manager is the journey-decision layer for pre-login and post-login navigation. It maps the authenticated customer context to a destination URL and also provides a helper for decoding encoded destinations.
Package
Warning: By default, this package must be installed only by the platform team into the Investec Online shell application. Do not add it as a direct dependency of a consumer/feature application unless the Web Platform team has explicitly approved that specific use as a rare exception. Consumers should use this plugin's behaviour through the Invsy SDK, or contribute a bounded, governed change to this plugin's own source (see Plugin change governance).
sh
npm install --save @investec/plugins-experience-managerThe platform owns installation of released plugin versions. A consuming team normally contributes shared logic in this repository and then asks the platform team to adopt the published version.
Public contract
The main package-root exports include:
experienceManager.activeEnvironmentdetermineJourneyPreLogin()determineJourneyAfterLogin(authRes)decodeDestination(destination)- helper exports such as
setDecisionFlags(...)andgetDestinationBasedOnCurrentContext(...) - shared route helpers such as
getAppPathFromAppRoute(...)andfilterSecondaryDestinations(...)
Integration pattern
Set the environment first:
ts
import { determineJourneyAfterLogin, determineJourneyPreLogin, experienceManager } from '@investec/plugins-experience-manager';
experienceManager.activeEnvironment = 'staging';Use the pre-login function for anonymous or expired-session entry:
ts
const loginUrl = determineJourneyPreLogin();Use the post-login function after auth context is available:
ts
const destination = await determineJourneyAfterLogin(authResponse);What the post-login logic does
The plugin:
- builds an initial destination from high-level client flags;
- routes multi-journey users to
/usrroot-wpaas/typeswhen required; - applies secondary filters for special profile, masquerade, IX, intermediary, life, Mauritius, and other edge cases;
- returns the final URL as a string.
Encoded destinations
decodeDestination(...) reads the ZGVzdGluYXRpb24 query parameter and decodes it. If the destination points at a known dotcom hostname, it rewrites the target under /aem-content/.
How consumers extend it
The supported consumer pattern is to call the plugin first, then apply any application-owned navigation decision after the returned destination.
Use consumer code for rules that belong to one app only, such as:
- whether to open a destination in the same tab or a new tab;
- temporary gating or A/B behaviour around a returned path;
- UI behaviour that depends on the chosen destination.
Change the plugin package when the journey rule itself is a shared Investec Online rule and should apply to every consumer using the package.
Extension example: wrap the returned destination with app-owned policy
ts
import { determineJourneyAfterLogin } from '@investec/plugins-experience-manager';
type NavigationTarget = {
url: string;
target?: '_self' | '_blank';
};
export async function resolveHomeJourney(authResponse: any, options: { openIxInSameTab: boolean }): Promise<NavigationTarget> {
const destination = await determineJourneyAfterLogin(authResponse);
if (options.openIxInSameTab && destination.startsWith('https://ix')) {
return { url: destination, target: '_self' };
}
if (destination.startsWith('/open-api/')) {
return { url: destination, target: '_blank' };
}
return { url: destination };
}Extend the shared plugin
Use these extension locations:
| Change | Location |
|---|---|
| Add a shared top-level destination flag | decisionFlagsDestinations and setDecisionFlags(...) |
| Add an approved secondary journey rule | filterSecondaryDestinations(...) |
| Add an environment-specific external destination | experience-manager/src/lib/environment.ts |
| Add or retire a supported pre-login path | allowedPreLoginDestinations and the canonicalisation helpers |
| Publish a new supported helper | experience-manager/src/index.ts |
Add focused tests for rule order, multi-journey users, environment differences, and canonical login paths. Contact the Web Platform team before changing the default destination, authentication journey, encoded-destination handling, legacy-login migration, or ownership of a route.
Consumer notes
determineJourneyPreLogin()readswindow.locationdirectly and preserves only approved query parameters. It returns/login/formfor the public/loginroute and preserves canonical nested/login/*journeys.determineJourneyAfterLogin(...)returns a Promise even though most logic is synchronous from the consumer point of view.- Environment differences affect destination URLs used in secondary routing, especially IX and intermediary flows.