Skip to content

Commit 18a468a

Browse files
authored
Merge pull request #74 from GleapSDK/modal-action-button-url
[v14.6.3] [#80645] fix: modal action url opening in the new window and same window
2 parents 15203a1 + 8f8c7a7 commit 18a468a

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed

build/cjs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/esm/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "14.6.2",
3+
"version": "14.6.3",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/14.6.3/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GleapChecklist.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export const registerGleapChecklist = () => {
306306
this._hasLoaded = false;
307307
this.renderResponse();
308308
const sharedKey = this.getAttribute("sharedKey");
309-
309+
310310
this._networkManager
311311
.validateChecklist(outboundId, sharedKey)
312312
.then((internalId) => {
@@ -1147,9 +1147,12 @@ export const registerGleapChecklist = () => {
11471147
if (step.action === "BOT") Gleap.startBot(step.botId);
11481148
else if (step.action === "CUSTOM_ACTION")
11491149
Gleap.triggerCustomAction(step.actionBody);
1150-
else if (step.action === "REDIRECT_URL")
1150+
else if (step.action === "REDIRECT_URL") {
1151+
e.preventDefault();
1152+
e.stopPropagation();
1153+
e.stopImmediatePropagation();
11511154
Gleap.openURL(step.actionBody, !!step.actionOpenInNewTab);
1152-
else if (step.action === "FEEDBACK_FLOW")
1155+
} else if (step.action === "FEEDBACK_FLOW")
11531156
Gleap.startFeedbackFlow(step.formId);
11541157
else if (step.action === "NEWS_ARTICLE")
11551158
Gleap.openNewsArticle(step.articleId);

src/GleapFrameManager.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,7 @@ export default class GleapFrameManager {
3737
if (url && url.length > 0) {
3838
if (newTab) {
3939
const newWindow = window.open(url, "_blank");
40-
41-
// Check if the new window was successfully created and not blocked
42-
if (
43-
!newWindow ||
44-
newWindow.closed ||
45-
typeof newWindow.closed === "undefined"
46-
) {
47-
// If the new window was blocked, navigate in the same tab instead
48-
window.location.href = url;
49-
} else {
50-
// If the new window was created successfully, bring it into focus
40+
if (newWindow) {
5141
newWindow.focus();
5242
}
5343
} else {

0 commit comments

Comments
 (0)