-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add plugin system and experimentation plugin to the site #405
Conversation
…xperience-decisioning'
git-subtree-dir: plugins/experience-decisioning git-subtree-split: 72ddbdb84bd53bee39da1a70aa17318065ea481e
e6f6479 Merge branch 'main' into plugin-api 9028520 fix: possible css leaking into pill overlay 162aab2 fix: improve anonymization for better gdpr/hippa compliance (#3) git-subtree-dir: plugins/experience-decisioning git-subtree-split: e6f6479ea2b305452ed84bc4cd48f50197d5edb2
Hello, I'm the AEM Code Sync Bot and I will run some test suites that validate the page speed.
|
|
1268232 feat: add possibility to config prod hosts to disable the overlay pill git-subtree-dir: plugins/experience-decisioning git-subtree-split: 126823275dd83b088e5394890cb79d1ed4d76b61
@@ -18,8 +19,7 @@ | |||
export function sampleRUM(checkpoint, data = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to sampleRUM
are just me copying over the latest from the aem boilerplate.
* @param {string} [cssPath] An optional CSS file to load | ||
* @param {object[]} [args] Parameters to be passed to the default export when it is called | ||
*/ | ||
async function loadModule(name, jsPath, cssPath, ...args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the JS/CSS loading logic from loadBlock
, extracted to a dedicated method so the plugins can leverage it as well to load their JS/CSS files as needed
scripts/lib-franklin.js
Outdated
* @param {Element} block The block element | ||
* @returns {Object} The block config (blockName, cssPath and jsPath) | ||
*/ | ||
function getBlockConfig(block) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lets us override the default block loading path via methods pushed to window.hlx.patchBlockConfig
.
The experimentation plugin expects it to be here to work since it patches the block path for block experiments
@@ -660,9 +683,3 @@ if (window.location.hostname === 'www.hlx.live') { | |||
*/ | |||
|
|||
loadPage(document); | |||
|
|||
if (window.name.includes('performance')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved and added as a simple plugin
|
|
@trieloff @kptdobe @davidnuescheler Let me know your thoughts on the PR. |
|
git-subtree-dir: plugins/experimentation git-subtree-split: effa50e9905c53d8bc6b99c54277b4f412607af8
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok from my side. I'd like to run targeted content that shows 24 hours prior to our Discord events and advertises them.
9d1d32a feat: add support for direct experiment manfiest url in the metadata git-subtree-dir: plugins/experimentation git-subtree-split: 9d1d32a74efefe41a34bcfc0838bfec7ad566268
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments on the plugin system.
[...this.#plugins.entries()] | ||
.filter(([, plugin]) => plugin.condition | ||
&& !plugin.condition(document, plugin.options, executionContext)) | ||
.map(([id]) => this.#plugins.delete(id)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is highly unusual: not just does the .map
function have a side-effect, it also modifies the very base of its operation.
In this case either a forEach
or a reduce
(you re-assign the result to this.#plugins
) would work better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point!
.filter(([, plugin]) => plugin.condition | ||
&& !plugin.condition(document, plugin.options, executionContext)) | ||
.map(([id]) => this.#plugins.delete(id)); | ||
return Promise.all([...this.#plugins.entries()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a Promise.all()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the plugin executions can all be async, so we return a proper promise that you can await in the caller
As discussed with @trieloff during our recent workshop, I'm adding the plugin system and the experimentation plugin to the website.
Description
performance.js
as a pluginRelated Issue
adobe/aem-boilerplate#254
Motivation and Context
The goal is to instrument a half-dozen sites so we can validate the current implementation and test it against real use cases in prod.
How Has This Been Tested?
The plugin system has been tested on 2 websites, and the experimentation plugin has a demo site to test the various use cases. I also added a demo experiment in the drafts: https://plugin-system--helix-website--adobe.hlx.page/drafts/ramboz/test-experiment/
It changes the label in the CTA.
Screenshots (if appropriate):
Types of changes
Checklist: