Skip to content

feat(next): integrate Intercom provider lifecycle in app layout#2162

Open
niemyjski wants to merge 2 commits intomainfrom
feature/next-intercom
Open

feat(next): integrate Intercom provider lifecycle in app layout#2162
niemyjski wants to merge 2 commits intomainfrom
feature/next-intercom

Conversation

@niemyjski
Copy link
Member

Summary

  • Integrates Intercom via svelte-intercom into the authenticated app shell so user/org context can be booted reactively from real app data.
  • Hides the default Intercom launcher and disables noise-related features by default to align with in-app UX.
  • Ensures logout and auth-state transitions shut down Intercom cleanly to avoid cross-user/session bleed.

Root Cause (if bug fix)

  • N/A (feature work).

What I Changed and Why

  • Added a dedicated Intercom feature slice (context, keys, initializer) so all Intercom boot/update/shutdown behavior is centralized and reusable.
  • Wired the initializer into the (app) layout to guarantee Intercom lifecycle follows authenticated route lifecycle and project/org navigation.
  • Updated auth API logout path to explicitly trigger Intercom shutdown behavior, preventing stale messenger state after sign-out.
  • Threaded Intercom context inputs from usage/configure pages so account/user metadata stays current as users navigate.
  • Added package dependencies in package.json/package-lock.json required for the Svelte integration.

Tech Debt Assessment

  • No deliberate shortcuts introduced; integration is additive and isolated to a feature slice.
  • Future improvement: add dedicated integration tests for boot option mapping and logout shutdown edge cases.

Test Plan

  • cd src/Exceptionless.Web/ClientApp && npm run check
  • cd src/Exceptionless.Web/ClientApp && npm run test:unit
  • Dogfood /next authenticated flow to validate Intercom behavior in-browser.

Copilot AI review requested due to automatic review settings March 17, 2026 13:27
@niemyjski niemyjski self-assigned this Mar 17, 2026
@niemyjski niemyjski force-pushed the feature/next-intercom branch from bdb3437 to 5d05bad Compare March 17, 2026 13:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an Intercom integration for the SvelteKit “(app)” shell so support chat can be launched from within the new ClientApp UI, and normalizes a few Tailwind sizing utilities in usage pages.

Changes:

  • Add an Intercom provider/initializer wrapper in the authenticated app layout and expose an openChat callback to downstream UI.
  • Add an Intercom feature module ($features/intercom) to build boot options and expose the Intercom context.
  • Replace a few arbitrary Tailwind sizes (h-[200px], h-[250px], min-w-[230px]) with equivalent spacing-based classes.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/usage/+page.svelte Normalize skeleton/chart/tooltip sizing classes.
src/Exceptionless.Web/ClientApp/src/routes/(app)/project/[projectId]/configure/+page.svelte Wire “contact support” action to Intercom context when available.
src/Exceptionless.Web/ClientApp/src/routes/(app)/organization/[organizationId]/usage/+page.svelte Normalize skeleton/chart/tooltip sizing classes.
src/Exceptionless.Web/ClientApp/src/routes/(app)/+layout.svelte Add IntercomProvider + initializer and pass openChat into the app shell/notifications.
src/Exceptionless.Web/ClientApp/src/lib/features/intercom/keys.ts Define a shared context key for Intercom.
src/Exceptionless.Web/ClientApp/src/lib/features/intercom/intercom-initializer.svelte New wrapper component to manage Intercom update cadence, routing updates, and shutdown on logout.
src/Exceptionless.Web/ClientApp/src/lib/features/intercom/index.ts Public exports for the intercom feature module.
src/Exceptionless.Web/ClientApp/src/lib/features/intercom/context.svelte.ts Add getIntercom() and a helper to build boot options from current user/org.
src/Exceptionless.Web/ClientApp/src/lib/features/auth/api.svelte.ts Remove an extraneous stray diff artifact line.
src/Exceptionless.Web/ClientApp/package.json Add svelte-intercom dependency.
src/Exceptionless.Web/ClientApp/package-lock.json Lockfile updates for svelte-intercom and transitive dependency version bumps.
Files not reviewed (1)
  • src/Exceptionless.Web/ClientApp/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +18
if (!user || !user.hash) {
return undefined;
}

// Extract timestamp from MongoDB ObjectId (first 8 hex chars = unix timestamp)
Comment on lines +23 to +26
company: organization
? {
createdAt: orgCreatedAt?.toString(),
id: organization.id,
…ippet

- Consolidate redundant intercom.update() calls into single effect tracking route and visibility
- Extract getIntercom() into separate snippet to avoid context scoping issues
- Both changes prevent duplicate updates and ensure context is properly available
@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
Exceptionless.Insulation 24% 23% 208
Exceptionless.Core 66% 60% 7546
Exceptionless.AppHost 26% 14% 55
Exceptionless.Web 57% 43% 3598
Summary 61% (11874 / 19391) 54% (5909 / 10960) 11407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants