-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #986 from appknox/PD-130
Integrated knowledge base using doc360
- Loading branch information
Showing
5 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Inject document360 script that enable widget in the application | ||
const injectDocument360 = (apiKey) => { | ||
(function (w, d, s, o, f, js, fjs) { | ||
w['JS-Widget'] = o; | ||
w[o] = | ||
w[o] || | ||
function () { | ||
(w[o].q = w[o].q || []).push(arguments); | ||
}; | ||
(js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]); | ||
js.id = o; | ||
js.src = f; | ||
js.async = 1; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
})( | ||
window, | ||
document, | ||
'script', | ||
'mw', | ||
'https://cdn.document360.io/static/js/widget.js' | ||
); | ||
// eslint-disable-next-line | ||
mw('init', { | ||
apiKey, | ||
}); | ||
}; | ||
|
||
// Open the document360 overlay panel by implicitly clicking the widget button | ||
const openKnowledgeBasePanel = () => { | ||
document | ||
.getElementById('document360-widget-iframe') | ||
.contentDocument.getElementById('doc360-button') | ||
.click(); | ||
}; | ||
|
||
export { injectDocument360, openKnowledgeBasePanel }; |