Appearance
Personalisation
@investec/plugins-personalisation wraps the Adobe Target personalisation endpoints used by the platform and provides helpers for generating profile-update payloads from returned content cards.
Package
Warning: By default, this package must be installed only by the platform team into the Investec Online shell application. Direct installation into a feature application is not permitted unless the Web Platform team has granted an explicit integration contract for that specific use — treat this as a rare, approved exception, not the norm. Consumers should otherwise 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-personalisationThe platform owns installation of released plugin versions. A consuming team normally contributes shared personalisation logic in this repository and then asks the platform team to adopt the published version.
Public contract
The main package-root exports include:
personalisation.activeEnvironmentgetAdobeTargetDataByTemplate(authRes, payload)postProfileUpdatesByTemplate(template)postProfileUpdatesOnCallToAction(card, callToActionType)- mapping helpers such as
buildProfileMapByTemplate(...),buildProfileMapByCallToAction(...),combineProfileUpdates(...),sanitizeStringForProfile(...), andvalidateCardStructureForProfileAnalytics(...)
Integration pattern
ts
import { getAdobeTargetDataByTemplate, personalisation, postProfileUpdatesOnCallToAction } from '@investec/plugins-personalisation';
personalisation.activeEnvironment = 'staging';
const response = await getAdobeTargetDataByTemplate(authResponse, {
Templates: ['Pulsator_Template'],
});
await postProfileUpdatesOnCallToAction(card, 'primary');Template retrieval
getAdobeTargetDataByTemplate(...) posts to:
text
/edge/personalisation/api/v1/target/personalisationIt requires a payload containing a non-empty Templates array.
Profile update helpers
The package supports two update flows:
- impression/template-level updates through
postProfileUpdatesByTemplate(...) - CTA engagement updates through
postProfileUpdatesOnCallToAction(...)
Both methods derive profile attributes from Adobe Target response data and post them to:
text
/edge/personalisation/api/v1/target/profile-updateHow consumers extend it
Consumers usually extend this package by controlling:
- which template names are requested;
- when a returned card should trigger a profile update;
- whether to inspect or test the generated profile map before posting it.
The mapping helpers make that easier without changing the shared package.
Change the package when the Adobe Target response contract, endpoint contract, or shared profile-mapping rules need to change.
Extension example: inspect the generated CTA profile update before posting
ts
import { buildProfileMapByCallToAction, postProfileUpdatesOnCallToAction, type IRefinedMbox } from '@investec/plugins-personalisation';
export async function trackPrimaryOfferClick(card: IRefinedMbox) {
const previewProfileMap = buildProfileMapByCallToAction(card, 'primary');
console.log('Profile update payload preview:', previewProfileMap);
const posted = await postProfileUpdatesOnCallToAction(card, 'primary');
if (!posted) {
console.warn('Profile update failed');
}
}Extend the shared plugin
Use:
personalisation.tsfor approved Target API calls and reusable mapping logic;environment.tsfor environment-specific endpoint or capability values;types/adobe-target.interface.tsfor request, response, card, template, and profile-map types;src/index.tsfor supported public exports.
For an API addition, preserve the WPaaS: critical requirement where approved, validate required inputs, return explicit failure behaviour, and add tests for malformed cards, empty updates, HTTP failure, and environment selection.
Contact the Web Platform team and personalisation owner before changing Adobe Target profile naming, audience-management behaviour, customer attributes, endpoint ownership, or the meaning of impression and engagement updates.
Consumer notes
- The current implementation accepts
authResingetAdobeTargetDataByTemplate(...), but uses only the configured endpoint and request payload. postProfileUpdatesByTemplate(...)andpostProfileUpdatesOnCallToAction(...)returnfalseon failure rather than throwing.- The mapping helpers are useful when the consumer needs to inspect or test the exact profile payload before posting it.