From ebe70141747d20f3aad9994171b5931a57a9b908 Mon Sep 17 00:00:00 2001
From: RMidhunSuresh <hi@midhun.dev>
Date: Mon, 21 Feb 2022 13:15:50 +0530
Subject: [PATCH] Move parent files into /parent directory

---
 index.html                        | 2 +-
 src/{ => parent}/parent-style.css | 4 ++--
 src/{ => parent}/parent.ts        | 3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)
 rename src/{ => parent}/parent-style.css (75%)
 rename src/{ => parent}/parent.ts (96%)

diff --git a/index.html b/index.html
index 83334ac..ad63379 100644
--- a/index.html
+++ b/index.html
@@ -43,7 +43,7 @@
     <script>
         window.CHATTERBOX_CONFIG_LOCATION = "./config.json";
     </script>
-    <script src="./src/parent.ts" type="module" id="chatterbox-script"></script>
+    <script src="./src/parent/parent.ts" type="module" id="chatterbox-script"></script>
 </body>
 
 </html>
diff --git a/src/parent-style.css b/src/parent/parent-style.css
similarity index 75%
rename from src/parent-style.css
rename to src/parent/parent-style.css
index 7dfe707..a6eaa88 100644
--- a/src/parent-style.css
+++ b/src/parent/parent-style.css
@@ -32,10 +32,10 @@
     border: none;
     border-radius: 100%;
     cursor: pointer;
-    background: no-repeat center url('./ui/res/chat-bubbles.svg'), linear-gradient(180deg, #7657F2 0%, #5C56F5 100%);
+    background: no-repeat center url('../ui/res/chat-bubbles.svg'), linear-gradient(180deg, #7657F2 0%, #5C56F5 100%);
     box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 12px 32px -2px rgba(0, 0, 0, 0.2);
 }
 
 .start-background-minimized {
-    background: no-repeat center url("./ui/res/chevron-down-button.svg"), linear-gradient(180deg, #7657F2 0%, #5C56F5 100%);
+    background: no-repeat center url("../ui/res/chevron-down-button.svg"), linear-gradient(180deg, #7657F2 0%, #5C56F5 100%);
 }
diff --git a/src/parent.ts b/src/parent/parent.ts
similarity index 96%
rename from src/parent.ts
rename to src/parent/parent.ts
index 208267a..8ca6dbb 100644
--- a/src/parent.ts
+++ b/src/parent/parent.ts
@@ -2,8 +2,7 @@ import "./parent-style.css";
 
 let isIframeLoaded = false;
 const parentHostRoot = (document.querySelector("#chatterbox-script") as HTMLScriptElement).src;
-const parentHosRootURL = new URL(parentHostRoot);
-const hostRoot = `${parentHosRootURL.protocol}${parentHosRootURL.host}`;
+const hostRoot = new URL(parentHostRoot).origin;
 
 const sizeCollection = {
     "desktop": {
-- 
GitLab