Update inkeep to use new package#394
Conversation
WalkthroughThis change replaces the dependency "@inkeep/uikit-js" with "@inkeep/cxkit-js" and refactors the Inkeep widget integration in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Trigger (Button/Shortcut)
participant InkeepWidget (ModalSearchAndChat)
participant Window
User->>Trigger: Click button or press shortcut
Trigger->>Window: Call handleOpen()
alt Widget initialized
Window->>InkeepWidget: update({ isOpen: true })
else Widget not initialized
Window->>InkeepWidget: Initialize ModalSearchAndChat with typed config
end
InkeepWidget->>Window: onOpenChange(newOpen)
Window->>InkeepWidget: update({ isOpen: newOpen })
Possibly related PRs
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
public/vendors/inkeep.css (1)
9-12: Respectprefers-reduced-motionto improve accessibilityThe new animation looks slick, but WCAG recommends disabling non‑essential motion for users who opt‑out.
A light wrapper keeps the effect for everyone else:@@ -.ikp-modal__content { - opacity: 0; - animation: showInkeepModal .4s ease forwards !important; -} +@media (prefers-reduced-motion: no-preference) { + .ikp-modal__content { + opacity: 0; + animation: showInkeepModal .4s ease forwards !important; + } +}No functional change, just an a11y win.
Also applies to: 14-23
src/components/Inkeep.astro (1)
123-141: Flatten promise chain withasync/awaitfor readability & better error handlingThe nested
.then()chain works, but quickly becomes hard to follow and swallows stack traces. Anasyncfunction is shorter and preserves the call stack:-function initializeInkeep() { - import("@inkeep/cxkit-js") - .then(() => { - if (window?.Inkeep?.ModalSearchAndChat) { - inkeepWidget = window.Inkeep.ModalSearchAndChat(config as any); - } - document.body.classList.add("inkeep-active"); - }) - .then(() => { - setTimeout(() => { - inkeepWidget?.update({ modalSettings: { isOpen: true } }); - }, 50); - }) - .catch((error) => console.log(error)); -} +async function initializeInkeep() { + try { + await import("@inkeep/cxkit-js"); + + if (window?.Inkeep?.ModalSearchAndChat) { + inkeepWidget = window.Inkeep.ModalSearchAndChat(config as any); + } + document.body.classList.add("inkeep-active"); + + // Wait for mount before opening + await new Promise((r) => setTimeout(r, 50)); + inkeepWidget?.update({ modalSettings: { isOpen: true } }); + } catch (error) { + console.error("Failed to load Inkeep widget:", error); + } +}This keeps the flow linear and ensures uncaught errors surface in logs.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.json(2 hunks)public/vendors/inkeep.css(1 hunks)src/components/Inkeep.astro(1 hunks)
🔇 Additional comments (1)
package.json (1)
22-23: Check that runtime & type‑only packages stay in sync going forwardBoth
@inkeep/cxkit-jsand@inkeep/cxkit-typesare pinned to^0.5.64, which is great for this commit, but the caret (^) range allows future minor/patch updates that could drift out of sync (e.g.jsbumps to0.6.xwhiletypesstays on0.5.x). A mismatch could surface as subtle runtime / type‑checking inconsistencies.If you want to guarantee they always move together, consider:
- "@inkeep/cxkit-js": "^0.5.64", + "@inkeep/cxkit-js": "~0.5.64",and the same for
@inkeep/cxkit-types, or automate a Renovate/Dependabot rule that bumps them in a single PR.Would you like a Renovate share‑config snippet that enforces coupled upgrades?
Also applies to: 36-36
Description (required)
This PR updates the Inkeep integration to use our new cxkit, which fixes the zag-js security vulnerabilities that were present in the uikit package.
Related issues & labels (optional)
Summary by CodeRabbit
New Features
Refactor
Style