Skip to content

Commit dd72c60

Browse files
committed
v14.1.5
1 parent fea2c90 commit dd72c60

File tree

8 files changed

+71
-7
lines changed

8 files changed

+71
-7
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.

demo/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const Gleap = window.Gleap;
22

3-
Gleap.setFrameUrl("http://0.0.0.0:3001");
3+
/*Gleap.setFrameUrl("http://0.0.0.0:3001");
44
Gleap.setApiUrl("http://0.0.0.0:9000");
5-
Gleap.setWSApiUrl("ws://0.0.0.0:9000");
5+
Gleap.setWSApiUrl("ws://0.0.0.0:9000");*/
66

77
Gleap.initialize("ogWhNhuiZcGWrva5nlDS8l7a78OfaLlV");
88

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.1.4",
3+
"version": "14.1.5",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/14.1.5/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: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { injectStyledCSS } from "./UI";
22
import GleapNetworkIntercepter from "./GleapNetworkIntercepter";
3-
import { gleapDataParser, runFunctionWhenDomIsReady } from "./GleapHelper";
3+
import {
4+
fixGleapHeight,
5+
gleapDataParser,
6+
runFunctionWhenDomIsReady,
7+
} from "./GleapHelper";
48
import GleapSession from "./GleapSession";
59
import GleapStreamedEvent from "./GleapStreamedEvent";
610
import GleapConfigManager from "./GleapConfigManager";
@@ -176,8 +180,13 @@ class Gleap {
176180
console.warn("Gleap already initialized.");
177181
return;
178182
}
183+
179184
instance.initialized = true;
180185

186+
try {
187+
fixGleapHeight();
188+
} catch (error) {}
189+
181190
// Start session
182191
const sessionInstance = GleapSession.getInstance();
183192
sessionInstance.sdkKey = sdkKey;

src/GleapHelper.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,57 @@ export const runFunctionWhenDomIsReady = (callback) => {
203203
});
204204
}
205205
};
206+
207+
export const fixGleapHeight = () => {
208+
try {
209+
if (
210+
"visualViewport" in window &&
211+
/iPad|iPhone|iPod/.test(navigator.userAgent)
212+
) {
213+
let initialHeight = window.innerHeight;
214+
let initialWidth = window.innerWidth;
215+
216+
function updateContainerHeight() {
217+
try {
218+
const gleapFrameContainer = document.querySelector(
219+
".gleap-frame-container-inner iframe"
220+
);
221+
222+
if (!gleapFrameContainer) {
223+
return;
224+
}
225+
226+
// Check if the keyboard is open
227+
if (window.visualViewport.height < initialHeight) {
228+
gleapFrameContainer.style.setProperty(
229+
"max-height",
230+
window.visualViewport.height + "px",
231+
"important"
232+
);
233+
} else {
234+
// Remove the padding bottom
235+
gleapFrameContainer.style.removeProperty("max-height");
236+
}
237+
} catch (error) {}
238+
}
239+
240+
function handleOrientationChange() {
241+
try {
242+
// Update initial dimensions
243+
initialHeight = window.innerHeight;
244+
initialWidth = window.innerWidth;
245+
updateContainerHeight();
246+
} catch (error) {}
247+
}
248+
249+
// Update on resize (keyboard show/hide and viewport resize)
250+
window.visualViewport.addEventListener("resize", updateContainerHeight);
251+
252+
// Handle orientation changes
253+
window.addEventListener("orientationchange", handleOrientationChange);
254+
255+
// Update initially
256+
updateContainerHeight();
257+
}
258+
} catch (error) {}
259+
};

0 commit comments

Comments
 (0)