@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client 1.117.2

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.
Files changed (98) hide show
  1. package/LICENSE.txt +82 -0
  2. package/README.md +149 -0
  3. package/dist/.forceignore +15 -0
  4. package/dist/.husky/pre-commit +4 -0
  5. package/dist/.prettierignore +11 -0
  6. package/dist/.prettierrc +17 -0
  7. package/dist/AGENT.md +193 -0
  8. package/dist/CHANGELOG.md +2128 -0
  9. package/dist/README.md +28 -0
  10. package/dist/config/project-scratch-def.json +13 -0
  11. package/dist/eslint.config.js +7 -0
  12. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/.forceignore +15 -0
  13. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/.graphqlrc.yml +2 -0
  14. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/.prettierignore +9 -0
  15. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/.prettierrc +11 -0
  16. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/CHANGELOG.md +10 -0
  17. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/README.md +75 -0
  18. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/codegen.yml +95 -0
  19. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/components.json +18 -0
  20. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/e2e/app.spec.ts +17 -0
  21. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/eslint.config.js +169 -0
  22. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/feature-react-agentforce-conversation-client.uibundle-meta.xml +7 -0
  23. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/index.html +12 -0
  24. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/package.json +69 -0
  25. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/playwright.config.ts +24 -0
  26. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/scripts/get-graphql-schema.mjs +68 -0
  27. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/scripts/rewrite-e2e-assets.mjs +23 -0
  28. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/api/graphqlClient.ts +25 -0
  29. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/app.tsx +17 -0
  30. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/appLayout.tsx +83 -0
  31. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/icons/book.svg +3 -0
  32. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/icons/copy.svg +4 -0
  33. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/icons/rocket.svg +3 -0
  34. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/icons/star.svg +3 -0
  35. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/images/codey-1.png +0 -0
  36. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/images/codey-2.png +0 -0
  37. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/images/codey-3.png +0 -0
  38. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/assets/images/vibe-codey.svg +194 -0
  39. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/AgentforceConversationClient.tsx +168 -0
  40. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/alerts/status-alert.tsx +49 -0
  41. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/layouts/card-layout.tsx +29 -0
  42. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/alert.tsx +76 -0
  43. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/badge.tsx +48 -0
  44. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/breadcrumb.tsx +109 -0
  45. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/button.tsx +67 -0
  46. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/calendar.tsx +232 -0
  47. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/card.tsx +103 -0
  48. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/checkbox.tsx +32 -0
  49. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/collapsible.tsx +33 -0
  50. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/datePicker.tsx +127 -0
  51. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/dialog.tsx +162 -0
  52. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/field.tsx +237 -0
  53. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/index.ts +84 -0
  54. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/input.tsx +19 -0
  55. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/label.tsx +22 -0
  56. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/pagination.tsx +132 -0
  57. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/popover.tsx +89 -0
  58. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/select.tsx +193 -0
  59. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/separator.tsx +26 -0
  60. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/skeleton.tsx +14 -0
  61. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/sonner.tsx +20 -0
  62. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/spinner.tsx +16 -0
  63. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/table.tsx +114 -0
  64. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/ui/tabs.tsx +88 -0
  65. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/index.ts +6 -0
  66. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/lib/utils.ts +6 -0
  67. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/navigationMenu.tsx +80 -0
  68. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/pages/Home.tsx +12 -0
  69. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/pages/NotFound.tsx +18 -0
  70. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/pages/TestAccPage.tsx +19 -0
  71. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/router-utils.tsx +35 -0
  72. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/routes.tsx +28 -0
  73. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/styles/global.css +135 -0
  74. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/types/conversation.ts +33 -0
  75. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/tsconfig.json +42 -0
  76. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/tsconfig.node.json +13 -0
  77. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/ui-bundle.json +7 -0
  78. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/vite-env.d.ts +1 -0
  79. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/vite.config.ts +106 -0
  80. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/vitest-env.d.ts +2 -0
  81. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/vitest.config.ts +11 -0
  82. package/dist/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/vitest.setup.ts +1 -0
  83. package/dist/jest.config.js +6 -0
  84. package/dist/package-lock.json +9995 -0
  85. package/dist/package.json +40 -0
  86. package/dist/scripts/apex/hello.apex +10 -0
  87. package/dist/scripts/graphql-search.sh +191 -0
  88. package/dist/scripts/prepare-import-unique-fields.js +122 -0
  89. package/dist/scripts/setup-cli.mjs +563 -0
  90. package/dist/scripts/sf-project-setup.mjs +66 -0
  91. package/dist/scripts/soql/account.soql +6 -0
  92. package/dist/sfdx-project.json +12 -0
  93. package/package.json +54 -0
  94. package/src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/components/AgentforceConversationClient.tsx +168 -0
  95. package/src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/index.ts +6 -0
  96. package/src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/pages/TestAccPage.tsx +19 -0
  97. package/src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/routes.tsx +23 -0
  98. package/src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/types/conversation.ts +33 -0
@@ -0,0 +1,28 @@
1
+ import type { RouteObject } from 'react-router';
2
+ import AppLayout from './appLayout';
3
+ import Home from './pages/Home';
4
+ import NotFound from './pages/NotFound';
5
+ import TestAccPage from "./pages/TestAccPage";
6
+
7
+ export const routes: RouteObject[] = [
8
+ {
9
+ path: "/",
10
+ element: <AppLayout />,
11
+ children: [
12
+ {
13
+ index: true,
14
+ element: <Home />,
15
+ handle: { showInNavigation: true, label: 'Home' }
16
+ },
17
+ {
18
+ path: '*',
19
+ element: <NotFound />
20
+ },
21
+ {
22
+ path: "test-acc",
23
+ element: <TestAccPage />,
24
+ handle: { showInNavigation: true, label: "Test ACC" }
25
+ }
26
+ ]
27
+ }
28
+ ];
@@ -0,0 +1,135 @@
1
+ @import 'tailwindcss';
2
+
3
+ @layer base {
4
+ html,
5
+ body,
6
+ #root {
7
+ @apply min-h-screen;
8
+ }
9
+
10
+ body {
11
+ @apply antialiased bg-white;
12
+ }
13
+ }
14
+
15
+ @import 'tw-animate-css';
16
+ @import 'shadcn/tailwind.css';
17
+
18
+ @custom-variant dark (&:is(.dark *));
19
+
20
+ @theme inline {
21
+ --color-background: var(--background);
22
+ --color-foreground: var(--foreground);
23
+ --color-card: var(--card);
24
+ --color-card-foreground: var(--card-foreground);
25
+ --color-popover: var(--popover);
26
+ --color-popover-foreground: var(--popover-foreground);
27
+ --color-primary: var(--primary);
28
+ --color-primary-foreground: var(--primary-foreground);
29
+ --color-secondary: var(--secondary);
30
+ --color-secondary-foreground: var(--secondary-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-muted-foreground: var(--muted-foreground);
33
+ --color-accent: var(--accent);
34
+ --color-accent-foreground: var(--accent-foreground);
35
+ --color-destructive: var(--destructive);
36
+ --color-destructive-foreground: var(--destructive-foreground);
37
+ --color-border: var(--border);
38
+ --color-input: var(--input);
39
+ --color-ring: var(--ring);
40
+ --color-chart-1: var(--chart-1);
41
+ --color-chart-2: var(--chart-2);
42
+ --color-chart-3: var(--chart-3);
43
+ --color-chart-4: var(--chart-4);
44
+ --color-chart-5: var(--chart-5);
45
+ --radius-sm: calc(var(--radius) - 4px);
46
+ --radius-md: calc(var(--radius) - 2px);
47
+ --radius-lg: var(--radius);
48
+ --radius-xl: calc(var(--radius) + 4px);
49
+ --color-sidebar: var(--sidebar);
50
+ --color-sidebar-foreground: var(--sidebar-foreground);
51
+ --color-sidebar-primary: var(--sidebar-primary);
52
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
53
+ --color-sidebar-accent: var(--sidebar-accent);
54
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
55
+ --color-sidebar-border: var(--sidebar-border);
56
+ --color-sidebar-ring: var(--sidebar-ring);
57
+ }
58
+
59
+ :root {
60
+ --radius: 0.625rem;
61
+ --background: oklch(1 0 0);
62
+ --foreground: oklch(0.145 0 0);
63
+ --card: oklch(1 0 0);
64
+ --card-foreground: oklch(0.145 0 0);
65
+ --popover: oklch(1 0 0);
66
+ --popover-foreground: oklch(0.145 0 0);
67
+ --primary: oklch(0.205 0 0);
68
+ --primary-foreground: oklch(0.985 0 0);
69
+ --secondary: oklch(0.97 0 0);
70
+ --secondary-foreground: oklch(0.205 0 0);
71
+ --muted: oklch(0.97 0 0);
72
+ --muted-foreground: oklch(0.556 0 0);
73
+ --accent: oklch(0.97 0 0);
74
+ --accent-foreground: oklch(0.205 0 0);
75
+ --destructive: oklch(0.577 0.245 27.325);
76
+ --border: oklch(0.922 0 0);
77
+ --input: oklch(0.922 0 0);
78
+ --ring: oklch(0.708 0 0);
79
+ --chart-1: oklch(0.646 0.222 41.116);
80
+ --chart-2: oklch(0.6 0.118 184.704);
81
+ --chart-3: oklch(0.398 0.07 227.392);
82
+ --chart-4: oklch(0.828 0.189 84.429);
83
+ --chart-5: oklch(0.769 0.188 70.08);
84
+ --sidebar: oklch(0.985 0 0);
85
+ --sidebar-foreground: oklch(0.145 0 0);
86
+ --sidebar-primary: oklch(0.205 0 0);
87
+ --sidebar-primary-foreground: oklch(0.985 0 0);
88
+ --sidebar-accent: oklch(0.97 0 0);
89
+ --sidebar-accent-foreground: oklch(0.205 0 0);
90
+ --sidebar-border: oklch(0.922 0 0);
91
+ --sidebar-ring: oklch(0.708 0 0);
92
+ }
93
+
94
+ .dark {
95
+ --background: oklch(0.145 0 0);
96
+ --foreground: oklch(0.985 0 0);
97
+ --card: oklch(0.205 0 0);
98
+ --card-foreground: oklch(0.985 0 0);
99
+ --popover: oklch(0.205 0 0);
100
+ --popover-foreground: oklch(0.985 0 0);
101
+ --primary: oklch(0.922 0 0);
102
+ --primary-foreground: oklch(0.205 0 0);
103
+ --secondary: oklch(0.269 0 0);
104
+ --secondary-foreground: oklch(0.985 0 0);
105
+ --muted: oklch(0.269 0 0);
106
+ --muted-foreground: oklch(0.708 0 0);
107
+ --accent: oklch(0.269 0 0);
108
+ --accent-foreground: oklch(0.985 0 0);
109
+ --destructive: oklch(0.704 0.191 22.216);
110
+ --border: oklch(1 0 0 / 10%);
111
+ --input: oklch(1 0 0 / 15%);
112
+ --ring: oklch(0.556 0 0);
113
+ --chart-1: oklch(0.488 0.243 264.376);
114
+ --chart-2: oklch(0.696 0.17 162.48);
115
+ --chart-3: oklch(0.769 0.188 70.08);
116
+ --chart-4: oklch(0.627 0.265 303.9);
117
+ --chart-5: oklch(0.645 0.246 16.439);
118
+ --sidebar: oklch(0.205 0 0);
119
+ --sidebar-foreground: oklch(0.985 0 0);
120
+ --sidebar-primary: oklch(0.488 0.243 264.376);
121
+ --sidebar-primary-foreground: oklch(0.985 0 0);
122
+ --sidebar-accent: oklch(0.269 0 0);
123
+ --sidebar-accent-foreground: oklch(0.985 0 0);
124
+ --sidebar-border: oklch(1 0 0 / 10%);
125
+ --sidebar-ring: oklch(0.556 0 0);
126
+ }
127
+
128
+ @layer base {
129
+ * {
130
+ @apply border-border outline-ring/50;
131
+ }
132
+ body {
133
+ @apply bg-background text-foreground;
134
+ }
135
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ export interface ResolvedEmbedOptions {
8
+ salesforceOrigin?: string;
9
+ frontdoorUrl?: string;
10
+ }
11
+
12
+ export type StyleTokens = Record<string, string>;
13
+
14
+ export interface AgentforceConversationClientProps {
15
+ /** Required in practice: id of the agent to load. */
16
+ agentId: string;
17
+ /** If true, renders inline. If omitted/false, renders floating. */
18
+ inline?: boolean;
19
+ /** Show/hide chat header. Defaults to true for floating; can only be set for inline mode. */
20
+ headerEnabled?: boolean;
21
+ /** Show/hide agent icon in the header. */
22
+ showHeaderIcon?: boolean;
23
+ /** Inline width. */
24
+ width?: string | number;
25
+ /** Inline height. */
26
+ height?: string | number;
27
+ /** Theme overrides for the chat UI. */
28
+ styleTokens?: StyleTokens;
29
+ /** Optional. If not provided, resolved internally (e.g. from /__lo/frontdoor in dev, window.location.origin in prod). */
30
+ salesforceOrigin?: string;
31
+ /** Optional. If not provided, resolved internally in dev via /__lo/frontdoor. */
32
+ frontdoorUrl?: string;
33
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+
23
+ /* Path mapping */
24
+ "baseUrl": ".",
25
+ "paths": {
26
+ "@/*": ["./src/*"],
27
+ "@api/*": ["./src/api/*"],
28
+ "@components/*": ["./src/components/*"],
29
+ "@utils/*": ["./src/utils/*"],
30
+ "@styles/*": ["./src/styles/*"],
31
+ "@assets/*": ["./src/assets/*"]
32
+ }
33
+ },
34
+ "include": [
35
+ "src",
36
+ "e2e",
37
+ "vite-env.d.ts",
38
+ "vitest-env.d.ts",
39
+ "vitest.setup.ts"
40
+ ],
41
+ "references": [{ "path": "./tsconfig.node.json" }]
42
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "skipLibCheck": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "outDir": "./build"
11
+ },
12
+ "include": ["vite.config.ts"]
13
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "outputDir": "dist",
3
+ "routing": {
4
+ "trailingSlash": "never",
5
+ "fallback": "index.html"
6
+ }
7
+ }
@@ -0,0 +1,106 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import path from 'path';
5
+ import { resolve } from 'path';
6
+ import tailwindcss from '@tailwindcss/vite';
7
+ import salesforce from '@salesforce/vite-plugin-ui-bundle';
8
+ import codegen from 'vite-plugin-graphql-codegen';
9
+
10
+ const schemaPath = resolve(__dirname, '../../../../../schema.graphql');
11
+ const schemaExists = existsSync(schemaPath);
12
+
13
+ export default defineConfig(({ mode }) => {
14
+ return {
15
+ base: './',
16
+ plugins: [
17
+ tailwindcss(),
18
+ react(),
19
+ salesforce(),
20
+ // Only add codegen when schema exists (e.g. after `npm run graphql:schema`).
21
+ // In CI or when schema is not checked in, skip codegen so build succeeds.
22
+ ...(schemaExists
23
+ ? [
24
+ codegen({
25
+ configFilePathOverride: resolve(__dirname, 'codegen.yml'),
26
+ runOnStart: true,
27
+ runOnBuild: true,
28
+ enableWatcher: true,
29
+ throwOnBuild: true,
30
+ }),
31
+ ]
32
+ : []),
33
+ ] as import('vite').PluginOption[],
34
+
35
+ // Build configuration for MPA
36
+ build: {
37
+ outDir: resolve(__dirname, 'dist'),
38
+ assetsDir: 'assets',
39
+ sourcemap: false,
40
+ },
41
+
42
+ // Resolve aliases (shared between build and test)
43
+ resolve: {
44
+ dedupe: ['react', 'react-dom'],
45
+ alias: {
46
+ '@': path.resolve(__dirname, './src'),
47
+ '@api': path.resolve(__dirname, './src/api'),
48
+ '@components': path.resolve(__dirname, './src/components'),
49
+ '@utils': path.resolve(__dirname, './src/utils'),
50
+ '@styles': path.resolve(__dirname, './src/styles'),
51
+ '@assets': path.resolve(__dirname, './src/assets'),
52
+ },
53
+ },
54
+
55
+ // Vitest configuration
56
+ test: {
57
+ // Override root for tests (build uses src/pages as root)
58
+ root: resolve(__dirname),
59
+
60
+ // Use jsdom environment for React component testing
61
+ environment: 'jsdom',
62
+
63
+ // Setup files to run before each test
64
+ setupFiles: ['./src/test/setup.ts'],
65
+
66
+ // Global test patterns
67
+ include: [
68
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
69
+ 'src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
70
+ ],
71
+
72
+ // Coverage configuration
73
+ coverage: {
74
+ provider: 'v8',
75
+ reporter: ['text', 'html', 'clover', 'json'],
76
+ exclude: [
77
+ 'node_modules/',
78
+ 'src/test/',
79
+ 'src/**/*.d.ts',
80
+ 'src/main.tsx',
81
+ 'src/vite-env.d.ts',
82
+ 'src/components/**/index.ts',
83
+ '**/*.config.ts',
84
+ 'build/',
85
+ 'dist/',
86
+ 'coverage/',
87
+ 'eslint.config.js',
88
+ ],
89
+ thresholds: {
90
+ global: {
91
+ branches: 85,
92
+ functions: 85,
93
+ lines: 85,
94
+ statements: 85,
95
+ },
96
+ },
97
+ },
98
+
99
+ // Test timeout
100
+ testTimeout: 10000,
101
+
102
+ // Globals for easier testing
103
+ globals: true,
104
+ },
105
+ };
106
+ });
@@ -0,0 +1,2 @@
1
+ /// <reference types="vitest" />
2
+ /// <reference types="@testing-library/jest-dom" />
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ test: {
7
+ globals: true,
8
+ environment: 'jsdom',
9
+ setupFiles: './vitest.setup.ts',
10
+ },
11
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,6 @@
1
+ const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config');
2
+
3
+ module.exports = {
4
+ ...jestConfig,
5
+ modulePathIgnorePatterns: ['<rootDir>/.localdevserver']
6
+ };