diff options
| author | Mahesh Sanikommmu <[email protected]> | 2025-10-19 15:30:25 -0700 |
|---|---|---|
| committer | Mahesh Sanikommmu <[email protected]> | 2025-10-19 15:30:25 -0700 |
| commit | 51ee88121fdb2da686bf5dd6ad95d3ec499ebd9c (patch) | |
| tree | b5fe9a98d058647506b8350015576f93db64b8fa /apps | |
| parent | version bump' (diff) | |
| download | supermemory-51ee88121fdb2da686bf5dd6ad95d3ec499ebd9c.tar.xz supermemory-51ee88121fdb2da686bf5dd6ad95d3ec499ebd9c.zip | |
chore(browser-extension): t3 chat search memories
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/browser-extension/entrypoints/content/t3.ts | 54 | ||||
| -rw-r--r-- | apps/browser-extension/wxt.config.ts | 2 |
2 files changed, 27 insertions, 29 deletions
diff --git a/apps/browser-extension/entrypoints/content/t3.ts b/apps/browser-extension/entrypoints/content/t3.ts index 4332076e..07a8781f 100644 --- a/apps/browser-extension/entrypoints/content/t3.ts +++ b/apps/browser-extension/entrypoints/content/t3.ts @@ -115,32 +115,35 @@ function setupT3RouteChangeDetection() { function addSupermemoryIconToT3Input() { const targetContainers = document.querySelectorAll( - ".flex.min-w-0.items-center.gap-2.overflow-hidden", + ".flex.min-w-0.items-center.gap-2", ) - targetContainers.forEach((container) => { - if (container.hasAttribute("data-supermemory-icon-added")) { - return - } - - const existingIcon = container.querySelector( - `#${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}`, - ) - if (existingIcon) { - container.setAttribute("data-supermemory-icon-added", "true") - return - } - - const supermemoryIcon = createT3InputBarElement(async () => { - await getRelatedMemoriesForT3(POSTHOG_EVENT_KEY.T3_CHAT_MEMORIES_SEARCHED) - }) + const container = targetContainers[0] + if (!container) { + return + } - supermemoryIcon.id = `${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}-${Date.now()}-${Math.random().toString(36).substring(2, 11)}` + if (container.hasAttribute("data-supermemory-icon-added")) { + return + } + const existingIcon = container.querySelector( + `#${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}`, + ) + if (existingIcon) { container.setAttribute("data-supermemory-icon-added", "true") + return + } - container.insertBefore(supermemoryIcon, container.firstChild) + const supermemoryIcon = createT3InputBarElement(async () => { + await getRelatedMemoriesForT3(POSTHOG_EVENT_KEY.T3_CHAT_MEMORIES_SEARCHED) }) + + supermemoryIcon.id = `${ELEMENT_IDS.T3_INPUT_BAR_ELEMENT}-${Date.now()}-${Math.random().toString(36).substring(2, 11)}` + + container.setAttribute("data-supermemory-icon-added", "true") + + container.insertBefore(supermemoryIcon, container.firstChild) } async function getRelatedMemoriesForT3(actionSource: string) { @@ -150,11 +153,9 @@ async function getRelatedMemoriesForT3(actionSource: string) { const supermemoryContainer = document.querySelector( '[data-supermemory-icon-added="true"]', ) - if ( - supermemoryContainer?.parentElement?.parentElement?.previousElementSibling - ) { + if (supermemoryContainer?.parentElement?.previousElementSibling) { const textareaElement = - supermemoryContainer.parentElement.parentElement.previousElementSibling.querySelector( + supermemoryContainer.parentElement.previousElementSibling.querySelector( "textarea", ) userQuery = textareaElement?.value || "" @@ -220,12 +221,9 @@ async function getRelatedMemoriesForT3(actionSource: string) { const supermemoryContainer = document.querySelector( '[data-supermemory-icon-added="true"]', ) - if ( - supermemoryContainer?.parentElement?.parentElement - ?.previousElementSibling - ) { + if (supermemoryContainer?.parentElement?.previousElementSibling) { textareaElement = - supermemoryContainer.parentElement.parentElement.previousElementSibling.querySelector( + supermemoryContainer.parentElement.previousElementSibling.querySelector( "textarea", ) } diff --git a/apps/browser-extension/wxt.config.ts b/apps/browser-extension/wxt.config.ts index 20435b6c..36c2863e 100644 --- a/apps/browser-extension/wxt.config.ts +++ b/apps/browser-extension/wxt.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ manifest: { name: "supermemory", homepage_url: "https://supermemory.ai", - version: "6.0.100", + version: "6.0.101", permissions: ["contextMenus", "storage", "activeTab", "webRequest", "tabs"], host_permissions: [ "*://x.com/*", |