Skip to content

Commit 6437bcd

Browse files
committed
v8.6.0
1 parent 1fc525b commit 6437bcd

File tree

11 files changed

+64
-28
lines changed

11 files changed

+64
-28
lines changed

build/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.

index.d.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export namespace Gleap {
5454
primaryColor: string;
5555
headerColor: string;
5656
buttonColor: string;
57-
cornerRadius: string;
57+
backgroundColor: string;
58+
borderRadius?: number;
59+
buttonX?: number;
60+
buttonY?: number;
61+
buttonStyle?: string;
5862
}): void;
5963
function disableConsoleLogOverwrite(): void;
6064
function setLiveSite(isLiveSite: boolean): void;
@@ -77,18 +81,21 @@ export namespace Gleap {
7781
): void;
7882
function open(): void;
7983
function openNews(showBackButton?: boolean): void;
80-
function openNewsArticle(
81-
id: string,
82-
showBackButton?: boolean
83-
): void;
84+
function openNewsArticle(id: string, showBackButton?: boolean): void;
8485
function openConversations(showBackButton?: boolean): void;
8586
function openConversation(
8687
shareToken?: string,
8788
showBackButton?: boolean
8889
): void;
8990
function openHelpCenter(showBackButton?: boolean): void;
90-
function openHelpCenterCollection(collectionId: string, showBackButton?: boolean): void;
91-
function openHelpCenterArticle(articleId: string, showBackButton?: boolean): void;
91+
function openHelpCenterCollection(
92+
collectionId: string,
93+
showBackButton?: boolean
94+
): void;
95+
function openHelpCenterArticle(
96+
articleId: string,
97+
showBackButton?: boolean
98+
): void;
9299
function searchHelpCenter(term: string, showBackButton?: boolean): void;
93100
function openFeatureRequests(showBackButton?: boolean): void;
94101
function close(): void;
@@ -100,10 +107,7 @@ export namespace Gleap {
100107
feedbackFlow: string,
101108
showBackButton?: boolean
102109
): void;
103-
function showSurvey(
104-
surveyId: string,
105-
format?: string
106-
): void;
110+
function showSurvey(surveyId: string, format?: string): void;
107111
function on(event: string, callback: (data?: any) => void): void;
108112
function getIdentity(): any;
109113
function isUserIdentified(): boolean;

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": "8.5.10",
3+
"version": "8.6.0",
44
"main": "build/index.js",
55
"scripts": {
66
"start": "webpack serve",

published/7.0.31/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.

published/8.6.0/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/Gleap.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ class Gleap {
458458
backgroundColor = "#ffffff",
459459
borderRadius = 20,
460460
buttonX = 20,
461-
buttonY = 20
461+
buttonY = 20,
462+
buttonStyle = GleapFeedbackButtonManager.FEEDBACK_BUTTON_BOTTOM_LEFT
462463
) {
463464
runFunctionWhenDomIsReady(() => {
464465
injectStyledCSS(
@@ -468,7 +469,8 @@ class Gleap {
468469
borderRadius,
469470
backgroundColor,
470471
buttonX,
471-
buttonY
472+
buttonY,
473+
buttonStyle
472474
);
473475
});
474476
}

src/GleapConfigManager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export default class GleapConfigManager {
100100
parseIntWithDefault(flowConfig.borderRadius, 20),
101101
parseIntWithDefault(flowConfig.buttonX, 20),
102102
parseIntWithDefault(flowConfig.buttonY, 20),
103+
flowConfig.feedbackButtonPosition
103104
);
104105
}
105106

src/GleapSession.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GleapEventManager, GleapFrameManager, GleapNotificationManager } from "./Gleap";
1+
import { GleapEventManager, GleapFrameManager, GleapNotificationManager, GleapStreamedEvent } from "./Gleap";
22
import { eraseGleapCookie, getGleapCookie, loadFromGleapCache, saveToGleapCache, setGleapCookie } from "./GleapHelper";
33

44
export default class GleapSession {
@@ -137,7 +137,7 @@ export default class GleapSession {
137137
if (!session || !session.gleapId) {
138138
return;
139139
}
140-
140+
141141
// Unregister previous group.
142142
if (this.session && this.session.gleapHash) {
143143
GleapEventManager.notifyEvent("unregister-pushmessage-group", `gleapuser-${this.session.gleapHash}`);
@@ -197,6 +197,9 @@ export default class GleapSession {
197197
try {
198198
const sessionData = JSON.parse(http.responseText);
199199
self.validateSession(sessionData);
200+
201+
// Initially track.
202+
GleapStreamedEvent.getInstance().restart();
200203
} catch (exp) { }
201204
} else {
202205
if (http.status !== 429) {

src/GleapStreamedEvent.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default class GleapStreamedEvent {
1010
streamingEvents = false;
1111
lastUrl = undefined;
1212
stopped = false;
13+
mainLoopTimeout = null;
1314

1415
// GleapStreamedEvent singleton
1516
static instance;
@@ -38,12 +39,27 @@ export default class GleapStreamedEvent {
3839
}, 60000);
3940
}
4041

42+
restart() {
43+
if (this.mainLoopTimeout) {
44+
clearInterval(this.mainLoopTimeout);
45+
this.mainLoopTimeout = null;
46+
}
47+
this.skippedCount = 1;
48+
49+
this.trackInitialEvents();
50+
this.runEventStreamLoop();
51+
}
52+
4153
start() {
4254
this.startPageListener();
43-
this.runEventStreamLoop();
4455
this.resetErrorCountLoop();
4556
}
4657

58+
trackInitialEvents() {
59+
GleapStreamedEvent.getInstance().logEvent("sessionStarted");
60+
GleapStreamedEvent.getInstance().logCurrentPage();
61+
}
62+
4763
logCurrentPage() {
4864
const currentUrl = window.location.href;
4965
if (currentUrl && currentUrl !== this.lastUrl) {
@@ -55,9 +71,6 @@ export default class GleapStreamedEvent {
5571
}
5672

5773
startPageListener() {
58-
this.logEvent("sessionStarted");
59-
this.logCurrentPage();
60-
6174
const self = this;
6275
setInterval(function () {
6376
if (self.stopped) {
@@ -96,8 +109,8 @@ export default class GleapStreamedEvent {
96109

97110
const self = this;
98111
this.streamEvents();
99-
100-
setTimeout(function () {
112+
113+
this.mainLoopTimeout = setTimeout(function () {
101114
self.runEventStreamLoop();
102115
}, 10000);
103116
};

src/UI.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import GleapFeedbackButtonManager from "./GleapFeedbackButtonManager";
2+
13
const calculateShadeColor = function (col, amt) {
24
col = col.replace(/^#/, "");
35
if (col.length === 3)
@@ -38,7 +40,8 @@ export const injectStyledCSS = (
3840
borderRadius,
3941
backgroundColor,
4042
buttonX,
41-
buttonY
43+
buttonY,
44+
buttonStyle,
4245
) => {
4346
const contrastColor = calculateContrast(primaryColor);
4447
const contrastButtonColor = calculateContrast(buttonColor);
@@ -63,6 +66,15 @@ export const injectStyledCSS = (
6366
const formItemSmallBorderRadius = Math.round(borderRadius * 0.25);
6467
const zIndexBase = 2147483600;
6568

69+
var bottomInfoOffset = 57 + buttonY;
70+
if (buttonStyle === GleapFeedbackButtonManager.FEEDBACK_BUTTON_CLASSIC_BOTTOM) {
71+
bottomInfoOffset = buttonY + 15;
72+
} else if (buttonStyle && buttonStyle.includes("CLASSIC")) {
73+
bottomInfoOffset = buttonY;
74+
} else if (buttonStyle === GleapFeedbackButtonManager.FEEDBACK_BUTTON_NONE) {
75+
bottomInfoOffset = buttonY;
76+
}
77+
6678
const colorStyleSheet = `
6779
.gleap-font, .gleap-font * {
6880
font-style: normal;
@@ -251,8 +263,8 @@ export const injectStyledCSS = (
251263
252264
.gleap-notification-container {
253265
position: fixed;
254-
bottom: ${62 + buttonY}px;
255-
right: ${4 + buttonX}px;
266+
bottom: ${bottomInfoOffset}px;
267+
right: ${buttonX}px;
256268
z-index: ${zIndexBase + 30};
257269
display: flex;
258270
flex-direction: column;

0 commit comments

Comments
 (0)