From 7ae5061be316e8b7828ade857f35c4c22b139740 Mon Sep 17 00:00:00 2001
From: Ruchika Sinha <69535463+Ruchika4@users.noreply.github.com>
Date: Thu, 9 Jan 2025 15:17:44 -0800
Subject: [PATCH] Revert "Revert "hlx5 update (#41)" (#42)" (#43)

This reverts commit 7e1a058e93ebe188e4419483cbd410cacc85151c.
---
 scripts/utils.js           |  4 ++--
 test/scripts/utils.test.js |  6 +++---
 tools/sidekick/config.json | 10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/utils.js b/scripts/utils.js
index 807aae6..1830542 100644
--- a/scripts/utils.js
+++ b/scripts/utils.js
@@ -19,10 +19,10 @@ export const [setLibs, getLibs] = (() => {
     (prodLibs, location) => {
       libs = (() => {
         const { hostname, search } = location || window.location;
-        if (!(hostname.includes('.hlx.') || hostname.includes('local'))) return prodLibs;
+        if (!(hostname.includes('.hlx.') || hostname.includes('.aem') || hostname.includes('local'))) return prodLibs;
         const branch = new URLSearchParams(search).get('milolibs') || 'main';
         if (branch === 'local') return 'http://localhost:6456/libs';
-        return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`;
+        return branch.includes('--') ? `https://${branch}.aem.live/libs` : `https://${branch}--milo--adobecom.aem.live/libs`;
       })();
       return libs;
     }, () => libs,
diff --git a/test/scripts/utils.test.js b/test/scripts/utils.test.js
index ccc0ac9..a86ddf2 100644
--- a/test/scripts/utils.test.js
+++ b/test/scripts/utils.test.js
@@ -4,7 +4,7 @@ import { setLibs } from '../../scripts/utils.js';
 describe('Libs', () => {
   it('Default Libs', () => {
     const libs = setLibs('/libs');
-    expect(libs).to.equal('https://main--milo--adobecom.hlx.live/libs');
+    expect(libs).to.equal('https://main--milo--adobecom.aem.live/libs');
   });
 
   it('Does not support milolibs query param on prod', () => {
@@ -22,7 +22,7 @@ describe('Libs', () => {
       search: '?milolibs=foo',
     };
     const libs = setLibs('/libs', location);
-    expect(libs).to.equal('https://foo--milo--adobecom.hlx.live/libs');
+    expect(libs).to.equal('https://foo--milo--adobecom.aem.live/libs');
   });
 
   it('Supports local milolibs query param', () => {
@@ -40,6 +40,6 @@ describe('Libs', () => {
       search: '?milolibs=awesome--milo--forkedowner',
     };
     const libs = setLibs('/libs', location);
-    expect(libs).to.equal('https://awesome--milo--forkedowner.hlx.live/libs');
+    expect(libs).to.equal('https://awesome--milo--forkedowner.aem.live/libs');
   });
 });
diff --git a/tools/sidekick/config.json b/tools/sidekick/config.json
index db6e69e..744660b 100644
--- a/tools/sidekick/config.json
+++ b/tools/sidekick/config.json
@@ -3,9 +3,9 @@
     {
       "id": "library",
       "title": "Library",
-      "environments": [
-        "edit"
-      ],
+      "previewHost": "main--news--adobecom.aem.page",
+      "liveHost": "main--news--adobecom.aem.live",
+      "environments": [ "edit" ],
       "isPalette": true,
       "passConfig": true,
       "paletteRect": "top: auto; bottom: 20px; left: 20px; height: 398px; width: 360px;",
@@ -24,7 +24,7 @@
       "id": "localize",
       "title": "Localize",
       "environments": [ "edit" ],
-      "url": "https://main--milo--adobecom.hlx.page/tools/loc/index.html?project=news--adobecom",
+      "url": "https://main--milo--adobecom.aem.page/tools/loc/index.html?project=news--adobecom",
       "passReferrer": true,
       "includePaths": [ "**/:x**" ]
     },
@@ -33,7 +33,7 @@
       "id": "localize-2",
       "title": "Localize (V2)",
       "environments": [ "edit" ],
-      "url": "https://main--news--adobecom.hlx.page/tools/loc?milolibs=locui",
+      "url": "https://main--news--adobecom.aem.page/tools/loc?milolibs=locui",
       "passReferrer": true,
       "passConfig": true,
       "includePaths": [ "**.xlsx**" ]