Skip to content
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

Set widget BASE_TARGET on ENV variables #224

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions widget/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM node:14-alpine AS builder_widget

# Declaring env
ENV NODE_ENV production
ARG BASE_TARGET _parent

# Setting up the work directory
WORKDIR /app
Expand Down
11 changes: 6 additions & 5 deletions widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,9 @@ <h2 id="offline-message-heading">
integrity="sha384-mZLF4UVrpi/QTWPA7BjNPEnkIfRFn4ZEO3Qt/HFklTJBj/gBOV8G3HcKn4NfQblz"
crossorigin="anonymous"></script>



<script>
<script type="module">
const STREAM_RESPONSE = true;


// message format

let origin = '';
Expand Down Expand Up @@ -238,6 +235,11 @@ <h2 id="offline-message-heading">
chatWidget.classList.add('hide-chat-actions');
}

// Open links in a new tab
const baseTag = document.querySelector('head base');
const baseTarget = process.env.BASE_TARGET || "_parent";
baseTag.setAttribute('target', baseTarget);

/**
* Iframe communications
*/
Expand Down Expand Up @@ -1369,5 +1371,4 @@ <h2 id="offline-message-heading">
data-code="VEW6587Xat8LXjE7ejokwXUked6s7udc"></script>
</body>


</html>