@handled-ai/design-system 0.20.5 → 0.20.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/conversation-panel.d.ts +19 -0
- package/dist/components/conversation-panel.js +116 -292
- package/dist/components/conversation-panel.js.map +1 -1
- package/dist/components/email-body.d.ts +15 -0
- package/dist/components/email-body.js +101 -0
- package/dist/components/email-body.js.map +1 -0
- package/dist/components/email-display-helpers.d.ts +34 -0
- package/dist/components/email-display-helpers.js +436 -0
- package/dist/components/email-display-helpers.js.map +1 -0
- package/dist/components/email-preview-card.d.ts +7 -4
- package/dist/components/email-preview-card.js +48 -25
- package/dist/components/email-preview-card.js.map +1 -1
- package/dist/components/timeline-activity.js +66 -42
- package/dist/components/timeline-activity.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/safe-html.d.ts +1 -1
- package/dist/internal/safe-html.js +64 -3
- package/dist/internal/safe-html.js.map +1 -1
- package/package.json +1 -1
- package/src/components/__tests__/conversation-panel.test.tsx +182 -22
- package/src/components/__tests__/email-body.test.tsx +83 -0
- package/src/components/__tests__/email-display-helpers.test.ts +91 -0
- package/src/components/__tests__/email-preview-card.test.tsx +36 -2
- package/src/components/__tests__/timeline-activity.test.tsx +53 -1
- package/src/components/conversation-panel.tsx +136 -350
- package/src/components/email-body.tsx +126 -0
- package/src/components/email-display-helpers.ts +557 -0
- package/src/components/email-preview-card.tsx +54 -29
- package/src/components/timeline-activity.tsx +73 -53
- package/src/index.ts +2 -0
- package/src/internal/__tests__/safe-html.test.ts +34 -2
- package/src/internal/safe-html.ts +79 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@testing-library/jest-dom/vitest"
|
|
2
2
|
import { describe, it, expect } from "vitest"
|
|
3
3
|
import React from "react"
|
|
4
|
-
import { render, screen } from "@testing-library/react"
|
|
4
|
+
import { fireEvent, render, screen } from "@testing-library/react"
|
|
5
5
|
import {
|
|
6
6
|
TimelineActivity,
|
|
7
7
|
TONE_CLASSES,
|
|
@@ -12,6 +12,17 @@ import {
|
|
|
12
12
|
// Helpers
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
|
|
15
|
+
function expectNoVisibleEscapeArtifacts(value: string) {
|
|
16
|
+
expect(value).not.toMatch(/&#(?:x[0-9a-f]+|\d+);?/i)
|
|
17
|
+
expect(value).not.toContain("&")
|
|
18
|
+
expect(value).not.toContain("<")
|
|
19
|
+
expect(value).not.toContain(">")
|
|
20
|
+
expect(value).not.toContain(""")
|
|
21
|
+
expect(value).not.toContain('\\"')
|
|
22
|
+
expect(value).not.toContain("\\'")
|
|
23
|
+
expect(value).not.toContain("\\n")
|
|
24
|
+
}
|
|
25
|
+
|
|
15
26
|
function minimal(overrides: Partial<TimelineEvent> = {}): TimelineEvent {
|
|
16
27
|
return {
|
|
17
28
|
id: "e1",
|
|
@@ -328,4 +339,45 @@ describe("TimelineActivity", () => {
|
|
|
328
339
|
"https://salesforce.example/case/1",
|
|
329
340
|
)
|
|
330
341
|
})
|
|
342
|
+
|
|
343
|
+
it("uses shared helpers for decoded timeline sender, timestamp, snippets, and collapsed details", () => {
|
|
344
|
+
const event = minimal({
|
|
345
|
+
isInteractive: true,
|
|
346
|
+
defaultExpanded: false,
|
|
347
|
+
email: {
|
|
348
|
+
from: "Cory & Co",
|
|
349
|
+
fromEmail: "cory@example.com",
|
|
350
|
+
to: "Jane & Team <jane@example.com>",
|
|
351
|
+
cc: "Ops <ops@example.com>",
|
|
352
|
+
date: "2026-06-08T15:30:00.000Z",
|
|
353
|
+
subject: "Update & next steps",
|
|
354
|
+
body: "plain fallback",
|
|
355
|
+
bodyHtml:
|
|
356
|
+
"<p>Hello Jane & team — it's ready.</p><p>Thanks,</p><p>Cory Pitt</p><p>Handled<sup>AI</sup></p>",
|
|
357
|
+
},
|
|
358
|
+
preview: "Hello Jane & team — it's ready.",
|
|
359
|
+
})
|
|
360
|
+
|
|
361
|
+
const { container } = render(<TimelineActivity events={[event]} />)
|
|
362
|
+
const collapsedText = container.textContent ?? ""
|
|
363
|
+
|
|
364
|
+
expect(collapsedText).toContain("Cory & Co")
|
|
365
|
+
expect(collapsedText).toContain("Update & next steps")
|
|
366
|
+
expect(collapsedText).toContain("Hello Jane & team — it's ready.")
|
|
367
|
+
expectNoVisibleEscapeArtifacts(collapsedText)
|
|
368
|
+
|
|
369
|
+
fireEvent.click(screen.getByRole("button", { name: /Expand/i }))
|
|
370
|
+
|
|
371
|
+
expect(screen.getByText("Jun 8, 2026, 3:30 PM")).toBeTruthy()
|
|
372
|
+
expect(screen.getByText(/Jane & Team <jane@example.com>/)).toBeTruthy()
|
|
373
|
+
expect(container.querySelector('[data-slot="email-body-details"]')).toBeNull()
|
|
374
|
+
expect(screen.getByRole("button", { name: "•••" })).toBeTruthy()
|
|
375
|
+
expect(container.textContent).not.toContain("HandledAI")
|
|
376
|
+
|
|
377
|
+
fireEvent.click(screen.getByRole("button", { name: "•••" }))
|
|
378
|
+
expect(container.querySelector("sup")?.textContent).toBe("AI")
|
|
379
|
+
expect(container.textContent).toContain("HandledAI")
|
|
380
|
+
expectNoVisibleEscapeArtifacts(container.textContent ?? "")
|
|
381
|
+
})
|
|
382
|
+
|
|
331
383
|
})
|