@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
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client",
3
+ "version": "1.117.2",
4
+ "description": "Embedded Agentforce conversation client feature for UI Bundles",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "author": "",
7
+ "type": "module",
8
+ "main": "src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/index.ts",
9
+ "types": "src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/index.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/index.ts",
13
+ "import": "./src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/index.ts",
14
+ "default": "./src/force-app/main/default/uiBundles/feature-react-agentforce-conversation-client/src/index.ts"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "src",
20
+ "rules"
21
+ ],
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "scripts": {
26
+ "clean": "rm -rf dist"
27
+ },
28
+ "dependencies": {
29
+ "@salesforce/agentforce-conversation-client": "^1.117.2"
30
+ },
31
+ "devDependencies": {
32
+ "@types/react": "^19.2.7",
33
+ "@types/react-dom": "^19.2.3",
34
+ "react": "^19.2.1",
35
+ "react-dom": "^19.2.1",
36
+ "react-router": "^7.10.1"
37
+ },
38
+ "nx": {
39
+ "targets": {
40
+ "build": {
41
+ "executor": "@salesforce/ui-bundle-template-cli:apply-patches"
42
+ },
43
+ "watch": {
44
+ "executor": "@salesforce/ui-bundle-template-cli:watch-patches"
45
+ },
46
+ "build:dist-app": {
47
+ "executor": "@salesforce/ui-bundle-template-cli:build-dist-app"
48
+ },
49
+ "dev": {
50
+ "executor": "@salesforce/ui-bundle-template-cli:dev-server"
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { embedAgentforceClient } from "@salesforce/agentforce-conversation-client";
8
+ import type { AgentforceClientConfig } from "@salesforce/agentforce-conversation-client";
9
+ import { useEffect, useMemo, useRef } from "react";
10
+ import type {
11
+ ResolvedEmbedOptions,
12
+ AgentforceConversationClientProps,
13
+ } from "../types/conversation";
14
+
15
+ const GLOBAL_HOST_ID = "agentforce-conversation-client-global-host";
16
+ const SINGLETON_KEY = "__agentforceConversationClientSingleton";
17
+
18
+ interface AgentforceConversationClientSingleton {
19
+ initPromise?: Promise<void>;
20
+ initialized: boolean;
21
+ }
22
+
23
+ interface WindowWithAgentforceSingleton extends Window {
24
+ [SINGLETON_KEY]?: AgentforceConversationClientSingleton;
25
+ }
26
+
27
+ function getSingleton(): AgentforceConversationClientSingleton {
28
+ const win = window as WindowWithAgentforceSingleton;
29
+ if (!win[SINGLETON_KEY]) {
30
+ win[SINGLETON_KEY] = {
31
+ initialized: false,
32
+ };
33
+ }
34
+ return win[SINGLETON_KEY]!;
35
+ }
36
+
37
+ function getOrCreateGlobalHost(): HTMLDivElement {
38
+ let host = document.getElementById(GLOBAL_HOST_ID) as HTMLDivElement | null;
39
+ if (!host) {
40
+ host = document.createElement("div");
41
+ host.id = GLOBAL_HOST_ID;
42
+ document.body.appendChild(host);
43
+ }
44
+ return host;
45
+ }
46
+
47
+ function getDefaultEmbedOptions(): ResolvedEmbedOptions {
48
+ return { salesforceOrigin: window.location.origin };
49
+ }
50
+
51
+ /**
52
+ * React wrapper that embeds the Agentforce Conversation Client (copilot/agent UI)
53
+ * using Lightning Out. Requires a valid Salesforce session for the given org.
54
+ * Config is passed through from the consumer to the embed client as-is.
55
+ */
56
+ export function AgentforceConversationClient({
57
+ agentId,
58
+ inline: inlineProp,
59
+ headerEnabled,
60
+ showHeaderIcon,
61
+ width,
62
+ height,
63
+ styleTokens,
64
+ salesforceOrigin,
65
+ frontdoorUrl,
66
+ }: AgentforceConversationClientProps) {
67
+ const containerRef = useRef<HTMLDivElement>(null);
68
+ const normalizedAgentforceClientConfig = useMemo<AgentforceClientConfig>(() => {
69
+ const renderingConfig: NonNullable<AgentforceClientConfig["renderingConfig"]> = {
70
+ mode: inlineProp ? "inline" : "floating",
71
+ ...(headerEnabled !== undefined && { headerEnabled }),
72
+ ...(showHeaderIcon !== undefined && { showHeaderIcon }),
73
+ ...{ showAvatar: false },
74
+ ...(width !== undefined && { width }),
75
+ ...(height !== undefined && { height }),
76
+ };
77
+
78
+ return {
79
+ ...(agentId !== undefined && { agentId }),
80
+ ...(styleTokens !== undefined && { styleTokens }),
81
+ renderingConfig,
82
+ };
83
+ }, [agentId, inlineProp, headerEnabled, showHeaderIcon, width, height, styleTokens]);
84
+
85
+ const inline = normalizedAgentforceClientConfig?.renderingConfig?.mode === "inline";
86
+
87
+ useEffect(() => {
88
+ if (!normalizedAgentforceClientConfig?.agentId) {
89
+ throw new Error(
90
+ "AgentforceConversationClient requires agentId. " +
91
+ "Pass flat props only (agentId, inline, headerEnabled, showHeaderIcon, width, height, styleTokens).",
92
+ );
93
+ }
94
+
95
+ const singleton = getSingleton();
96
+ if (singleton.initialized || singleton.initPromise) {
97
+ return;
98
+ }
99
+
100
+ if (inline && !containerRef.current) {
101
+ return;
102
+ }
103
+
104
+ const initialize = (options: ResolvedEmbedOptions) => {
105
+ if (singleton.initialized) {
106
+ return;
107
+ }
108
+ const existingEmbed = document.querySelector('lightning-out-application[data-lo="acc"]');
109
+ if (existingEmbed) {
110
+ singleton.initialized = true;
111
+ return;
112
+ }
113
+ const host = inline ? containerRef.current! : getOrCreateGlobalHost();
114
+
115
+ embedAgentforceClient({
116
+ container: host,
117
+ salesforceOrigin: salesforceOrigin ?? options.salesforceOrigin,
118
+ frontdoorUrl: frontdoorUrl ?? options.frontdoorUrl,
119
+ agentforceClientConfig: normalizedAgentforceClientConfig,
120
+ });
121
+ singleton.initialized = true;
122
+ };
123
+
124
+ const shouldFetchFrontdoor = window.location.hostname === "localhost";
125
+
126
+ if (shouldFetchFrontdoor) {
127
+ singleton.initPromise = fetch("/__lo/frontdoor")
128
+ .then(async (res) => {
129
+ if (!res.ok) {
130
+ console.error("frontdoor fetch failed");
131
+ return;
132
+ }
133
+ const { frontdoorUrl: resolvedFrontdoorUrl } = await res.json();
134
+ initialize({ frontdoorUrl: resolvedFrontdoorUrl });
135
+ })
136
+ .catch((err) => {
137
+ console.error("AgentforceConversationClient: failed to fetch frontdoor URL", err);
138
+ })
139
+ .finally(() => {
140
+ singleton.initPromise = undefined;
141
+ });
142
+ } else {
143
+ singleton.initPromise = Promise.resolve()
144
+ .then(() => {
145
+ initialize(getDefaultEmbedOptions());
146
+ })
147
+ .catch((err) => {
148
+ console.error("AgentforceConversationClient: failed to embed Agentforce client", err);
149
+ })
150
+ .finally(() => {
151
+ singleton.initPromise = undefined;
152
+ });
153
+ }
154
+
155
+ return () => {
156
+ // Intentionally no cleanup:
157
+ // This component guarantees a single LO initialization per window.
158
+ };
159
+ }, [salesforceOrigin, frontdoorUrl, normalizedAgentforceClientConfig, inline]);
160
+
161
+ if (!inline) {
162
+ return null;
163
+ }
164
+
165
+ return <div ref={containerRef} />;
166
+ }
167
+
168
+ export default AgentforceConversationClient;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * feature-react-agentforce-conversation-client – ACC Conversation Client
3
+ */
4
+
5
+ export { AgentforceConversationClient } from "./components/AgentforceConversationClient";
6
+ export type { AgentforceConversationClientProps, ResolvedEmbedOptions } from "./types/conversation";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import AgentforceConversationClient from "../components/AgentforceConversationClient";
8
+
9
+ export default function TestAccPage() {
10
+ return (
11
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
12
+ <div className="text-center">
13
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">ACC</h1>
14
+ <p className="text-lg text-gray-600 mb-8">Welcome to your ACC application.</p>
15
+ </div>
16
+ <AgentforceConversationClient agentId="0Xx000000000000AAA" />
17
+ </div>
18
+ );
19
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import type { RouteObject } from "react-router";
8
+ import AppLayout from "./__inherit__appLayout";
9
+ import TestAccPage from "./pages/TestAccPage";
10
+
11
+ export const routes: RouteObject[] = [
12
+ {
13
+ path: "/",
14
+ element: <AppLayout />,
15
+ children: [
16
+ {
17
+ path: "test-acc",
18
+ element: <TestAccPage />,
19
+ handle: { showInNavigation: true, label: "Test ACC" },
20
+ },
21
+ ],
22
+ },
23
+ ];
@@ -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
+ }