Skip to content

Commit

Permalink
v13.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Apr 22, 2024
1 parent 83a7dfa commit f9aede2
Show file tree
Hide file tree
Showing 12 changed files with 590 additions and 63 deletions.
2 changes: 1 addition & 1 deletion build/cjs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/esm/index.mjs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,12 @@ <h2 class="sub-headline">
}

</script>

<script>
window.intercomSettings = {
api_base: "https://api-iam.intercom.io",
app_id: "vm8dcoo6"
};
</script>
</body>

</html>
41 changes: 23 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gleap",
"version": "13.5.16",
"version": "13.6.0",
"main": "build/cjs/index.js",
"module": "build/esm/index.mjs",
"exports": {
Expand Down Expand Up @@ -70,8 +70,8 @@
}
},
"dependencies": {
"@floating-ui/dom": "^1.6.3",
"pick-dom-element": "^0.2.3",
"tippy.js": "^6.3.7",
"unique-selector": "^0.5.0"
}
}
}
1 change: 1 addition & 0 deletions published/13.6.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.

45 changes: 45 additions & 0 deletions src/Gleap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,50 @@ if (typeof window !== "undefined") {
}
}

const handleGleapLink = (href) => {
try {
// gleap://article/123
const urlParts = href.split('/');
const type = urlParts[2];
if (type === 'article') {
const identifier = urlParts[3];
Gleap.openHelpCenterArticle(identifier);
}

if (type === 'collection') {
const identifier = urlParts[3];
Gleap.openHelpCenterCollection(identifier);
}

if (type === 'survey') {
const identifier = urlParts[3];
Gleap.showSurvey(identifier);
}

if (type === 'bot') {
const identifier = urlParts[3];
Gleap.startBot(identifier);
}

if (type === 'news') {
const identifier = urlParts[3];
Gleap.openNews(identifier);
}

if (type === 'checklist') {
const identifier = urlParts[3];
Gleap.startChecklist(identifier);
}

if (type === 'tour') {
const identifier = urlParts[3];
Gleap.startProductTour(identifier);
}
} catch (e) {
console.error("Failed to handle Gleap link: ", href);
}
}

export {
GleapNetworkIntercepter,
GleapAudioManager,
Expand All @@ -1206,5 +1250,6 @@ export {
GleapFrameManager,
GleapMetaDataManager,
GleapTagManager,
handleGleapLink,
};
export default Gleap;
16 changes: 15 additions & 1 deletion src/GleapAdminManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ export default class GleapAdminManager {
self.configData = data.data;
self.initAdminHelper();
}

if (data.name === "smartlink-search-result") {
this.sendMessageToTourBuilder({
name: "smartlink-search-result",
data: data.data,
});
}
}

if (data.type === "tourbuilder") {
Expand All @@ -116,6 +123,13 @@ export default class GleapAdminManager {
});
}

if (data.name === "smartlink-search") {
this.sendMessage({
name: "smartlink-search",
data: data.data,
});
}

if (data.name === "save") {
this.sendMessage({
name: "save",
Expand All @@ -141,7 +155,7 @@ export default class GleapAdminManager {
}
}
}
} catch (exp) {}
} catch (exp) { }
});

this.sendMessage({
Expand Down
15 changes: 11 additions & 4 deletions src/GleapClickListener.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GleapConsoleLogManager, GleapFrameManager } from "./Gleap";
import { GleapConsoleLogManager, GleapFrameManager, handleGleapLink } from "./Gleap";
import { getDOMElementDescription } from "./GleapHelper";

export default class GleapClickListener {
Expand All @@ -11,14 +11,21 @@ export default class GleapClickListener {
}

start() {
document.addEventListener("click", (event) => {
if (!event.target) {
document.addEventListener("click", (e) => {
if (!e.target) {
return;
}

if (e.target.tagName === 'A' && e.target.protocol === 'gleap:') {
e.preventDefault();

const href = e.target.href;
handleGleapLink(href);
}

if (!GleapFrameManager.getInstance().isOpened()) {
GleapConsoleLogManager.getInstance().addLog(
getDOMElementDescription(event.target),
getDOMElementDescription(e.target),
"CLICK"
);
}
Expand Down
Loading

0 comments on commit f9aede2

Please sign in to comment.