@webex/cc-ai-assistant 0.0.0-next.1

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.
@@ -0,0 +1,11 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+
3
+ /**
4
+ * @license React
5
+ * use-sync-external-store-shim.production.js
6
+ *
7
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IAIAssistantProps } from '../ai-assistant.types';
3
+ declare const AIAssistant: React.FunctionComponent<IAIAssistantProps>;
4
+ export { AIAssistant };
@@ -0,0 +1,34 @@
1
+ import type { RealTimeAssistPayload } from '@webex/cc-store';
2
+ /**
3
+ * Public props for the `AIAssistant` widget. All callbacks are optional —
4
+ * the host can opt into any subset.
5
+ */
6
+ export interface IAIAssistantProps {
7
+ /** Fired when the launcher is clicked and the panel opens. */
8
+ onOpen?: () => void;
9
+ /** Fired when the agent minimizes the panel to its collapsed bar. */
10
+ onMinimize?: () => void;
11
+ /** Fired when the minimized bar is restored to the full panel. */
12
+ onRestore?: () => void;
13
+ /** Fired when the panel is closed back to the launcher. */
14
+ onClose?: () => void;
15
+ /** Fired when the fullscreen affordance is toggled. Host owns layout. */
16
+ onFullScreenToggle?: (isFullScreen: boolean) => void;
17
+ /** Fired each time a fresh real-time assist response arrives for the active task. */
18
+ onRealTimeAssistReceived?: (payload: RealTimeAssistPayload) => void;
19
+ /** Optional extra class applied to the widget root. */
20
+ className?: string;
21
+ }
22
+ export interface UseAiAssistantInput extends IAIAssistantProps {
23
+ interactionId?: string;
24
+ agentId: string;
25
+ isFeatureEnabled: boolean;
26
+ realTimeAssist: RealTimeAssistPayload[];
27
+ }
28
+ export type UseAIAssistantChromeInput = Pick<UseAiAssistantInput, 'onOpen' | 'onMinimize' | 'onRestore' | 'onClose' | 'onFullScreenToggle'>;
29
+ export type UseRealTimeAssistInput = Pick<UseAiAssistantInput, 'interactionId' | 'agentId' | 'isFeatureEnabled' | 'realTimeAssist' | 'onRealTimeAssistReceived'>;
30
+ export type UserMessage = {
31
+ id: string;
32
+ text: string;
33
+ sentAt: number;
34
+ };
@@ -0,0 +1,45 @@
1
+ import type { RealTimeAssistPayload } from '@webex/cc-store';
2
+ import type { AIAssistantActionEvent, AIAssistantChatEntry, AIAssistantChromeState, AIAssistantRequestStatus } from '@webex/cc-components';
3
+ import { UseAIAssistantChromeInput, UseAiAssistantInput, UseRealTimeAssistInput } from './ai-assistant.types';
4
+ declare const REAL_TIME_ASSIST_FLAG = "isSuggestedResponsesEnabled";
5
+ export declare const useAIAssistantChrome: ({ onOpen, onMinimize, onRestore, onClose, onFullScreenToggle, }: UseAIAssistantChromeInput) => {
6
+ chrome: AIAssistantChromeState;
7
+ isFullScreen: boolean;
8
+ open: () => void;
9
+ close: () => void;
10
+ minimize: () => void;
11
+ restore: () => void;
12
+ toggleFullScreen: () => void;
13
+ };
14
+ export declare const useRealTimeAssist: ({ interactionId, agentId, isFeatureEnabled, realTimeAssist, onRealTimeAssistReceived, }: UseRealTimeAssistInput) => {
15
+ requestStatus: AIAssistantRequestStatus;
16
+ errorMessage: string;
17
+ contextDraft: string;
18
+ isRequesting: boolean;
19
+ hasInitialRequestSucceeded: boolean;
20
+ chatEntries: AIAssistantChatEntry[];
21
+ requestRealTimeAssist: (context?: string) => Promise<void>;
22
+ setContextDraft: import("react").Dispatch<import("react").SetStateAction<string>>;
23
+ submitContext: () => void;
24
+ onRealTimeAssistAction: (event: AIAssistantActionEvent, assist: RealTimeAssistPayload) => any;
25
+ };
26
+ export declare const useAiAssistant: (input: UseAiAssistantInput) => {
27
+ requestStatus: AIAssistantRequestStatus;
28
+ errorMessage: string;
29
+ contextDraft: string;
30
+ isRequesting: boolean;
31
+ hasInitialRequestSucceeded: boolean;
32
+ chatEntries: AIAssistantChatEntry[];
33
+ requestRealTimeAssist: (context?: string) => Promise<void>;
34
+ setContextDraft: import("react").Dispatch<import("react").SetStateAction<string>>;
35
+ submitContext: () => void;
36
+ onRealTimeAssistAction: (event: AIAssistantActionEvent, assist: RealTimeAssistPayload) => any;
37
+ chrome: AIAssistantChromeState;
38
+ isFullScreen: boolean;
39
+ open: () => void;
40
+ close: () => void;
41
+ minimize: () => void;
42
+ restore: () => void;
43
+ toggleFullScreen: () => void;
44
+ };
45
+ export { REAL_TIME_ASSIST_FLAG };
@@ -0,0 +1,3 @@
1
+ import { AIAssistant } from './ai-assistant/index';
2
+ export { AIAssistant };
3
+ export * from './ai-assistant.types';
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@webex/cc-ai-assistant",
3
+ "description": "Webex Contact Center Widgets: AI Assistant",
4
+ "license": "Cisco's General Terms (https://www.cisco.com/site/us/en/about/legal/contract-experience/index.html)",
5
+ "version": "0.0.0-next.1",
6
+ "main": "dist/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "files": [
12
+ "dist/",
13
+ "package.json"
14
+ ],
15
+ "scripts": {
16
+ "clean": "rm -rf dist && rm -rf node_modules",
17
+ "clean:dist": "rm -rf dist",
18
+ "build": "yarn run -T tsc",
19
+ "build:src": "yarn run clean:dist && webpack",
20
+ "build:watch": "webpack --watch",
21
+ "test:unit": "tsc --project tsconfig.test.json && jest --coverage",
22
+ "test:styles": "eslint",
23
+ "deploy:npm": "yarn npm publish"
24
+ },
25
+ "dependencies": {
26
+ "@webex/cc-components": "1.28.0-next.40",
27
+ "@webex/cc-store": "1.28.0-next.25",
28
+ "@webex/cc-ui-logging": "1.28.0-next.26",
29
+ "mobx-react-lite": "^4.1.0",
30
+ "react-error-boundary": "^6.0.0",
31
+ "typescript": "5.6.3"
32
+ },
33
+ "devDependencies": {
34
+ "@babel/core": "7.25.2",
35
+ "@babel/preset-env": "7.25.4",
36
+ "@babel/preset-react": "7.24.7",
37
+ "@babel/preset-typescript": "7.25.9",
38
+ "@eslint/js": "^9.20.0",
39
+ "@testing-library/dom": "10.4.0",
40
+ "@testing-library/jest-dom": "6.6.2",
41
+ "@testing-library/react": "16.0.1",
42
+ "@types/jest": "29.5.14",
43
+ "@types/react-test-renderer": "18",
44
+ "@webex/test-fixtures": "0.0.0-next.1",
45
+ "babel-jest": "29.7.0",
46
+ "babel-loader": "9.2.1",
47
+ "eslint": "^9.20.1",
48
+ "eslint-config-prettier": "^10.0.1",
49
+ "eslint-config-standard": "^17.1.0",
50
+ "eslint-plugin-import": "^2.25.2",
51
+ "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
52
+ "eslint-plugin-prettier": "^5.2.3",
53
+ "eslint-plugin-promise": "^6.0.0",
54
+ "eslint-plugin-react": "^7.37.4",
55
+ "file-loader": "6.2.0",
56
+ "globals": "^16.0.0",
57
+ "jest": "29.7.0",
58
+ "jest-environment-jsdom": "29.7.0",
59
+ "prettier": "^3.5.1",
60
+ "ts-loader": "9.5.1",
61
+ "typescript-eslint": "^8.24.1",
62
+ "webpack": "5.94.0",
63
+ "webpack-cli": "5.1.4",
64
+ "webpack-merge": "6.0.1"
65
+ },
66
+ "peerDependencies": {
67
+ "react": ">=18.3.1",
68
+ "react-dom": ">=18.3.1"
69
+ }
70
+ }