Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(inbox): link conversations ticket evidence on web and desktop (#99832)

posthog[bot]1740ce571ab9
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index da23e5a95877..4ea4706405ea 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8204,6 +8204,10 @@ snapshots:
hash: v1.k794b7964.c7cabd5d71fbeb9c77fd395ad60ca1524e64bb04c38d3b19a4b506aecb2135eb.rNerWVnQ2qhn1NscqDV1Uf8e0HzTup6OKzH1fClOX8s
scenes-app-inbox-signal-cards--ticket-attachments--light:
hash: v1.k794b7964.3d52f736d68c7011b4640065d9b8c4fb635e81c48d8d9c65612633642ff4abcf.KbKms7BD6qdUC6giZ-uPeHd_DTtHuCR_JPsi0INgT9U
+ scenes-app-inbox-signal-cards--ticket-without-number--dark:
+ hash: v1.k794b7964.86cf1ef2dc85a65910993d0a47c6cf055b6efb70ea81a4cf665dce88d0b0c140.0xM3XH8z7CJ32sAKvZ_xUnBEyuGf4eBf1SG2-SplZ5A
+ scenes-app-inbox-signal-cards--ticket-without-number--light:
+ hash: v1.k794b7964.015ae3204d23d033c3a0b131e352122cbc3cfa019f66f8f230f059b100f8f2cc.ZMT3pKT2QFcOr116n_hOXdGWTMc0uwzvvfj8DVcWurM
scenes-app-inbox-signalsourcespanel--armed-but-tools-off--dark:
hash: v1.k794b7964.ece1c0e16e4970e264f483296aaee56c6e8f271ffd8149c414ae314b1a72c866.kfMXUu0-mbkWvrPMsm0GPuPwIdcSt9t7DfNYHby-X0I
scenes-app-inbox-signalsourcespanel--armed-but-tools-off--light:
diff --git a/products/desktop/packages/ui/src/features/inbox/AGENTS.md b/products/desktop/packages/ui/src/features/inbox/AGENTS.md
index 2c7a92d4e36c..d264403cc399 100644
--- a/products/desktop/packages/ui/src/features/inbox/AGENTS.md
+++ b/products/desktop/packages/ui/src/features/inbox/AGENTS.md
@@ -211,6 +211,11 @@ label, `size="icon-sm"` for an icon-only one. A row of buttons that each carry
their own `h-7 px-2.5 text-[12px]` drifts apart the moment one of them is
edited, and it sits a size away from every other toolbar in the app.
+An evidence card links to its source object, and it builds that link from the signal's own identity.
+A Conversations ticket resolves through `supportTicketUrl`, from `extra.ticket_number` when the emitter stored one and from the ticket uuid in `source_id` otherwise, so the destination carries the source project and region.
+A card that can identify neither says the source is unavailable instead of rendering a link.
+Never read a destination out of the excerpt.
+
Shared primitives exist to keep the surfaces consistent:
- `InboxDetailPageHeader` for detail headers.
diff --git a/products/desktop/packages/ui/src/features/inbox/components/detail/SignalCard.tsx b/products/desktop/packages/ui/src/features/inbox/components/detail/SignalCard.tsx
index 1a603206cbf2..d07eee983c9a 100644
--- a/products/desktop/packages/ui/src/features/inbox/components/detail/SignalCard.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/components/detail/SignalCard.tsx
@@ -27,6 +27,7 @@ import {
colonOffsetToSeconds,
errorTrackingIssueUrl,
sessionRecordingUrl,
+ supportTicketUrl,
} from "@posthog/ui/utils/posthogLinks";
import { Badge, Box, Flex, Text } from "@radix-ui/themes";
import { type ReactNode, useCallback, useMemo, useRef, useState } from "react";
@@ -94,6 +95,9 @@ export function signalCardSourceLine(signal: {
if (source_product === "llm_analytics" && source_type === "evaluation") {
return "AI observability · Evaluation";
}
+ if (source_product === "conversations" && source_type === "ticket") {
+ return "Conversations · Ticket";
+ }
if (source_product === "zendesk" && source_type === "ticket") {
return "Zendesk · Ticket";
}
@@ -146,6 +150,13 @@ interface ZendeskTicketExtra {
tags?: string[];
}
+interface ConversationsTicketExtra {
+ ticket_number?: number;
+ status?: string;
+ priority?: string;
+ email_subject?: string;
+}
+
interface LlmEvalExtra {
evaluation_id?: string;
trace_id?: string;
@@ -455,6 +466,81 @@ function GitHubIssueSignalCard({
);
}
+/**
+ * The ticket page resolves both a ticket number and a ticket uuid, so `source_id` covers evidence
+ * stored before the emitter carried the number.
+ */
+function conversationsTicketRef(
+ signal: Signal,
+ extra: ConversationsTicketExtra,
+): string | number | null {
+ if (
+ typeof extra.ticket_number === "number" &&
+ Number.isInteger(extra.ticket_number) &&
+ extra.ticket_number > 0
+ ) {
+ return extra.ticket_number;
+ }
+ return signal.source_id || null;
+}
+
+function ConversationsTicketSignalCard({
+ signal,
+ extra,
+ verified,
+ codePaths,
+ dataQueried,
+}: {
+ signal: Signal;
+ extra: ConversationsTicketExtra;
+ verified?: boolean;
+ codePaths?: string[];
+ dataQueried?: string;
+}) {
+ const projectId = useAuthStateValue((s) => s.currentProjectId);
+ const cloudRegion = useAuthStateValue((s) => s.cloudRegion);
+ const ticketRef = conversationsTicketRef(signal, extra);
+ const ticketUrl = ticketRef
+ ? supportTicketUrl(ticketRef, { projectId, cloudRegion })
+ : null;
+
+ return (
+ <div className="min-w-0 overflow-hidden rounded-(--radius-2) border border-(--gray-6) bg-gray-1 p-3">
+ <SignalCardHeader signal={signal} verified={verified} />
+ {extra.email_subject && (
+ <div className="mb-1 font-medium text-[13px] text-gray-12">
+ {extra.email_subject}
+ </div>
+ )}
+ <CollapsibleBody body={signal.content} />
+ <div className="mt-2 flex flex-wrap items-center gap-2 text-[12px] text-gray-10">
+ {extra.ticket_number != null && (
+ <span className="font-mono">#{extra.ticket_number}</span>
+ )}
+ {extra.status && <span>Status: {extra.status}</span>}
+ {extra.priority && <span>Priority: {extra.priority}</span>}
+ <span className="flex-1" />
+ {ticketUrl ? (
+ // `target="_blank"` hands the link to the OS browser, so the report stays open in the app.
+ <a
+ href={ticketUrl}
+ target="_blank"
+ rel="noreferrer"
+ className="inline-flex items-center gap-1 text-[12px] text-gray-10 hover:text-gray-12"
+ >
+ Open ticket
+ <ArrowSquareOutIcon size={12} />
+ </a>
+ ) : (
+ <span>Source ticket unavailable</span>
+ )}
+ </div>
+ <CodePathsCollapsible paths={codePaths ?? []} />
+ <DataQueriedCollapsible text={dataQueried ?? ""} />
+ </div>
+ );
+}
+
function ZendeskTicketSignalCard({
signal,
extra,
@@ -1209,6 +1295,19 @@ export function SignalCard({
dataQueried={dataQueried}
/>
);
+ } else if (
+ signal.source_product === "conversations" &&
+ signal.source_type === "ticket"
+ ) {
+ content = (
+ <ConversationsTicketSignalCard
+ signal={signal}
+ extra={extra as ConversationsTicketExtra}
+ verified={verified}
+ codePaths={codePaths}
+ dataQueried={dataQueried}
+ />
+ );
} else if (
signal.source_product === "zendesk" &&
isZendeskTicketExtra(extra)
diff --git a/products/desktop/packages/ui/src/utils/posthogLinks.test.ts b/products/desktop/packages/ui/src/utils/posthogLinks.test.ts
index 39512ff5d190..b0e3e587e8e3 100644
--- a/products/desktop/packages/ui/src/utils/posthogLinks.test.ts
+++ b/products/desktop/packages/ui/src/utils/posthogLinks.test.ts
@@ -5,6 +5,7 @@ import {
inboxReportUrl,
parseShareLink,
sessionRecordingUrl,
+ supportTicketUrl,
} from "@posthog/ui/utils/posthogLinks";
import { describe, expect, it, vi } from "vitest";
@@ -28,6 +29,32 @@ describe("inboxReportUrl", () => {
});
});
+describe("supportTicketUrl", () => {
+ it.each([
+ [
+ "a ticket number",
+ 4821,
+ "https://us.posthog.com/project/123/support/tickets/4821",
+ ],
+ [
+ "a ticket uuid",
+ "0197-uuid",
+ "https://us.posthog.com/project/123/support/tickets/0197-uuid",
+ ],
+ ])(
+ "links the source project's ticket page by %s",
+ (_label, ref, expected) => {
+ expect(supportTicketUrl(ref, { projectId: 123, cloudRegion: "us" })).toBe(
+ expected,
+ );
+ },
+ );
+
+ it("has no destination without a project to resolve the ticket against", () => {
+ expect(supportTicketUrl(4821, { projectId: null })).toBeNull();
+ });
+});
+
describe("parseShareLink", () => {
it.each([
[
diff --git a/products/desktop/packages/ui/src/utils/posthogLinks.ts b/products/desktop/packages/ui/src/utils/posthogLinks.ts
index cf5604d1a25d..cf3e97b99b20 100644
--- a/products/desktop/packages/ui/src/utils/posthogLinks.ts
+++ b/products/desktop/packages/ui/src/utils/posthogLinks.ts
@@ -101,6 +101,18 @@ export function inboxReportUrl(
);
}
+/** The browser-accessible URL for a support ticket, by ticket number or by ticket uuid. */
+export function supportTicketUrl(
+ ticketRef: string | number,
+ overrides?: LinkOverrides,
+): string | null {
+ return withProjectId(
+ (pid) =>
+ `/project/${pid}/support/tickets/${encodeURIComponent(String(ticketRef))}`,
+ overrides,
+ );
+}
+
/**
* The shareable https link for a canvas (a dashboard inside a channel):
* `<instance>/code/canvas/<channelId>/<dashboardId>`. Opening it in a browser
diff --git a/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.test.tsx b/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.test.tsx
new file mode 100644
index 000000000000..b75f72fdfd18
--- /dev/null
+++ b/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.test.tsx
@@ -0,0 +1,49 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, render, screen } from '@testing-library/react'
+
+import type { SignalNode } from 'scenes/debug/signals/types'
+
+import { ConversationsTicketSignalCard } from './ConversationsTicketSignalCard'
+
+jest.mock('lib/components/TZLabel', () => ({
+ TZLabel: ({ time }: { time: string }) => <span>{time}</span>,
+}))
+
+function makeSignal(extra: Record<string, unknown>): SignalNode {
+ return {
+ signal_id: 'signal-1',
+ content: 'The upload progress bar reaches 100% but the file never appears.',
+ source_product: 'conversations',
+ source_type: 'ticket',
+ source_id: '0197-ticket-uuid',
+ weight: 1,
+ timestamp: '2026-07-13T00:00:00Z',
+ extra: extra as unknown as SignalNode['extra'],
+ }
+}
+
+describe('ConversationsTicketSignalCard', () => {
+ afterEach(cleanup)
+
+ it.each([
+ ['the ticket number when the emitter stored one', { ticket_number: 4821, channel_source: 'email' }, '4821'],
+ ['the ticket uuid for evidence stored without a number', { channel_source: 'email' }, '0197-ticket-uuid'],
+ ])('opens the source ticket by %s', (_name, extra, expectedRef) => {
+ render(<ConversationsTicketSignalCard signal={makeSignal(extra)} />)
+
+ expect(screen.getByText('Open ticket').closest('a')).toHaveAttribute(
+ 'href',
+ expect.stringContaining(`/support/tickets/${expectedRef}`)
+ )
+ })
+
+ it('says the source is unavailable instead of linking a ticket it cannot identify', () => {
+ const signal = { ...makeSignal({ channel_source: 'email' }), source_id: '' }
+
+ const { container } = render(<ConversationsTicketSignalCard signal={signal} />)
+
+ expect(screen.getByText('Source ticket unavailable')).toBeInTheDocument()
+ expect(container.querySelector('a')).toBeNull()
+ })
+})
diff --git a/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx b/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx
index 0d4783ab2dd5..e38e87d3fb6a 100644
--- a/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx
+++ b/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx
@@ -6,26 +6,22 @@ import { Link } from '@posthog/lemon-ui'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { isTrustedPostHogUrl } from 'lib/utils/trustedUrl'
-import { urls } from 'scenes/urls'
import type {
ConversationsTicketImageApi,
ConversationsTicketSignalExtraApi,
} from 'products/signals/frontend/generated/api.schemas'
import { safeHttpUrl } from 'products/signals/frontend/inbox/utils/reportPresentation'
+import { conversationsTicketUrl } from 'products/signals/frontend/inbox/utils/signalLinks'
import { SignalCardShell } from './SignalCardShell'
import type { SignalCardEntry, SignalCardProps } from './types'
-/** Guard for Conversations ticket extras. Keys on the ticket number + channel source unique to this source. */
-export function isConversationsTicketExtra(
- value: unknown
-): value is Record<string, unknown> & ConversationsTicketSignalExtraApi {
- if (typeof value !== 'object' || value === null) {
- return false
- }
- const extra = value as Record<string, unknown>
- return 'ticket_number' in extra && 'channel_source' in extra
+/** Every field is optional so that evidence stored before the emitter carried it still renders. */
+type TicketExtra = Partial<ConversationsTicketSignalExtraApi>
+
+function ticketExtra(value: unknown): TicketExtra {
+ return typeof value === 'object' && value !== null ? (value as TicketExtra) : {}
}
/** How many attachment thumbnails to show before pointing at the ticket for the rest. */
@@ -72,10 +68,10 @@ function TicketImageThumbnail({ image }: { image: ConversationsTicketImageApi })
export function ConversationsTicketSignalCard({ signal }: SignalCardProps): JSX.Element {
const redesign = useFeatureFlag('INBOX_REDESIGN')
- const extra = signal.extra as Record<string, unknown> & ConversationsTicketSignalExtraApi
+ const extra = ticketExtra(signal.extra)
// Attachment thumbnails are part of the redesign's evidence rail.
const images = redesign && Array.isArray(extra.images) ? extra.images : []
- const ticketUrl = urls.supportTicketDetail(extra.ticket_number)
+ const ticketUrl = conversationsTicketUrl(signal)
return (
<SignalCardShell signal={signal} label={extra.email_subject ?? undefined}>
@@ -90,21 +86,33 @@ export function ConversationsTicketSignalCard({ signal }: SignalCardProps): JSX.
<TicketImageThumbnail key={`${image.url}-${index}`} image={image} />
))}
{images.length > IMAGE_PREVIEW_COUNT && (
- <li>
- <Link to={ticketUrl} className="text-xs font-medium">
- +{images.length - IMAGE_PREVIEW_COUNT} more
- </Link>
+ <li className="text-xs font-medium">
+ {ticketUrl ? (
+ <Link to={ticketUrl}>+{images.length - IMAGE_PREVIEW_COUNT} more</Link>
+ ) : (
+ <span className="text-tertiary">+{images.length - IMAGE_PREVIEW_COUNT} more</span>
+ )}
</li>
)}
</ul>
)}
<div className="flex items-center gap-2 text-xs text-tertiary">
- <span className="font-mono font-medium">#{extra.ticket_number}</span>
+ {typeof extra.ticket_number === 'number' && (
+ <span className="font-mono font-medium">#{extra.ticket_number}</span>
+ )}
<span className="flex-1" />
- <Link to={ticketUrl} className="flex items-center gap-1 text-xs font-medium">
- Open ticket
- <IconChevronRight />
- </Link>
+ {ticketUrl ? (
+ <Link
+ to={ticketUrl}
+ className="flex items-center gap-1 text-xs font-medium"
+ data-attr="inbox-evidence-open-ticket"
+ >
+ Open ticket
+ <IconChevronRight />
+ </Link>
+ ) : (
+ <span>Source ticket unavailable</span>
+ )}
</div>
</SignalCardShell>
)
@@ -112,6 +120,6 @@ export function ConversationsTicketSignalCard({ signal }: SignalCardProps): JSX.
export const conversationsTicketSignalCardEntry: SignalCardEntry = {
key: 'conversations',
- matches: (signal) => signal.source_product === 'conversations' && isConversationsTicketExtra(signal.extra),
+ matches: (signal) => signal.source_product === 'conversations' && signal.source_type === 'ticket',
Component: ConversationsTicketSignalCard,
}
diff --git a/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx b/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx
index 67f539160f70..42e6e26cc47d 100644
--- a/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx
+++ b/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx
@@ -130,6 +130,18 @@ const conversationsTicket = makeSignal({
},
})
+// Evidence stored without a ticket number still opens the ticket, from the uuid on the signal.
+const conversationsTicketWithoutNumber = makeSignal({
+ source_product: 'conversations',
+ source_type: 'ticket',
+ source_id: '0197c3d2-4f61-7a2b-9c88-5de1f0a3b774',
+ content: 'The export finishes but the emailed link 404s for everyone on the team.',
+ extra: {
+ channel_source: 'email',
+ status: 'open',
+ },
+})
+
// An error tracking payload with no fingerprint fails that card's guard, so it falls back to the
// generic card, which still links the issue from the source id.
const genericWithEntityLink = makeSignal({
@@ -438,6 +450,10 @@ export const TicketAttachments: Story = {
render: () => <Rail signals={[conversationsTicket]} />,
}
+export const TicketWithoutNumber: Story = {
+ render: () => <Rail signals={[conversationsTicketWithoutNumber]} />,
+}
+
export const GenericFallbacks: Story = {
render: () => <Rail signals={[genericWithEntityLink, genericWithExternalLink, genericWithoutLink]} />,
}
diff --git a/products/signals/frontend/inbox/utils/signalLinks.test.ts b/products/signals/frontend/inbox/utils/signalLinks.test.ts
index ee866d2d2cde..7685e49887a3 100644
--- a/products/signals/frontend/inbox/utils/signalLinks.test.ts
+++ b/products/signals/frontend/inbox/utils/signalLinks.test.ts
@@ -1,53 +1,82 @@
-import { genericSignalLink } from './signalLinks'
+import { conversationsTicketUrl, genericSignalLink } from './signalLinks'
-describe('genericSignalLink', () => {
- it.each([
- {
- name: 'links a PostHog entity from source_product + source_id before any URL on extra',
- signal: {
- source_product: 'error_tracking',
- source_id: 'issue-1',
- extra: { url: 'https://example.com/elsewhere' },
+describe('signalLinks', () => {
+ describe('genericSignalLink', () => {
+ it.each([
+ {
+ name: 'links a PostHog entity from source_product + source_id before any URL on extra',
+ signal: {
+ source_product: 'error_tracking',
+ source_id: 'issue-1',
+ extra: { url: 'https://example.com/elsewhere' },
+ },
+ expected: { to: '/error_tracking/issue-1', label: 'View issue', external: false },
+ },
+ {
+ name: 'links a support ticket from a conversations source id',
+ signal: { source_product: 'conversations', source_id: 'ticket-uuid', extra: {} },
+ expected: { to: '/support/tickets/ticket-uuid', label: 'Open ticket', external: false },
+ },
+ {
+ name: 'links the logs scene without an entity id',
+ signal: { source_product: 'logs', source_id: '', extra: {} },
+ expected: { to: '/logs', label: 'View logs', external: false },
+ },
+ {
+ name: 'prefers html_url over url on extra',
+ signal: {
+ source_product: 'github',
+ source_id: '42',
+ extra: {
+ url: 'https://api.github.com/repos/o/r/issues/42',
+ html_url: 'https://github.com/o/r/issues/42',
+ },
+ },
+ expected: { to: 'https://github.com/o/r/issues/42', label: 'View in GitHub', external: true },
},
- expected: { to: '/error_tracking/issue-1', label: 'View issue', external: false },
- },
- {
- name: 'links the logs scene without an entity id',
- signal: { source_product: 'logs', source_id: '', extra: {} },
- expected: { to: '/logs', label: 'View logs', external: false },
- },
- {
- name: 'prefers html_url over url on extra',
- signal: {
- source_product: 'github',
- source_id: '42',
- extra: {
- url: 'https://api.github.com/repos/o/r/issues/42',
- html_url: 'https://github.com/o/r/issues/42',
+ {
+ name: 'humanizes a source product that has no filter option',
+ signal: {
+ source_product: 'sentry',
+ source_id: 's-1',
+ extra: { url: 'https://sentry.example.com/issues/1' },
},
+ expected: { to: 'https://sentry.example.com/issues/1', label: 'View in Sentry', external: true },
+ },
+ {
+ name: 'ignores a relative path on extra',
+ signal: { source_product: 'jira', source_id: 'J-1', extra: { url: '/browse/J-1' } },
+ expected: null,
},
- expected: { to: 'https://github.com/o/r/issues/42', label: 'View in GitHub', external: true },
- },
- {
- name: 'humanizes a source product that has no filter option',
- signal: {
- source_product: 'sentry',
- source_id: 's-1',
- extra: { url: 'https://sentry.example.com/issues/1' },
+ {
+ name: 'returns null when nothing links',
+ signal: { source_product: 'jira', source_id: 'J-1', extra: {} },
+ expected: null,
},
- expected: { to: 'https://sentry.example.com/issues/1', label: 'View in Sentry', external: true },
- },
- {
- name: 'ignores a relative path on extra',
- signal: { source_product: 'jira', source_id: 'J-1', extra: { url: '/browse/J-1' } },
- expected: null,
- },
- {
- name: 'returns null when nothing links',
- signal: { source_product: 'jira', source_id: 'J-1', extra: {} },
- expected: null,
- },
- ])('$name', ({ signal, expected }) => {
- expect(genericSignalLink(signal as any)).toEqual(expected)
+ ])('$name', ({ signal, expected }) => {
+ expect(genericSignalLink(signal as any)).toEqual(expected)
+ })
+ })
+
+ describe('conversationsTicketUrl', () => {
+ it.each([
+ [
+ 'the ticket number when the emitter stored one',
+ { ticket_number: 4821 },
+ 'uuid-1',
+ '/support/tickets/4821',
+ ],
+ ['the source id when the extra carries no number', {}, 'uuid-1', '/support/tickets/uuid-1'],
+ [
+ 'the source id when the number is not a ticket number',
+ { ticket_number: 0 },
+ 'uuid-1',
+ '/support/tickets/uuid-1',
+ ],
+ ['the source id when the extra is not an object', null, 'uuid-1', '/support/tickets/uuid-1'],
+ ['no destination when the signal carries neither', {}, '', null],
+ ])('resolves %s', (_name, extra, sourceId, expected) => {
+ expect(conversationsTicketUrl({ source_id: sourceId as string, extra })).toEqual(expected)
+ })
})
})
diff --git a/products/signals/frontend/inbox/utils/signalLinks.ts b/products/signals/frontend/inbox/utils/signalLinks.ts
index 78806e3e88cc..d23bdea39dfd 100644
--- a/products/signals/frontend/inbox/utils/signalLinks.ts
+++ b/products/signals/frontend/inbox/utils/signalLinks.ts
@@ -1,3 +1,4 @@
+import { isObject } from 'lib/utils/guards'
import { identifierToHuman } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
@@ -10,6 +11,8 @@ import { safeHttpUrl } from './reportPresentation'
*/
export function signalEntityUrl(sourceProduct: string, entityId?: string | null): string | null {
switch (sourceProduct) {
+ case 'conversations':
+ return entityId ? urls.supportTicketDetail(entityId) : null
case 'error_tracking':
return entityId ? urls.errorTrackingIssue(entityId) : null
case 'session_replay':
@@ -23,7 +26,22 @@ export function signalEntityUrl(sourceProduct: string, entityId?: string | null)
}
}
+/**
+ * The support ticket a Conversations evidence item came from. The ticket page resolves both a
+ * ticket number and a ticket uuid, so `source_id` covers evidence stored before the emitter
+ * carried the number. Null when the signal holds neither.
+ */
+export function conversationsTicketUrl(signal: { source_id: string; extra: unknown }): string | null {
+ const extra = isObject(signal.extra) ? signal.extra : {}
+ const ticketNumber = extra.ticket_number
+ if (typeof ticketNumber === 'number' && Number.isInteger(ticketNumber) && ticketNumber > 0) {
+ return urls.supportTicketDetail(ticketNumber)
+ }
+ return signal.source_id ? urls.supportTicketDetail(signal.source_id) : null
+}
+
const ENTITY_LINK_LABELS: Record<string, string> = {
+ conversations: 'Open ticket',
error_tracking: 'View issue',
session_replay: 'View replay',
llm_analytics: 'View trace',