Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Add innkeep
Browse files Browse the repository at this point in the history
  • Loading branch information
iAdramelk committed Mar 8, 2024
1 parent c39a3d0 commit d8cea86
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions migration/base/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
"use client";

const INKEEP_API_KEY = "b4a9d9f13d7d1540b8b200a2a3374353ec50b068a9bf9bd0";

Check warning on line 3 in migration/base/script.js

View check run for this annotation

Orca Security (US) / Orca Security - Secrets

[LOW] Generic High Entropy Secret

Details: A high entropy secret has been identified. High entropy secrets are typically complex and random strings that are difficult to guess due to their high information density. They are useful for secure authentication, data protection, and other cryptographic purposes. This detection is based on common patterns and characteristics associated with high entropy values commonly used in various services. Exposing high entropy secrets, tokens, or keys poses a significant security risk. Unauthorized individuals can potentially misuse these secrets to gain unintended access, leading to data breaches, unauthorized transactions, and financial losses. Always ensure that high entropy values are kept confidential and not exposed in public or unsecured areas. Recommendation: Take immediate action to mitigate the risk of the identified hard-coded secret by locating where it is used, revoking it, and ensuring it is updated across all dependent systems.
const INKEEP_INTEGRATION_ID = "88e39f4c03457df277d83807";
const INKEEP_ORGANIZATION_ID = "teleport";

// Get the Mintlify search containers, going to reuse them as the triggers for Inkeep
const searchButtonContainerIds = [
"search-bar-entry",
"search-bar-entry-mobile",
];

// Clone and replace, needed to remove existing event listeners
const clonedSearchButtonContainers = searchButtonContainerIds.map((id) => {
const originalElement = document.getElementById(id);
const clonedElement = originalElement.cloneNode(true);
originalElement.parentNode.replaceChild(clonedElement, originalElement);
return clonedElement;
});

// Load the Inkeep script
const inkeepScript = document.createElement("script");
inkeepScript.type = "module";
inkeepScript.src =
"https://unpkg.com/@inkeep/[email protected]/dist/embed.js";
document.body.appendChild(inkeepScript);
// Once the Inkeep script has loaded, load the Inkeep chat components
inkeepScript.addEventListener("load", function () {
// Customization settings
const sharedConfig = {
baseSettings: {
apiKey: INKEEP_API_KEY,
integrationId: INKEEP_INTEGRATION_ID,
organizationId: INKEEP_ORGANIZATION_ID,
organizationDisplayName: "Teleport",
primaryBrandColor: "#512FC9",
chatApiProxyDomain: "goteleport.com/inkeep-proxy",
remoteErrorLogsLevel: 1,
optOutAllAnalytics: true,
consoleDebugLevel: 0,
customCardSettings: [
{
filters: {
ContentType: "docs",
},
searchTabLabel: "Docs",
icon: { builtIn: "IoDocumentTextOutline" },
},
],
},
aiChatSettings: {
botName: "Teleport",
botAvatarSrcUrl: "https://goteleport.com/static/pam-standing.svg",
isControlledMessage: true,
defaultChatMode: "AUTO",
},
searchSettings: {
placeholder: "Search Docs",
tabSettings: {
isAllTabEnabled: false,
rootBreadcrumbsToUseAsTabs: ["Docs", "GitHub"],
tabOrderByLabel: ["Docs", "GitHub"],
alwaysDisplayedTabs: ["Docs", "GitHub"],
disabledDefaultTabs: undefined,
},
isControlledSearchQuery: true,
shouldOpenLinksInNewTab: true,
},
modalSettings: {
closeOnBlur: true,
},
};

// for syncing with dark mode
const colorModeSettings = {
observedElement: document.documentElement,
isDarkModeCallback: (el) => {
return el.classList.contains("dark");
},
colorModeAttribute: "class",
};
// add the "Ask AI" pill chat button
Inkeep().embed({
componentType: "ChatButton",
colorModeSync: colorModeSettings,
properties: sharedConfig,
});
// instantiate Inkeep "custom trigger" component
const inkeepSearchModal = Inkeep({
...sharedConfig.baseSettings,
}).embed({
componentType: "CustomTrigger",
colorModeSync: colorModeSettings,
properties: {
...sharedConfig,
isOpen: false,
onClose: () => {
inkeepSearchModal.render({
isOpen: false,
});
},
},
});
// When the Mintlify search bar clone is clicked, open the Inkeep search modal
clonedSearchButtonContainers.forEach((trigger) => {
trigger.addEventListener("click", function () {
inkeepSearchModal.render({
isOpen: true,
});
});
});
});

0 comments on commit d8cea86

Please sign in to comment.