Skip to content

Commit

Permalink
Added smart links.
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Apr 23, 2024
1 parent e407f25 commit f088915
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 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.

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": "13.6.0",
"version": "13.6.1",
"main": "build/cjs/index.js",
"module": "build/esm/index.mjs",
"exports": {
Expand Down
1 change: 1 addition & 0 deletions published/13.6.1/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.

16 changes: 10 additions & 6 deletions src/Gleap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,17 +1185,21 @@ 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);
Gleap.openHelpCenterArticle(identifier, true);
}

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

if (type === 'flow') {
const identifier = urlParts[3];
Gleap.startFeedbackFlow(identifier, true);
}

if (type === 'survey') {
Expand All @@ -1205,17 +1209,17 @@ const handleGleapLink = (href) => {

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

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

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

if (type === 'tour') {
Expand Down

0 comments on commit f088915

Please sign in to comment.