@appilots/web-sdk 0.2.0

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/index.js ADDED
@@ -0,0 +1,234 @@
1
+ 'use strict';
2
+
3
+ var chunkT5TUFZ6T_js = require('./chunk-T5TUFZ6T.js');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "APPILOTS_CHAT_ATTR", {
8
+ enumerable: true,
9
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_CHAT_ATTR; }
10
+ });
11
+ Object.defineProperty(exports, "APPILOTS_ID_ATTR", {
12
+ enumerable: true,
13
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_ID_ATTR; }
14
+ });
15
+ Object.defineProperty(exports, "APPILOTS_ITEM_COUNT_ATTR", {
16
+ enumerable: true,
17
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_ITEM_COUNT_ATTR; }
18
+ });
19
+ Object.defineProperty(exports, "APPILOTS_ITEM_INDEX_ATTR", {
20
+ enumerable: true,
21
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_ITEM_INDEX_ATTR; }
22
+ });
23
+ Object.defineProperty(exports, "APPILOTS_ITEM_KEY_ATTR", {
24
+ enumerable: true,
25
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_ITEM_KEY_ATTR; }
26
+ });
27
+ Object.defineProperty(exports, "APPILOTS_LIST_ID_ATTR", {
28
+ enumerable: true,
29
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_LIST_ID_ATTR; }
30
+ });
31
+ Object.defineProperty(exports, "APPILOTS_LIST_ITEM_ATTR", {
32
+ enumerable: true,
33
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_LIST_ITEM_ATTR; }
34
+ });
35
+ Object.defineProperty(exports, "APPILOTS_SENSITIVE_ATTR", {
36
+ enumerable: true,
37
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_SENSITIVE_ATTR; }
38
+ });
39
+ Object.defineProperty(exports, "APPILOTS_SKIP_ATTR", {
40
+ enumerable: true,
41
+ get: function () { return chunkT5TUFZ6T_js.APPILOTS_SKIP_ATTR; }
42
+ });
43
+ Object.defineProperty(exports, "ActionQueueMachine", {
44
+ enumerable: true,
45
+ get: function () { return chunkT5TUFZ6T_js.ActionQueueMachine; }
46
+ });
47
+ Object.defineProperty(exports, "AppilotsClient", {
48
+ enumerable: true,
49
+ get: function () { return chunkT5TUFZ6T_js.AppilotsClient; }
50
+ });
51
+ Object.defineProperty(exports, "AppilotsWebRuntime", {
52
+ enumerable: true,
53
+ get: function () { return chunkT5TUFZ6T_js.AppilotsWebRuntime; }
54
+ });
55
+ Object.defineProperty(exports, "ChatSessionMachine", {
56
+ enumerable: true,
57
+ get: function () { return chunkT5TUFZ6T_js.ChatSessionMachine; }
58
+ });
59
+ Object.defineProperty(exports, "RateLimitedError", {
60
+ enumerable: true,
61
+ get: function () { return chunkT5TUFZ6T_js.RateLimitedError; }
62
+ });
63
+ Object.defineProperty(exports, "SDK_VERSION", {
64
+ enumerable: true,
65
+ get: function () { return chunkT5TUFZ6T_js.SDK_VERSION; }
66
+ });
67
+ Object.defineProperty(exports, "WebNavigationAdapter", {
68
+ enumerable: true,
69
+ get: function () { return chunkT5TUFZ6T_js.WebNavigationAdapter; }
70
+ });
71
+ Object.defineProperty(exports, "accessibleName", {
72
+ enumerable: true,
73
+ get: function () { return chunkT5TUFZ6T_js.accessibleName; }
74
+ });
75
+ Object.defineProperty(exports, "bestId", {
76
+ enumerable: true,
77
+ get: function () { return chunkT5TUFZ6T_js.bestId; }
78
+ });
79
+ Object.defineProperty(exports, "buildPath", {
80
+ enumerable: true,
81
+ get: function () { return chunkT5TUFZ6T_js.buildPath; }
82
+ });
83
+ Object.defineProperty(exports, "candidateIds", {
84
+ enumerable: true,
85
+ get: function () { return chunkT5TUFZ6T_js.candidateIds; }
86
+ });
87
+ Object.defineProperty(exports, "captureSnapshot", {
88
+ enumerable: true,
89
+ get: function () { return chunkT5TUFZ6T_js.captureSnapshot; }
90
+ });
91
+ Object.defineProperty(exports, "clickElement", {
92
+ enumerable: true,
93
+ get: function () { return chunkT5TUFZ6T_js.clickElement; }
94
+ });
95
+ Object.defineProperty(exports, "describeAction", {
96
+ enumerable: true,
97
+ get: function () { return chunkT5TUFZ6T_js.describeAction; }
98
+ });
99
+ Object.defineProperty(exports, "elementRole", {
100
+ enumerable: true,
101
+ get: function () { return chunkT5TUFZ6T_js.elementRole; }
102
+ });
103
+ Object.defineProperty(exports, "executeAction", {
104
+ enumerable: true,
105
+ get: function () { return chunkT5TUFZ6T_js.executeAction; }
106
+ });
107
+ Object.defineProperty(exports, "findListItemElements", {
108
+ enumerable: true,
109
+ get: function () { return chunkT5TUFZ6T_js.findListItemElements; }
110
+ });
111
+ Object.defineProperty(exports, "findScrollContainer", {
112
+ enumerable: true,
113
+ get: function () { return chunkT5TUFZ6T_js.findScrollContainer; }
114
+ });
115
+ Object.defineProperty(exports, "focusElement", {
116
+ enumerable: true,
117
+ get: function () { return chunkT5TUFZ6T_js.focusElement; }
118
+ });
119
+ Object.defineProperty(exports, "getRegisteredElement", {
120
+ enumerable: true,
121
+ get: function () { return chunkT5TUFZ6T_js.getRegisteredElement; }
122
+ });
123
+ Object.defineProperty(exports, "hidesSubtree", {
124
+ enumerable: true,
125
+ get: function () { return chunkT5TUFZ6T_js.hidesSubtree; }
126
+ });
127
+ Object.defineProperty(exports, "humanizeError", {
128
+ enumerable: true,
129
+ get: function () { return chunkT5TUFZ6T_js.humanizeError; }
130
+ });
131
+ Object.defineProperty(exports, "isOccludedByModal", {
132
+ enumerable: true,
133
+ get: function () { return chunkT5TUFZ6T_js.isOccludedByModal; }
134
+ });
135
+ Object.defineProperty(exports, "isVisible", {
136
+ enumerable: true,
137
+ get: function () { return chunkT5TUFZ6T_js.isVisible; }
138
+ });
139
+ Object.defineProperty(exports, "longPressElement", {
140
+ enumerable: true,
141
+ get: function () { return chunkT5TUFZ6T_js.longPressElement; }
142
+ });
143
+ Object.defineProperty(exports, "matchRoute", {
144
+ enumerable: true,
145
+ get: function () { return chunkT5TUFZ6T_js.matchRoute; }
146
+ });
147
+ Object.defineProperty(exports, "modalCandidateLabels", {
148
+ enumerable: true,
149
+ get: function () { return chunkT5TUFZ6T_js.modalCandidateLabels; }
150
+ });
151
+ Object.defineProperty(exports, "normalizeLabelToId", {
152
+ enumerable: true,
153
+ get: function () { return chunkT5TUFZ6T_js.normalizeLabelToId; }
154
+ });
155
+ Object.defineProperty(exports, "parseSyntheticListItemId", {
156
+ enumerable: true,
157
+ get: function () { return chunkT5TUFZ6T_js.parseSyntheticListItemId; }
158
+ });
159
+ Object.defineProperty(exports, "primaryControlOf", {
160
+ enumerable: true,
161
+ get: function () { return chunkT5TUFZ6T_js.primaryControlOf; }
162
+ });
163
+ Object.defineProperty(exports, "probeLoadingState", {
164
+ enumerable: true,
165
+ get: function () { return chunkT5TUFZ6T_js.probeLoadingState; }
166
+ });
167
+ Object.defineProperty(exports, "readControlValue", {
168
+ enumerable: true,
169
+ get: function () { return chunkT5TUFZ6T_js.readControlValue; }
170
+ });
171
+ Object.defineProperty(exports, "readOwnText", {
172
+ enumerable: true,
173
+ get: function () { return chunkT5TUFZ6T_js.readOwnText; }
174
+ });
175
+ Object.defineProperty(exports, "readScrollMetrics", {
176
+ enumerable: true,
177
+ get: function () { return chunkT5TUFZ6T_js.readScrollMetrics; }
178
+ });
179
+ Object.defineProperty(exports, "readToggleValue", {
180
+ enumerable: true,
181
+ get: function () { return chunkT5TUFZ6T_js.readToggleValue; }
182
+ });
183
+ Object.defineProperty(exports, "registeredElements", {
184
+ enumerable: true,
185
+ get: function () { return chunkT5TUFZ6T_js.registeredElements; }
186
+ });
187
+ Object.defineProperty(exports, "resolveListItem", {
188
+ enumerable: true,
189
+ get: function () { return chunkT5TUFZ6T_js.resolveListItem; }
190
+ });
191
+ Object.defineProperty(exports, "resolveTargetElement", {
192
+ enumerable: true,
193
+ get: function () { return chunkT5TUFZ6T_js.resolveTargetElement; }
194
+ });
195
+ Object.defineProperty(exports, "routesBelongToSameFeature", {
196
+ enumerable: true,
197
+ get: function () { return chunkT5TUFZ6T_js.routesBelongToSameFeature; }
198
+ });
199
+ Object.defineProperty(exports, "screenDepartedBaseline", {
200
+ enumerable: true,
201
+ get: function () { return chunkT5TUFZ6T_js.screenDepartedBaseline; }
202
+ });
203
+ Object.defineProperty(exports, "scrollIntoView", {
204
+ enumerable: true,
205
+ get: function () { return chunkT5TUFZ6T_js.scrollIntoView; }
206
+ });
207
+ Object.defineProperty(exports, "scrollToOffset", {
208
+ enumerable: true,
209
+ get: function () { return chunkT5TUFZ6T_js.scrollToOffset; }
210
+ });
211
+ Object.defineProperty(exports, "setControlValue", {
212
+ enumerable: true,
213
+ get: function () { return chunkT5TUFZ6T_js.setControlValue; }
214
+ });
215
+ Object.defineProperty(exports, "setToggleValue", {
216
+ enumerable: true,
217
+ get: function () { return chunkT5TUFZ6T_js.setToggleValue; }
218
+ });
219
+ Object.defineProperty(exports, "stripComponentPrefix", {
220
+ enumerable: true,
221
+ get: function () { return chunkT5TUFZ6T_js.stripComponentPrefix; }
222
+ });
223
+ Object.defineProperty(exports, "waitForLoadingSettle", {
224
+ enumerable: true,
225
+ get: function () { return chunkT5TUFZ6T_js.waitForLoadingSettle; }
226
+ });
227
+ Object.defineProperty(exports, "waitForScreenSettle", {
228
+ enumerable: true,
229
+ get: function () { return chunkT5TUFZ6T_js.waitForScreenSettle; }
230
+ });
231
+ Object.defineProperty(exports, "walkDom", {
232
+ enumerable: true,
233
+ get: function () { return chunkT5TUFZ6T_js.walkDom; }
234
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { APPILOTS_CHAT_ATTR, APPILOTS_ID_ATTR, APPILOTS_ITEM_COUNT_ATTR, APPILOTS_ITEM_INDEX_ATTR, APPILOTS_ITEM_KEY_ATTR, APPILOTS_LIST_ID_ATTR, APPILOTS_LIST_ITEM_ATTR, APPILOTS_SENSITIVE_ATTR, APPILOTS_SKIP_ATTR, ActionQueueMachine, AppilotsClient, AppilotsWebRuntime, ChatSessionMachine, RateLimitedError, SDK_VERSION, WebNavigationAdapter, accessibleName, bestId, buildPath, candidateIds, captureSnapshot, clickElement, describeAction, elementRole, executeAction, findListItemElements, findScrollContainer, focusElement, getRegisteredElement, hidesSubtree, humanizeError, isOccludedByModal, isVisible, longPressElement, matchRoute, modalCandidateLabels, normalizeLabelToId, parseSyntheticListItemId, primaryControlOf, probeLoadingState, readControlValue, readOwnText, readScrollMetrics, readToggleValue, registeredElements, resolveListItem, resolveTargetElement, routesBelongToSameFeature, screenDepartedBaseline, scrollIntoView, scrollToOffset, setControlValue, setToggleValue, stripComponentPrefix, waitForLoadingSettle, waitForScreenSettle, walkDom } from './chunk-VHRE4RUO.mjs';
@@ -0,0 +1,84 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, CSSProperties } from 'react';
4
+ import { k as AppilotsWebRuntimeOptions, j as AppilotsWebRuntime, A as AgentAction, l as ChatMessage, E as EscalationState, n as ChatSessionOptions } from '../AppilotsWebRuntime-DZF26UyU.mjs';
5
+ export { t as WebScreenMetadata } from '../AppilotsWebRuntime-DZF26UyU.mjs';
6
+
7
+ /**
8
+ * Either build the runtime from config, or hand in one you already
9
+ * built. Injecting a runtime must not require repeating its config, so
10
+ * `projectId` is only mandatory in the first form.
11
+ */
12
+ type AppilotsWebProviderProps = (AppilotsWebRuntimeOptions & {
13
+ children: ReactNode;
14
+ runtime?: undefined;
15
+ }) | (Partial<AppilotsWebRuntimeOptions> & {
16
+ children: ReactNode;
17
+ /** An already-built runtime (tests, or a non-React owner). */
18
+ runtime: AppilotsWebRuntime;
19
+ });
20
+ /**
21
+ * Provides an `AppilotsWebRuntime` to the tree. The runtime itself is
22
+ * framework-agnostic — this is only the plumbing that hands it to
23
+ * hooks and keeps its mutable configuration (routes, navigate,
24
+ * permissions) current across renders.
25
+ */
26
+ declare function AppilotsWebProvider(props: AppilotsWebProviderProps): react_jsx_runtime.JSX.Element;
27
+ declare function useAppilotsRuntime(): AppilotsWebRuntime;
28
+
29
+ interface UseAppilotsChatReturn {
30
+ messages: ChatMessage[];
31
+ isLoading: boolean;
32
+ loadingStatusKey: 'thinking' | 'statusAnalyzing' | 'statusWaitingApp' | 'statusAdjusting';
33
+ error: string | null;
34
+ pendingActions: AgentAction[];
35
+ escalation: EscalationState | null;
36
+ requestHuman: (reason?: 'user_requested' | 'agent_gave_up') => Promise<void>;
37
+ sendMessage: (content: string) => Promise<void>;
38
+ cancelMessage: () => void;
39
+ clearMessages: () => void;
40
+ clearError: () => void;
41
+ }
42
+ /**
43
+ * React binding for the chat loop. Same surface as the React Native
44
+ * SDK's hook of the same name, because both are thin views over the
45
+ * same `ChatSessionMachine`.
46
+ */
47
+ declare function useAppilotsChat(options?: ChatSessionOptions): UseAppilotsChatReturn;
48
+ interface UseAppilotsActionsReturn {
49
+ pendingActions: AgentAction[];
50
+ executingActions: AgentAction[];
51
+ completedActions: AgentAction[];
52
+ approveAction: (actionId: string) => Promise<boolean>;
53
+ rejectAction: (actionId: string) => Promise<void>;
54
+ }
55
+ /**
56
+ * React binding for the action queue — the confirm cards a chat UI
57
+ * renders read their state from here.
58
+ */
59
+ declare function useAppilotsActions(): UseAppilotsActionsReturn;
60
+
61
+ interface AppilotsChatProps {
62
+ title?: string;
63
+ placeholder?: string;
64
+ locale?: 'en' | 'pt-BR';
65
+ /** Empty-state prompts prefill the composer; sending remains a user action. */
66
+ suggestedPrompts?: string[];
67
+ style?: CSSProperties;
68
+ /** Optional close control for a host-provided panel. */
69
+ onClose?: () => void;
70
+ }
71
+ /** Chat controls use the same session and human-support channel as the mobile SDK. */
72
+ declare function AppilotsChat({ title, placeholder, locale, suggestedPrompts, style, onClose, }: AppilotsChatProps): react_jsx_runtime.JSX.Element;
73
+
74
+ interface AppilotsChatFabProps extends Omit<AppilotsChatProps, 'onClose'> {
75
+ position?: 'bottom-right' | 'bottom-left';
76
+ defaultOpen?: boolean;
77
+ accentColor?: string;
78
+ /** Place the widget below the host app's blocking dialogs. Defaults to 1000. */
79
+ zIndex?: number;
80
+ }
81
+ /** Floating launcher and chat panel. Closing only hides the UI; the session stays alive. */
82
+ declare function AppilotsChatFab({ position, defaultOpen, accentColor, zIndex, locale, style, ...chatProps }: AppilotsChatFabProps): react.ReactPortal | null;
83
+
84
+ export { AppilotsChat, AppilotsChatFab, type AppilotsChatFabProps, type AppilotsChatProps, AppilotsWebProvider, type AppilotsWebProviderProps, AppilotsWebRuntime, AppilotsWebRuntimeOptions, type UseAppilotsActionsReturn, type UseAppilotsChatReturn, useAppilotsActions, useAppilotsChat, useAppilotsRuntime };
@@ -0,0 +1,84 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, CSSProperties } from 'react';
4
+ import { k as AppilotsWebRuntimeOptions, j as AppilotsWebRuntime, A as AgentAction, l as ChatMessage, E as EscalationState, n as ChatSessionOptions } from '../AppilotsWebRuntime-DZF26UyU.js';
5
+ export { t as WebScreenMetadata } from '../AppilotsWebRuntime-DZF26UyU.js';
6
+
7
+ /**
8
+ * Either build the runtime from config, or hand in one you already
9
+ * built. Injecting a runtime must not require repeating its config, so
10
+ * `projectId` is only mandatory in the first form.
11
+ */
12
+ type AppilotsWebProviderProps = (AppilotsWebRuntimeOptions & {
13
+ children: ReactNode;
14
+ runtime?: undefined;
15
+ }) | (Partial<AppilotsWebRuntimeOptions> & {
16
+ children: ReactNode;
17
+ /** An already-built runtime (tests, or a non-React owner). */
18
+ runtime: AppilotsWebRuntime;
19
+ });
20
+ /**
21
+ * Provides an `AppilotsWebRuntime` to the tree. The runtime itself is
22
+ * framework-agnostic — this is only the plumbing that hands it to
23
+ * hooks and keeps its mutable configuration (routes, navigate,
24
+ * permissions) current across renders.
25
+ */
26
+ declare function AppilotsWebProvider(props: AppilotsWebProviderProps): react_jsx_runtime.JSX.Element;
27
+ declare function useAppilotsRuntime(): AppilotsWebRuntime;
28
+
29
+ interface UseAppilotsChatReturn {
30
+ messages: ChatMessage[];
31
+ isLoading: boolean;
32
+ loadingStatusKey: 'thinking' | 'statusAnalyzing' | 'statusWaitingApp' | 'statusAdjusting';
33
+ error: string | null;
34
+ pendingActions: AgentAction[];
35
+ escalation: EscalationState | null;
36
+ requestHuman: (reason?: 'user_requested' | 'agent_gave_up') => Promise<void>;
37
+ sendMessage: (content: string) => Promise<void>;
38
+ cancelMessage: () => void;
39
+ clearMessages: () => void;
40
+ clearError: () => void;
41
+ }
42
+ /**
43
+ * React binding for the chat loop. Same surface as the React Native
44
+ * SDK's hook of the same name, because both are thin views over the
45
+ * same `ChatSessionMachine`.
46
+ */
47
+ declare function useAppilotsChat(options?: ChatSessionOptions): UseAppilotsChatReturn;
48
+ interface UseAppilotsActionsReturn {
49
+ pendingActions: AgentAction[];
50
+ executingActions: AgentAction[];
51
+ completedActions: AgentAction[];
52
+ approveAction: (actionId: string) => Promise<boolean>;
53
+ rejectAction: (actionId: string) => Promise<void>;
54
+ }
55
+ /**
56
+ * React binding for the action queue — the confirm cards a chat UI
57
+ * renders read their state from here.
58
+ */
59
+ declare function useAppilotsActions(): UseAppilotsActionsReturn;
60
+
61
+ interface AppilotsChatProps {
62
+ title?: string;
63
+ placeholder?: string;
64
+ locale?: 'en' | 'pt-BR';
65
+ /** Empty-state prompts prefill the composer; sending remains a user action. */
66
+ suggestedPrompts?: string[];
67
+ style?: CSSProperties;
68
+ /** Optional close control for a host-provided panel. */
69
+ onClose?: () => void;
70
+ }
71
+ /** Chat controls use the same session and human-support channel as the mobile SDK. */
72
+ declare function AppilotsChat({ title, placeholder, locale, suggestedPrompts, style, onClose, }: AppilotsChatProps): react_jsx_runtime.JSX.Element;
73
+
74
+ interface AppilotsChatFabProps extends Omit<AppilotsChatProps, 'onClose'> {
75
+ position?: 'bottom-right' | 'bottom-left';
76
+ defaultOpen?: boolean;
77
+ accentColor?: string;
78
+ /** Place the widget below the host app's blocking dialogs. Defaults to 1000. */
79
+ zIndex?: number;
80
+ }
81
+ /** Floating launcher and chat panel. Closing only hides the UI; the session stays alive. */
82
+ declare function AppilotsChatFab({ position, defaultOpen, accentColor, zIndex, locale, style, ...chatProps }: AppilotsChatFabProps): react.ReactPortal | null;
83
+
84
+ export { AppilotsChat, AppilotsChatFab, type AppilotsChatFabProps, type AppilotsChatProps, AppilotsWebProvider, type AppilotsWebProviderProps, AppilotsWebRuntime, AppilotsWebRuntimeOptions, type UseAppilotsActionsReturn, type UseAppilotsChatReturn, useAppilotsActions, useAppilotsChat, useAppilotsRuntime };