Skip to content

Commit

Permalink
Merge branch 'flex-webchat-ui' into FLEXIN-74
Browse files Browse the repository at this point in the history
# Conflicts:
#	public/index.html
  • Loading branch information
ashishkumarTWLO committed Oct 12, 2023
2 parents 2fece92 + 52c4ff2 commit 3b4a1ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## This .env file is required to run e2e tests. To run webchat react add query params
## To understand how to add request params, please refer to README.md.


ACCOUNT_SID=
AUTH_TOKEN=
API_KEY=
Expand Down
28 changes: 1 addition & 27 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="shortcut icon" href="https://media.twiliocdn.com/sdk/js/webchat-v3/assets/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Twilio Webchat React App</title>
<link rel="stylesheet" href="./app.css">
</head>
Expand All @@ -28,24 +19,7 @@
You need to enable JavaScript to run this app.
</noscript>
<div id="twilio-webchat-widget-root"></div>
<script>
window.addEventListener("DOMContentLoaded", () => {
const urlParams = new URLSearchParams(window.location.search);
const isLightTheme = urlParams.get("theme") === "light";
const el = document.querySelector("[data-theme-pref]");

el && el.setAttribute("data-theme-pref", isLightTheme ? "light-theme" : "dark-theme");

Twilio.initLogger("info");
Twilio.initWebchat({
deploymentKey: urlParams.get("deploymentKey") || "%REACT_APP_DEPLOYMENT_KEY%",
region: urlParams.get("region") || "%REACT_APP_REGION%",
theme: {
isLight: isLightTheme
}
})
});
</script>
<script defer src="./app.js"></script>
</body>

</html>

0 comments on commit 3b4a1ea

Please sign in to comment.