Skip to content

Commit

Permalink
feat: add the plugin system to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
ramboz committed Oct 31, 2023
1 parent 3711b02 commit da6151f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import {
waitForLCP,
loadBlocks,
loadCSS,
getMetadata,
getAllMetadata,
isDesktop,
isMobile,
isTablet,
} from './lib-franklin.js';

import {
Expand All @@ -27,11 +32,27 @@ import {

const LCP_BLOCKS = []; // add your LCP blocks to the list

const AUDIENCES = {
mobile: () => isMobile,
tablet: () => isTablet,
desktop: () => isDesktop,
// define your custom audiences here as needed
};

window.hlx.plugins.add('rum-conversion', {
url: '/plugins/rum-conversion/src/index.js',
load: 'lazy',
});

window.hlx.plugins.add('experience-decisioning', {
condition: () => getMetadata('experiment')
|| Object.keys(getAllMetadata('campaign')).length
|| Object.keys(getAllMetadata('audience')).length,
options: { audiences: AUDIENCES },
load: 'eager',
url: '/plugins/experience-decisioning/src/index.js',
});

/**
* Builds hero block and prepends to main in a new section.
* @param {Element} main The container element
Expand Down

0 comments on commit da6151f

Please sign in to comment.