Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fstab.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mountpoints:
/: https://adobe.sharepoint.com/:f:/r/sites/HelixProjects/Shared%20Documents/sites/adobe/wknd
/: https://adobe-my.sharepoint.com/:f:/r/personal/oorobei_adobe_com/Documents/wknd
3 changes: 3 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ async function loadLazy(doc) {
// Mark customer as having viewed the page once
localStorage.setItem('franklin-visitor-returning', true);

// Add aem-genai-variations script as part of the lazy loading process
import('../tools/sidekick/aem-genai-variations.js');

window.hlx.plugins.run('loadLazy');
}

Expand Down
33 changes: 33 additions & 0 deletions tools/sidekick/aem-genai-variations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(function () {
let isAEMGenAIVariationsAppLoaded = false;
function loadAEMGenAIVariationsApp() {
const script = document.createElement('script');
script.src = 'https://experience.adobe.com/solutions/aem-sites-genai-aem-genai-variations-mfe/static-assets/resources/sidekick/client.js';
script.onload = function () {
isAEMGenAIVariationsAppLoaded = true;
};
script.onerror = function () {
console.error('Error loading AEMGenAIVariationsApp.');
};
document.head.appendChild(script);
}

function handlePluginButtonClick() {
if (!isAEMGenAIVariationsAppLoaded) {
loadAEMGenAIVariationsApp();
}
}

const sidekick = document.querySelector('helix-sidekick');
if (sidekick) {
// sidekick already loaded
sidekick.addEventListener('custom:aem-genai-variations-sidekick', handlePluginButtonClick);
} else {
// wait for sidekick to be loaded
document.addEventListener('sidekick-ready', () => {
document.querySelector('helix-sidekick')
.addEventListener('custom:aem-genai-variations-sidekick', handlePluginButtonClick);
}, { once: true });
}
}());

17 changes: 11 additions & 6 deletions tools/sidekick/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@
"paletteRect": "top: 50px; bottom: 10px; right: 10px; left: auto; width:800px; height: calc(100vh - 60px)"
},
{
"id": "generate-variations",
"title": "Generate Variations",
"url": "https://experience.adobe.com/aem/generate-variations",
"passConfig": true,
"environments": [ "preview", "live", "edit" ],
"includePaths": ["**.docx**"]
"id": "generate-variations-v2",
"titleI18n": {
"en": "Generate with AI"
},
"environments": [
"preview"
],
"includePaths": [
"**.docx**"
],
"event": "aem-genai-variations-sidekick"
}
]
}