Skip to content

Commit

Permalink
v8.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Nov 14, 2022
1 parent 481a5ac commit 1ad7193
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ <h2 class="sub-headline">
rentals worldwide. This is the prototype for the pre-engineered system
known as the IT House.
<br /><br />
<div class="buttonlink" onclick="window.history.pushState('games', 'Games', '/games');">
<div class="buttonlink" onclick='console.error("Failt to book...");'>
Book now
</div>
<br /><br />
Expand Down
2 changes: 1 addition & 1 deletion demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Gleap = window.Gleap;

Gleap.setFrameUrl("http://0.0.0.0:3001");
Gleap.setApiUrl("http://0.0.0.0:9000");
Gleap.initialize("gDHGltEcKRLVaVt47QrbfrrbN4SFkYV8");
Gleap.initialize("ek98ANmHary9PQNG5EIl6TQd3SzqstZA");
//Gleap.setEnvironment("dev");

Gleap.attachCustomData({
Expand Down
8 changes: 6 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ export namespace Gleap {
userHash?: string
): void;
function open(): void;
function openNews(): void;
function openFeatureRequests(): void;
function openNews(showBackButton?: boolean): void;
function openNewsArticle(collectionId: string, articleId?: string, showBackButton?: boolean): void;
function openHelpCenter(showBackButton?: boolean): void;
function openHelpArticle(id: string, showBackButton?: boolean): void;
function searchHelpCenter(term: string, showBackButton?: boolean): void;
function openFeatureRequests(showBackButton?: boolean): void;
function close(): void;
function hide(): void;
function setEnvironment(environment: "dev" | "staging" | "prod"): void;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gleap",
"version": "8.2.6",
"version": "8.3.0",
"main": "build/index.js",
"scripts": {
"start": "webpack serve",
Expand Down
1 change: 1 addition & 0 deletions published/8.3.0/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion published/latest/index.js

Large diffs are not rendered by default.

72 changes: 69 additions & 3 deletions src/Gleap.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,69 @@ class Gleap {
GleapFrameManager.getInstance().showWidget();
}

/**
* Opens a help article
*/
static openHelpArticle(collectionId, articleId, showBackButton = true) {
if (!collectionId) {
return;
}

GleapFrameManager.getInstance().setAppMode("widget");

GleapFrameManager.getInstance().sendMessage({
name: "open-help-article",
data: {
collectionId,
articleId,
hideBackButton: !showBackButton,
}
}, true);

GleapFrameManager.getInstance().showWidget();
}

/**
* Opens the help center.
*/
static openHelpCenter(showBackButton = true) {
GleapFrameManager.getInstance().setAppMode("widget");

GleapFrameManager.getInstance().sendMessage({
name: "open-helpcenter",
data: {
hideBackButton: !showBackButton,
},
}, true);

GleapFrameManager.getInstance().showWidget();
}

/**
* Search for news articles in the help center
*/
static searchHelpCenter(term, showBackButton = true) {
if (!id) {
return;
}

GleapFrameManager.getInstance().setAppMode("widget");

GleapFrameManager.getInstance().sendMessage({
name: "open-helpcenter-search",
data: {
term,
hideBackButton: !showBackButton,
}
}, true);

GleapFrameManager.getInstance().showWidget();
}

/**
* Opens a news article
*/
static openNewsArticle(id) {
static openNewsArticle(id, showBackButton = true) {
if (!id) {
return;
}
Expand All @@ -568,6 +627,7 @@ class Gleap {
name: "open-news-article",
data: {
id,
hideBackButton: !showBackButton,
}
}, true);

Expand All @@ -577,11 +637,14 @@ class Gleap {
/**
* Opens the news overview.
*/
static openNews() {
static openNews(showBackButton = true) {
GleapFrameManager.getInstance().setAppMode("widget");

GleapFrameManager.getInstance().sendMessage({
name: "open-news",
data: {
hideBackButton: !showBackButton,
},
}, true);

GleapFrameManager.getInstance().showWidget();
Expand All @@ -590,11 +653,14 @@ class Gleap {
/**
* Opens the feature requests overview.
*/
static openFeatureRequests() {
static openFeatureRequests(showBackButton = true) {
GleapFrameManager.getInstance().setAppMode("widget");

GleapFrameManager.getInstance().sendMessage({
name: "open-feature-requests",
data: {
hideBackButton: !showBackButton,
},
}, true);

GleapFrameManager.getInstance().showWidget();
Expand Down
14 changes: 7 additions & 7 deletions src/GleapFrameManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ export default class GleapFrameManager {
}

const surveyStyle = "gleap-frame-container--survey";
const newsdetailsStyle = "gleap-frame-container--news";
const extendedStyle = "gleap-frame-container--extended";
const surveyFullStyle = "gleap-frame-container--survey-full";
const classicStyle = "gleap-frame-container--classic";
const classicStyleLeft = "gleap-frame-container--classic-left";
const modernStyleLeft = "gleap-frame-container--modern-left";
const noButtonStyleLeft = "gleap-frame-container--no-button";
const allStyles = [classicStyle, classicStyleLeft, newsdetailsStyle, modernStyleLeft, noButtonStyleLeft, surveyStyle, surveyFullStyle];
const allStyles = [classicStyle, classicStyleLeft, extendedStyle, modernStyleLeft, noButtonStyleLeft, surveyStyle, surveyFullStyle];
for (let i = 0; i < allStyles.length; i++) {
this.gleapFrameContainer.classList.remove(allStyles[i]);
}
Expand Down Expand Up @@ -160,8 +160,8 @@ export default class GleapFrameManager {
if (this.appMode === "survey_full") {
this.gleapFrameContainer.classList.add(surveyFullStyle);
}
if (this.appMode === "newsdetails") {
this.gleapFrameContainer.classList.add(newsdetailsStyle);
if (this.appMode === "extended") {
this.gleapFrameContainer.classList.add(extendedStyle);
}

this.gleapFrameContainer.setAttribute("dir", GleapTranslationManager.getInstance().isRTLLayout ? "rtl" : "ltr");
Expand Down Expand Up @@ -335,10 +335,10 @@ export default class GleapFrameManager {
}

if (data.name === "page-changed") {
if (data.data && data.data.name === "newsdetails") {
this.setAppMode("newsdetails");
if (data.data && (data.data.name === "newsdetails" || data.data.name === "appextended")) {
this.setAppMode("extended");
} else {
if (this.appMode === "newsdetails") {
if (this.appMode === "extended") {
this.setAppMode("widget");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const injectStyledCSS = (
right: ${buttonX}px;
bottom: ${75 + buttonY}px;
width: calc(100% - 40px);
max-width: 390px;
max-width: 400px;
position: fixed;
z-index: ${zIndexBase + 31};
visibility: visible;
Expand Down Expand Up @@ -137,7 +137,7 @@ export const injectStyledCSS = (
bottom: ${buttonY}px !important;
}
.gleap-frame-container--news {
.gleap-frame-container--extended {
max-width: 690px !important;
}
Expand Down

0 comments on commit 1ad7193

Please sign in to comment.