-
Notifications
You must be signed in to change notification settings - Fork 13
Chatwoot #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added Support settings page under Settings menu - Implemented ChatWoot widget integration with secure chat functionality - Users can now report bugs and track support conversations from the wallet - Added useChatwoot hook for managing widget lifecycle - Support page displays when ChatWoot is configured via environment variables - Added VITE_CHATWOOT_WEBSITE_TOKEN and VITE_CHATWOOT_BASE_URL to configuration - Integration includes user identification and custom attributes (wallet pubkey, network)
- Added ARK address (offchainAddr) to ChatWoot custom attributes - Added BTC boarding address (boardingAddr) to custom attributes - Included explorer URL for the current network - Support operators can now search user addresses in the blockchain explorer - Addresses are automatically fetched when support page is opened
- Added location origin (window.location.origin) for deployment context - Added ARK server URL and indexer URL (both use aspInfo.url) - Added wallet ARK address (offchainAddr) and BTC boarding address - Added blockchain explorer URL for the user's network - Added Boltz Lightning swap provider URL - Added LendaSat and LendaSwap application URLs - Support operators can now see all service endpoints and addresses - Enables quick troubleshooting by showing user's complete configuration
Deploying wallet-mutinynet with
|
| Latest commit: |
dae168a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://56d45d66.arkade-wallet.pages.dev |
| Branch Preview URL: | https://chatwoot.arkade-wallet.pages.dev |
Deploying wallet-bitcoin with
|
| Latest commit: |
8eea4d3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ed060e1e.wallet-bitcoin.pages.dev |
| Branch Preview URL: | https://chatwoot.wallet-bitcoin.pages.dev |
WalkthroughAdds Chatwoot support: environment variables, a chatwoot library with script injection, a Chatwoot React component, a Support settings screen and icon, and wires the Support option into settings navigation. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant SettingsUI
participant SupportScreen
participant ChatwootWidget
participant ChatwootLib
participant Browser as "window.chatwootSDK"
User->>SettingsUI: open Settings → Support
SettingsUI->>SupportScreen: render Support
SupportScreen->>ChatwootWidget: mount
ChatwootWidget->>ChatwootLib: getChatwootVars()
ChatwootLib-->>ChatwootWidget: vars (websiteToken, baseUrl)
ChatwootWidget->>ChatwootLib: injectAndRunChatwootScript(vars)
ChatwootLib->>Browser: insert SDK script (packs/js/sdk.js)
Note right of ChatwootLib: poll for window.chatwootSDK (5s timeout)
Browser-->>ChatwootLib: SDK ready
ChatwootLib->>Browser: run(vars)
SupportScreen->>Browser: setUser(...) / setCustomAttributes(...)
Browser-->>User: chat widget active
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (2)src/screens/Settings/General.tsx (1)
src/components/Select.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (6)
src/icons/Support.tsx (1)
1-10: Optional: add an explicit return type for the icon componentThe icon implementation is fine. For stricter TypeScript setups and consistency with other icon components, you might want to make the return type explicit.
-export default function SupportIcon() { +export default function SupportIcon(): JSX.Element {src/components/ChatWoot.tsx (1)
1-23: Chatwoot widget wrapper is correct; consider small robustness improvementsThe lifecycle around initializing and tearing down the Chatwoot SDK looks sound: you guard on env vars, set
window.chatwootSettings, inject the script once, and remove it on unmount.Two small improvements you might consider:
- Log or otherwise surface when
websiteTokenorbaseUrlis missing so misconfigurations are easier to diagnose instead of silently doing nothing.- Optionally make the cleanup selector a bit stricter (e.g., exact
src === \${vars.baseUrl}/packs/js/sdk.js``) if there’s any chance of multiple Chatwoot instances using similar paths.These are non-blocking; the current implementation is functionally fine.
src/screens/Settings/Support.tsx (1)
25-70: Align effect dependencies with used values and avoidwindowin depsThe overall flow—wait for
chatwoot:ready, then configure the user and attributes once addresses andwallet.pubkeyare available—is solid. A few hook-related tweaks would make this more robust and lint‑friendly:
- The effect at Line 48 uses
addresses,supportChatLoaded,wallet.pubkey,wallet.network,swapProvider,aspInfo, andconfig, but only some of these are in the dependency array. This can lead to stale values if, for example, the network or ASP URL changes while the Support screen is open.- Including
window.$chatwootdirectly in the dependency array is unconventional; it’s a global mutable value and doesn’t need to be there. The existingsupportChatLoadedflag is already your “SDK ready” signal.A minimal adjustment would be:
- useEffect(() => { + useEffect(() => { if (!addresses || !supportChatLoaded || !window.$chatwoot || !wallet.pubkey) return @@ - explorer_url: wallet.network ? getWebExplorerURL(wallet.network as NetworkName) : 'not available', + explorer_url: wallet.network ? getWebExplorerURL(wallet.network as NetworkName) : 'not available', }) - }, [addresses, supportChatLoaded, wallet.pubkey, window.$chatwoot]) + }, [ + addresses, + supportChatLoaded, + wallet.pubkey, + wallet.network, + swapProvider, + aspInfo, + config, + ])and you can read
window.$chatwootdirectly inside the effect without listing it in deps.Optionally, you might also:
- Clear
addresseswhensvcWalletbecomes undefined so you don’t accidentally reuse stale addresses.- Add an abort/flag in the “fetch addresses” effect to avoid calling
setAddressesafter unmount.src/lib/chatwoot.ts (3)
15-17: Replaceanywith proper type for better type safety.Using
anyreduces type safety and defeats the purpose of TypeScript. Consider using theChatwootSettingstype instead.Apply this diff:
- chatwootSettings: { - [key: string]: any - } + chatwootSettings: ChatwootSettings
36-36: Consider adding 'dark' option to darkMode.The darkMode type only includes 'auto' and 'light'. Most applications also support an explicit 'dark' option for users who prefer dark mode regardless of system settings.
Apply this diff:
- darkMode: 'auto' | 'light' + darkMode: 'auto' | 'light' | 'dark'
49-51: Complete the JSDoc comment.The JSDoc comment is empty. Add a description and document the parameter.
Apply this diff:
/** - * - * @param settings + * Injects the Chatwoot SDK script into the page and initializes it with the provided configuration. + * @param vars - Chatwoot configuration containing websiteToken and baseUrl */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
README.md(1 hunks)src/components/ChatWoot.tsx(1 hunks)src/icons/Support.tsx(1 hunks)src/lib/chatwoot.ts(1 hunks)src/lib/types.ts(1 hunks)src/providers/options.tsx(2 hunks)src/screens/Settings/Index.tsx(2 hunks)src/screens/Settings/Support.tsx(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
src/components/ChatWoot.tsx (1)
src/lib/chatwoot.ts (3)
getChatwootVars(26-31)getChatwootSettings(40-47)injectAndRunChatwootScript(53-72)
src/screens/Settings/Support.tsx (13)
src/providers/asp.tsx (1)
AspContext(15-20)src/providers/config.tsx (1)
ConfigContext(32-41)src/providers/lightning.tsx (1)
LightningContext(24-30)src/providers/wallet.tsx (1)
WalletContext(42-56)src/lib/types.ts (1)
Addresses(3-6)src/lib/asp.ts (1)
getReceivingAddresses(144-150)src/lib/explorers.ts (1)
getWebExplorerURL(38-40)src/components/FlexCol.tsx (1)
FlexCol(15-40)src/components/Text.tsx (2)
Text(25-79)TextSecondary(91-97)src/components/Content.tsx (1)
Content(9-16)src/components/Padded.tsx (1)
Padded(7-14)src/components/ButtonsOnBottom.tsx (1)
ButtonsOnBottom(10-26)src/components/Button.tsx (1)
Button(21-64)
src/providers/options.tsx (1)
src/icons/Support.tsx (1)
SupportIcon(1-10)
src/screens/Settings/Index.tsx (1)
src/screens/Settings/Support.tsx (1)
Support(19-114)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (9)
src/screens/Settings/Index.tsx (1)
10-38: Support settings routing is wired correctlyImporting
Supportand adding theSettingsOptions.Supportbranch keeps the settings routing consistent with existing options. No issues from a control-flow or type perspective.README.md (1)
25-26: Chatwoot env var documentation looks consistentThe new
VITE_CHATWOOT_WEBSITE_TOKENandVITE_CHATWOOT_BASE_URLentries match the code-level usage and follow the existing table conventions. No changes requested.src/lib/types.ts (1)
45-63: SettingsOptions.Support enum extension is soundAdding
Support = 'support'cleanly extends the settings options and matches its usage in the options provider and settings router. No structural or typing concerns here.src/providers/options.tsx (1)
10-77: Support option integration into settings options looks consistentImporting
SupportIconand adding theSettingsOptions.Supportentry in theGeneralsection fits cleanly into the existingoptionsandallOptionspatterns.goBackbehavior for this option will correctly route back to the menu via the General branch.src/screens/Settings/Support.tsx (2)
76-111: Support screen UX and widget placement look coherentDefining the small
Sectionhelper, stacking the explanatory sections, embedding<ChatwootWidget />in the content, and usingButtonsOnBottomwith an “Open Support Chat” button create a clear and focused support experience. The separation between widget bootstrap (viaChatwootWidget) and user-triggered open (handleOpenChat) is clean.
55-69: Data sharing with Chatwoot is intentional and documented—no code changes requiredVerification confirms the Chatwoot integration is designed and documented:
- Git history shows this feature was deliberately added ("add chatwoot support", commit be2deee)
- README documents Chatwoot env variables (
VITE_CHATWOOT_WEBSITE_TOKEN,VITE_CHATWOOT_BASE_URL)- All sent values are safe:
wallet.pubkeyis a public key (not private), network names, and infrastructure URLs without tokensVITE_*environment variables are build-time public constants, not secrets- No private keys, seeds, or authentication credentials are exposed
The attributes you're sending are appropriate for support context. The data-sharing boundary you identified is valid and intentional.
src/lib/chatwoot.ts (3)
1-6: LGTM! Well-structured interface.The ChatwootSDK interface provides clear type definitions for the Chatwoot SDK methods.
21-24: LGTM!Clean interface definition for Chatwoot configuration variables.
40-47: LGTM!The function returns sensible default values for Chatwoot settings.
Deploying wallet-signet with
|
| Latest commit: |
dae168a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://81675709.wallet-23u.pages.dev |
| Branch Preview URL: | https://chatwoot.wallet-23u.pages.dev |
* Add ChatWoot integration for customer support - Added Support settings page under Settings menu - Implemented ChatWoot widget integration with secure chat functionality - Users can now report bugs and track support conversations from the wallet - Added useChatwoot hook for managing widget lifecycle - Support page displays when ChatWoot is configured via environment variables - Added VITE_CHATWOOT_WEBSITE_TOKEN and VITE_CHATWOOT_BASE_URL to configuration - Integration includes user identification and custom attributes (wallet pubkey, network) * Include wallet addresses in ChatWoot support integration - Added ARK address (offchainAddr) to ChatWoot custom attributes - Added BTC boarding address (boardingAddr) to custom attributes - Included explorer URL for the current network - Support operators can now search user addresses in the blockchain explorer - Addresses are automatically fetched when support page is opened * Add comprehensive service URLs and addresses to ChatWoot - Added location origin (window.location.origin) for deployment context - Added ARK server URL and indexer URL (both use aspInfo.url) - Added wallet ARK address (offchainAddr) and BTC boarding address - Added blockchain explorer URL for the user's network - Added Boltz Lightning swap provider URL - Added LendaSat and LendaSwap application URLs - Support operators can now see all service endpoints and addresses - Enables quick troubleshooting by showing user's complete configuration * add chatwoot support * deal with error loading chatwoot * Add safety check before using non-null assertion * Fix the timeout logic bug * console.log to debug * console.log for debug * increase menu row height * remove debug console logs * increase height of menus --------- Co-authored-by: Claude <noreply@anthropic.com>
* refactor nostr backups to use chunks * Add error handling around JSON parsing * fix enabling Nostr backup doesn’t persist config change * use consoleError instead of console.error * new regtest service: nak * update docker images * adds nostr test * fixes * tidy code * Chatwoot (#236) * Add ChatWoot integration for customer support - Added Support settings page under Settings menu - Implemented ChatWoot widget integration with secure chat functionality - Users can now report bugs and track support conversations from the wallet - Added useChatwoot hook for managing widget lifecycle - Support page displays when ChatWoot is configured via environment variables - Added VITE_CHATWOOT_WEBSITE_TOKEN and VITE_CHATWOOT_BASE_URL to configuration - Integration includes user identification and custom attributes (wallet pubkey, network) * Include wallet addresses in ChatWoot support integration - Added ARK address (offchainAddr) to ChatWoot custom attributes - Added BTC boarding address (boardingAddr) to custom attributes - Included explorer URL for the current network - Support operators can now search user addresses in the blockchain explorer - Addresses are automatically fetched when support page is opened * Add comprehensive service URLs and addresses to ChatWoot - Added location origin (window.location.origin) for deployment context - Added ARK server URL and indexer URL (both use aspInfo.url) - Added wallet ARK address (offchainAddr) and BTC boarding address - Added blockchain explorer URL for the user's network - Added Boltz Lightning swap provider URL - Added LendaSat and LendaSwap application URLs - Support operators can now see all service endpoints and addresses - Enables quick troubleshooting by showing user's complete configuration * add chatwoot support * deal with error loading chatwoot * Add safety check before using non-null assertion * Fix the timeout logic bug * console.log to debug * console.log for debug * increase menu row height * remove debug console logs * increase height of menus --------- Co-authored-by: Claude <noreply@anthropic.com> * Fix UI incoherence on Boltz app page --------- Co-authored-by: Claude <noreply@anthropic.com>
* Add ChatWoot integration for customer support - Added Support settings page under Settings menu - Implemented ChatWoot widget integration with secure chat functionality - Users can now report bugs and track support conversations from the wallet - Added useChatwoot hook for managing widget lifecycle - Support page displays when ChatWoot is configured via environment variables - Added VITE_CHATWOOT_WEBSITE_TOKEN and VITE_CHATWOOT_BASE_URL to configuration - Integration includes user identification and custom attributes (wallet pubkey, network) * Include wallet addresses in ChatWoot support integration - Added ARK address (offchainAddr) to ChatWoot custom attributes - Added BTC boarding address (boardingAddr) to custom attributes - Included explorer URL for the current network - Support operators can now search user addresses in the blockchain explorer - Addresses are automatically fetched when support page is opened * Add comprehensive service URLs and addresses to ChatWoot - Added location origin (window.location.origin) for deployment context - Added ARK server URL and indexer URL (both use aspInfo.url) - Added wallet ARK address (offchainAddr) and BTC boarding address - Added blockchain explorer URL for the user's network - Added Boltz Lightning swap provider URL - Added LendaSat and LendaSwap application URLs - Support operators can now see all service endpoints and addresses - Enables quick troubleshooting by showing user's complete configuration * add chatwoot support * deal with error loading chatwoot * Add safety check before using non-null assertion * Fix the timeout logic bug * console.log to debug * console.log for debug * increase menu row height * remove debug console logs * increase height of menus --------- Co-authored-by: Claude <noreply@anthropic.com>
* refactor nostr backups to use chunks * Add error handling around JSON parsing * fix enabling Nostr backup doesn’t persist config change * use consoleError instead of console.error * new regtest service: nak * update docker images * adds nostr test * fixes * tidy code * Chatwoot (arkade-os#236) * Add ChatWoot integration for customer support - Added Support settings page under Settings menu - Implemented ChatWoot widget integration with secure chat functionality - Users can now report bugs and track support conversations from the wallet - Added useChatwoot hook for managing widget lifecycle - Support page displays when ChatWoot is configured via environment variables - Added VITE_CHATWOOT_WEBSITE_TOKEN and VITE_CHATWOOT_BASE_URL to configuration - Integration includes user identification and custom attributes (wallet pubkey, network) * Include wallet addresses in ChatWoot support integration - Added ARK address (offchainAddr) to ChatWoot custom attributes - Added BTC boarding address (boardingAddr) to custom attributes - Included explorer URL for the current network - Support operators can now search user addresses in the blockchain explorer - Addresses are automatically fetched when support page is opened * Add comprehensive service URLs and addresses to ChatWoot - Added location origin (window.location.origin) for deployment context - Added ARK server URL and indexer URL (both use aspInfo.url) - Added wallet ARK address (offchainAddr) and BTC boarding address - Added blockchain explorer URL for the user's network - Added Boltz Lightning swap provider URL - Added LendaSat and LendaSwap application URLs - Support operators can now see all service endpoints and addresses - Enables quick troubleshooting by showing user's complete configuration * add chatwoot support * deal with error loading chatwoot * Add safety check before using non-null assertion * Fix the timeout logic bug * console.log to debug * console.log for debug * increase menu row height * remove debug console logs * increase height of menus --------- Co-authored-by: Claude <noreply@anthropic.com> * Fix UI incoherence on Boltz app page --------- Co-authored-by: Claude <noreply@anthropic.com>
Adds support powered by Chatwoot.
Go to Settings > Support to try it.
Summary by CodeRabbit
New Features
Documentation
UI/UX Improvements
✏️ Tip: You can customize this high-level summary in your review settings.