andy-widget-react 2.3.1 → 3.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 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/AndyChat.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react'\nimport { defineAndyChat, type AndyChatElement, type WidgetOverrides } from 'andy-widget-core'\nimport type { AndyChatProps, SalesAndyChatProps } from './types'\n\n/** The 2.x props that override the Agent's copy and look, as the element's `overrides`. */\nconst OVERRIDES = [\n\t'name',\n\t'headline',\n\t'description',\n\t'welcomeMessage',\n\t'predefinedQuestions',\n\t'theme',\n\t'orientation',\n\t'brandColor',\n\t'useBrandColor',\n\t'bubbleStyle',\n\t'bubbleLabel',\n\t'logoUrl'\n] as const satisfies ReadonlyArray<keyof WidgetOverrides & keyof SalesAndyChatProps>\n\nconst overridesOf = (props: SalesAndyChatProps): WidgetOverrides =>\n\tObject.fromEntries(OVERRIDES.filter(key => props[key] !== undefined).map(key => [key, props[key]]))\n\n/** Each deprecated prop logs one notice per page. */\nconst noticed = new Set<string>()\nconst notice = (prop: string, message: string) => {\n\tif (noticed.has(prop)) return\n\tnoticed.add(prop)\n\tconsole.warn(`AndyChat: ${message}`)\n}\n\n/**\n * The Andy Widget for React: one `<andy-chat>` element (`andy-widget-core`), whose Widget Mode comes from\n * identity. It shows Sales (`agentId`) to a Visitor and Support to a Requester with a valid pass, and starts a\n * fresh panel on every identity change; this component only hands the element its props. The 2.x props keep\n * working: `embedId` and `mode=\"support\"` as deprecated aliases, the copy and look overrides over the Agent's\n * config, and `previewMode`.\n */\nconst AndyChat: React.FC<AndyChatProps> = props => {\n\t// `mode=\"support\"` never showed Sales, so it keeps the Widget Support-only.\n\tconst sales = props.mode === 'support' ? undefined : props\n\tconst agentId = sales?.agentId ?? sales?.embedId\n\tconst { support, orientation, initialOpen = false } = props\n\tconst lang = props.lang ?? support?.lang\n\tconst supportAlias = !sales\n\tconst embedAlias = sales?.embedId !== undefined\n\tuseEffect(() => {\n\t\tif (supportAlias) notice('mode', '`mode=\"support\"` is deprecated. Pass `support` without `agentId`.')\n\t\tif (embedAlias) notice('embedId', '`embedId` is deprecated. Use `agentId`.')\n\t}, [supportAlias, embedAlias])\n\n\tconst host = useRef<HTMLDivElement>(null)\n\tconst [element, setElement] = useState<AndyChatElement | null>(null)\n\tconst pass = useRef(support?.getRequesterPass)\n\tpass.current = support?.getRequesterPass\n\tuseEffect(() => {\n\t\tdefineAndyChat()\n\t\tconst created = document.createElement('andy-chat')\n\t\tcreated.open = initialOpen\n\t\thost.current?.append(created)\n\t\tsetElement(created)\n\t\t// Removing the element ends its identity: pass, chat, requests and drafts go with it.\n\t\treturn () => created.remove()\n\t}, [])\n\tuseEffect(() => {\n\t\tif (lang) element?.setAttribute('lang', lang)\n\t\telse element?.removeAttribute('lang')\n\t}, [element, lang])\n\tconst overrides = sales ? overridesOf(sales) : {}\n\tconst overridesKey = JSON.stringify(overrides)\n\tconst preview = sales?.previewMode === true\n\tuseEffect(() => {\n\t\tif (!element) return\n\t\telement.overrides = overrides\n\t\telement.preview = preview\n\t\telement.agentId = agentId\n\t\t// The element compares installation, contextKey and API, so a new callback each render is not a new identity.\n\t\telement.support = support\n\t\t\t? { ...support, ...(lang ? { lang } : {}), ...(orientation ? { position: orientation } : {}), getRequesterPass: () => pass.current?.() }\n\t\t\t: null\n\t}, [element, agentId, support, lang, orientation, overridesKey, preview])\n\treturn <div ref={host} className='andy-widget-host' />\n}\n\nexport default AndyChat\n"],"names":["_jsx"],"mappings":";;;;;;AAIA;AACA,MAAM,SAAS,GAAG;IACjB,MAAM;IACN,UAAU;IACV,aAAa;IACb,gBAAgB;IAChB,qBAAqB;IACrB,OAAO;IACP,aAAa;IACb,YAAY;IACZ,eAAe;IACf,aAAa;IACb,aAAa;IACb;CACmF;AAEpF,MAAM,WAAW,GAAG,CAAC,KAAyB,KAC7C,MAAM,CAAC,WAAW,C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,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC,OAAO,IAAI;cACpI,IAAI;AACR,IAAA,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACzE,OAAOA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,IAAI,EAAE,SAAS,EAAC,kBAAkB,EAAA,CAAG;AACvD;;;;"}
@@ -1,4 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { AndyChatProps } from './types';
3
+ /**
4
+ * The Andy Widget for React: one `<andy-chat>` element (`andy-widget-core`), whose Widget Mode comes from
5
+ * identity. It shows Sales (`agentId`) to a Visitor and Support to a Requester with a valid pass, and starts a
6
+ * fresh panel on every identity change; this component only hands the element its props. The 2.x props keep
7
+ * working: `embedId` and `mode="support"` as deprecated aliases, the copy and look overrides over the Agent's
8
+ * config, and `previewMode`.
9
+ */
3
10
  declare const AndyChat: React.FC<AndyChatProps>;
4
11
  export default AndyChat;
@@ -1,13 +1,5 @@
1
1
  export { default as AndyChat } from './AndyChat';
2
2
  export { default as Andy } from './AndyChat';
3
- export { useAndyChat } from './hooks/useAndyChat';
4
- export { default as ChatBubble } from './components/ChatBubble';
5
- export { default as ChatWindow } from './components/ChatWindow';
6
- export { default as MessageList } from './components/MessageList';
7
- export { default as MessageInput } from './components/MessageInput';
8
- export { default as FAQ } from './components/FAQ';
9
- export { default as WelcomePopup } from './components/WelcomePopup';
10
- export { default as UserInfoForm } from './components/UserInfoForm';
11
- export type { AndyChatProps, SupportAndyChatProps, SalesAndyChatProps, ChatbotConfig, Message, FAQItem, PredefinedQuestion, WelcomePopupConfig, CollectUserInfoConfig, UserInfo, UseAndyChatReturn, ChatBubbleProps, ChatWindowProps, MessageListProps, MessageInputProps, FAQProps, WelcomePopupProps, UserInfoFormProps, FaqItemProps } from './types';
12
- export { theme, colors, typography, spacing, borderRadius, shadows, zIndex, animation, chat, generateSessionId, parseMarkdown, sanitizeUrl, isValidEmbedId, getEmbedId, getApiBaseUrl, setApiBaseUrl } from 'andy-widget-core';
13
3
  export { default } from './AndyChat';
4
+ export type { AndyChatProps, SalesAndyChatProps, SupportAndyChatProps, PredefinedQuestion } from './types';
5
+ export { getApiBaseUrl, setApiBaseUrl } from 'andy-widget-core';
@@ -1,193 +1,65 @@
1
- /**
2
- * Type definitions for andy-widget-react
3
- */
4
- export interface WelcomePopupConfig {
5
- enabled: boolean;
6
- seconds: number;
7
- message?: string;
8
- }
9
- export interface CollectUserInfoConfig {
10
- enabled: boolean;
11
- message?: string;
12
- }
1
+ import type { SupportOptions } from 'andy-widget-core';
2
+ /** A Starter as 2.x served them: the question and its place in the list. */
13
3
  export interface PredefinedQuestion {
14
4
  order: number;
15
5
  question: string;
16
6
  }
17
- export interface FAQItem {
18
- question: string;
19
- answer: string;
20
- }
21
- export interface ChatbotConfig {
22
- id: string | null;
23
- name: string;
24
- theme: 'light' | 'dark' | 'auto';
25
- logoUrl: string;
26
- headline: string;
27
- brandColor: string;
28
- description: string;
29
- orientation: 'left' | 'right';
30
- bubbleStyle: 'icon' | 'pill';
31
- bubbleLabel: string | null;
32
- useBrandColor: boolean;
33
- defaultLang: 'en' | 'es';
34
- showBranding: boolean;
35
- welcomeMessage: string;
36
- showWelcomePopup: WelcomePopupConfig;
37
- collectUserInfo: CollectUserInfoConfig;
38
- predefinedQuestions: PredefinedQuestion[];
39
- faqs: FAQItem[];
40
- bootstrap?: {
41
- convexUrl: string;
42
- surfaceKey: string;
43
- surfaceProof: string;
44
- surfaceProofExpiresAt: number;
45
- };
46
- }
47
- export interface Message {
48
- id: string | number;
49
- content: string;
50
- sender: 'user' | 'bot';
51
- timestamp: string;
52
- isForm?: boolean;
53
- isLoading?: boolean;
54
- isError?: boolean;
55
- isHuman?: boolean;
56
- isWaiting?: boolean;
57
- isStreaming?: boolean;
58
- }
59
- export interface UserInfo {
60
- name: string;
61
- email: string;
62
- }
7
+ /**
8
+ * `AndyChat`'s props. Widget Mode comes from identity: `agentId` is the Sales Agent for anonymous Visitors,
9
+ * and `support` gives a signed-in Requester Support Mode once `getRequesterPass` hands over a pass. With
10
+ * `support` and no `agentId`, nothing shows until a Requester is verified. The copy and look overrides
11
+ * (`name` to `logoUrl`) replace the Agent's own in Sales Mode; `previewMode` draws them with no config fetched.
12
+ */
63
13
  export interface SalesAndyChatProps {
64
14
  mode?: 'sales';
65
- /** Required chatbot embed ID (not required if previewMode is true) */
15
+ /** The Sales Agent, shown to anonymous Visitors. */
16
+ agentId?: string;
17
+ /**
18
+ * Support Mode for a signed-in Requester. Change `contextKey` on sign-in, sign-out and every user,
19
+ * workspace or organization switch; `getRequesterPass` returns `null` while nobody is signed in.
20
+ */
21
+ support?: SupportOptions;
22
+ /** @deprecated Use `agentId`. */
66
23
  embedId?: string;
67
- /** Optional tooltip text for the chat bubble */
24
+ /** @deprecated The 3.x Launcher has no tooltip; its accessible name says what it opens. */
68
25
  tooltip?: string;
69
- /** Optional bot name (overrides API value) */
26
+ /** The Agent's name, over the configured one. */
70
27
  name?: string;
71
- /** Optional headline/subtitle (overrides API value) */
28
+ /** The status line under the name. */
72
29
  headline?: string;
73
- /** Optional description (overrides API value) */
74
30
  description?: string;
75
- /** Optional welcome message (overrides API value) */
31
+ /** The Greeting. */
76
32
  welcomeMessage?: string;
77
- /** Optional custom label for pill-style bubble (overrides default) */
33
+ /** The pill Launcher's label. */
78
34
  bubbleLabel?: string;
79
- /** Optional UI language for the widget's own chrome, overrides the Agent's defaultLang */
35
+ /** The Widget's language, over the host page's `<html lang>` and the Agent's `defaultLang`. */
80
36
  lang?: 'en' | 'es';
81
- /** Optional starter questions (overrides API value) */
37
+ /** The Starters. */
82
38
  predefinedQuestions?: PredefinedQuestion[];
83
- /** Optional theme ('light' | 'dark' | 'auto') */
84
39
  theme?: 'light' | 'dark' | 'auto';
85
- /** Optional position ('left' | 'right') */
40
+ /** The Launcher's side of the page. */
86
41
  orientation?: 'left' | 'right';
87
- /** Optional brand color hex (e.g., '#3B82F6') */
42
+ /** The accent, as `#RRGGBB`. */
88
43
  brandColor?: string;
89
- /** Optional bubble style ('icon' | 'pill') */
90
44
  bubbleStyle?: 'icon' | 'pill';
91
- /** Optional whether to use brand color */
45
+ /** `false` uses the neutral accent instead of `brandColor`. */
92
46
  useBrandColor?: boolean;
93
- /** Optional logo URL */
47
+ /** The avatar, also shown on the Launcher. */
94
48
  logoUrl?: string;
95
- /** If true, skip API fetch and use props directly as config */
49
+ /** Draws the overrides with no config fetched (a Widget Preview). Messages still reach `agentId`. */
96
50
  previewMode?: boolean;
97
- /** If true, start with chat window open */
51
+ /** Starts with the panel open. */
98
52
  initialOpen?: boolean;
99
53
  }
54
+ /** The 2.x Support-only props. */
100
55
  export interface SupportAndyChatProps {
56
+ /** @deprecated Pass `support` without `agentId`. */
101
57
  mode: 'support';
102
- support: import('andy-widget-core').SupportOptions;
58
+ support: SupportOptions;
103
59
  lang?: 'es' | 'en';
104
60
  orientation?: 'left' | 'right';
105
61
  initialOpen?: boolean;
62
+ /** @deprecated The 3.x Launcher has no tooltip; its accessible name says what it opens. */
106
63
  tooltip?: string;
107
64
  }
108
65
  export type AndyChatProps = SalesAndyChatProps | SupportAndyChatProps;
109
- export interface FaqItemProps {
110
- question: string;
111
- answer: string;
112
- }
113
- export interface ChatBubbleProps {
114
- isOpen: boolean;
115
- onClick: () => void;
116
- tooltip?: string;
117
- logoUrl?: string;
118
- bubbleStyle?: 'icon' | 'pill';
119
- bubbleLabel?: string;
120
- theme?: 'light' | 'dark' | 'auto';
121
- useBrandColor?: boolean;
122
- }
123
- export interface ChatWindowProps {
124
- isOpen: boolean;
125
- config: ChatbotConfig | null;
126
- messages: Message[];
127
- isLoading: boolean;
128
- showPredefinedQuestions: boolean;
129
- isCollectingUserInfo: boolean;
130
- onClose: () => void;
131
- onSendMessage: (message: string) => void;
132
- onPredefinedQuestion: (question: string) => void;
133
- onUserInfoSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
134
- }
135
- export interface MessageListProps {
136
- messages: Message[];
137
- config: ChatbotConfig | null;
138
- isLoading: boolean;
139
- isCollectingUserInfo: boolean;
140
- onUserInfoSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
141
- }
142
- export interface MessageInputProps {
143
- onSendMessage: (message: string) => void;
144
- disabled?: boolean;
145
- placeholder?: string;
146
- }
147
- export interface FAQProps {
148
- faqs: FAQItem[];
149
- onBack: () => void;
150
- }
151
- export interface WelcomePopupProps {
152
- message: string;
153
- orientation?: 'left' | 'right';
154
- onClose: () => void;
155
- }
156
- export interface UserInfoFormProps {
157
- message?: string;
158
- onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
159
- }
160
- export interface UseAndyChatReturn {
161
- config: Partial<ChatbotConfig>;
162
- isLoading: boolean;
163
- isOpen: boolean;
164
- showingFaq: boolean;
165
- showingWelcomePopup: boolean;
166
- showingUserInfoForm: boolean;
167
- messages: Message[];
168
- userInfoCollected: boolean;
169
- sessionId: string;
170
- error: string | null;
171
- initializeChatbot: () => Promise<void>;
172
- toggleChat: () => void;
173
- sendMessage: (messageText: string) => Promise<unknown>;
174
- showFaq: () => void;
175
- hideFaq: () => void;
176
- showWelcomePopup: () => void;
177
- hideWelcomePopup: () => void;
178
- showUserInfoForm: () => void;
179
- hideUserInfoForm: () => void;
180
- submitUserInfo: (userInfo: UserInfo) => Promise<void>;
181
- startNewSession: () => void;
182
- addMessage: (message: Message) => void;
183
- }
184
- export interface StylesheetOptions {
185
- color?: string;
186
- useBrandColor?: boolean;
187
- theme?: 'light' | 'dark' | 'auto';
188
- orientation?: 'left' | 'right';
189
- }
190
- export interface HostClassOptions {
191
- theme?: 'light' | 'dark' | 'auto';
192
- orientation?: 'left' | 'right';
193
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "andy-widget-react",
3
- "version": "2.3.1",
4
- "description": "Official React Widget for embeddable Andy agents",
3
+ "version": "3.0.0-next.1",
4
+ "description": "The Andy Widget for React: a typed wrapper over <andy-chat>",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.esm.js",
@@ -15,7 +15,6 @@
15
15
  },
16
16
  "files": [
17
17
  "dist/**/*",
18
- "src/**/*",
19
18
  "README.md"
20
19
  ],
21
20
  "scripts": {
@@ -46,19 +45,13 @@
46
45
  "access": "public"
47
46
  },
48
47
  "devDependencies": {
49
- "@babel/core": "^7.27.3",
50
- "@babel/preset-react": "^7.27.1",
51
- "@rollup/plugin-babel": "^6.0.4",
52
- "@rollup/plugin-commonjs": "^28.0.3",
53
48
  "@rollup/plugin-node-resolve": "^16.0.1",
54
49
  "@rollup/plugin-typescript": "^12.3.0",
55
- "@rollup/plugin-url": "^8.0.2",
56
50
  "@types/react": "^19.1.2",
57
51
  "@types/react-dom": "^19.1.2",
58
52
  "react": "^19.0.0",
59
53
  "react-dom": "^19.0.0",
60
54
  "rollup": "^4.41.1",
61
- "rollup-plugin-postcss": "^4.0.2",
62
55
  "tslib": "^2.8.1",
63
56
  "typescript": "^5.9.3"
64
57
  },
@@ -67,6 +60,6 @@
67
60
  "react-dom": "^18.0.0 || ^19.0.0"
68
61
  },
69
62
  "dependencies": {
70
- "andy-widget-core": "2.3.1"
63
+ "andy-widget-core": "3.0.0-next.1"
71
64
  }
72
65
  }
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import type { SupportAndyChatProps } from './types';
3
- /** A host identity change also destroys local drafts and menu state before the next render. */
4
- export declare const SupportChat: React.FC<SupportAndyChatProps>;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { ChatbotConfig } from '../types';
3
- interface ChatBubbleProps {
4
- isOpen: boolean;
5
- config: ChatbotConfig | null;
6
- onClick: () => void;
7
- }
8
- declare const ChatBubble: React.FC<ChatBubbleProps>;
9
- export default ChatBubble;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { ChatbotConfig, Message } from '../types';
3
- interface ChatWindowProps {
4
- config: ChatbotConfig | null;
5
- messages: Message[];
6
- isLoading: boolean;
7
- onClose: () => void;
8
- onSendMessage: (message: string) => Promise<void> | void;
9
- }
10
- declare const ChatWindow: React.FC<ChatWindowProps>;
11
- export default ChatWindow;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { FAQItem } from '../types';
3
- interface FAQProps {
4
- faqs?: FAQItem[];
5
- onBack: () => void;
6
- }
7
- declare const FAQ: React.FC<FAQProps>;
8
- export default FAQ;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface MessageInputProps {
3
- onSendMessage: (message: string) => Promise<void> | void;
4
- disabled?: boolean;
5
- placeholder?: string;
6
- }
7
- declare const MessageInput: React.FC<MessageInputProps>;
8
- export default MessageInput;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { Message } from '../types';
3
- interface MessageListProps {
4
- messages: Message[];
5
- isLoading: boolean;
6
- logoUrl?: string;
7
- botName?: string;
8
- }
9
- declare const MessageList: React.FC<MessageListProps>;
10
- export default MessageList;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { UserInfo } from '../types';
3
- interface UserInfoFormProps {
4
- headerText?: string;
5
- brandColor?: string;
6
- onSubmit: (data: UserInfo) => Promise<void> | void;
7
- onClose: () => void;
8
- }
9
- declare const UserInfoForm: React.FC<UserInfoFormProps>;
10
- export default UserInfoForm;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface WelcomePopupProps {
3
- message: string;
4
- brandColor?: string;
5
- onClose: () => void;
6
- }
7
- declare const WelcomePopup: React.FC<WelcomePopupProps>;
8
- export default WelcomePopup;
@@ -1 +0,0 @@
1
- export { useAndyChat } from './useAndyChat';
@@ -1,8 +0,0 @@
1
- import type { UseAndyChatReturn } from '../types';
2
- import type { SupportOptions } from 'andy-widget-core';
3
- import { useSupportChat } from './useSupportChat';
4
- export declare function useAndyChat(embedId: string): UseAndyChatReturn;
5
- export declare function useAndyChat(options: {
6
- mode: 'support';
7
- support: SupportOptions;
8
- }): ReturnType<typeof useSupportChat>;
@@ -1,24 +0,0 @@
1
- import { type SupportOptions, type SupportState } from 'andy-widget-core';
2
- /** The host context key changes before a new user/company is allowed to see any previous state. */
3
- export declare const useSupportChat: (options: SupportOptions | null) => {
4
- mode: "support";
5
- state: SupportState;
6
- controller: {
7
- getSnapshot: () => SupportState;
8
- subscribe: (listener: () => void) => () => void;
9
- bootstrap: () => Promise<unknown>;
10
- send: (content: string) => Promise<unknown>;
11
- escalate: () => void;
12
- submit: (subject: string, body: string, replyLanguage?: "es" | "en") => Promise<unknown>;
13
- showRequests: () => Promise<unknown>;
14
- inspect: (ticketId: string) => Promise<unknown>;
15
- reply: (body: string, reopen?: boolean) => Promise<unknown>;
16
- newProblem: () => void;
17
- refresh: () => Promise<unknown>;
18
- setVisible: (visible: boolean) => void;
19
- setLanguage: (lang?: "es" | "en") => void;
20
- newConversation: () => void;
21
- back: () => void;
22
- dispose: () => void;
23
- } | null;
24
- };