@vinaverse/react-native 0.1.0-alpha.10 → 0.1.0-alpha.12
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/README.md +25 -1
- package/dist/chat.cjs +118 -117
- package/dist/chat.d.cts +7 -205
- package/dist/chat.d.ts +7 -205
- package/dist/chat.js +2 -1
- package/dist/chunk-2J2LIJLW.js +624 -0
- package/dist/chunk-2J2LIJLW.js.map +1 -0
- package/dist/chunk-4PXQ7DEY.cjs +680 -0
- package/dist/chunk-4PXQ7DEY.cjs.map +1 -0
- package/dist/{chunk-43I4ZAEK.js → chunk-KSHDF3MG.js} +13 -624
- package/dist/chunk-KSHDF3MG.js.map +1 -0
- package/dist/{chunk-NRYNK7E4.cjs → chunk-XAG2P447.cjs} +11 -675
- package/dist/chunk-XAG2P447.cjs.map +1 -0
- package/dist/context-gHCLFsJh.d.cts +212 -0
- package/dist/context-gHCLFsJh.d.ts +212 -0
- package/dist/history.cjs +673 -0
- package/dist/history.cjs.map +1 -0
- package/dist/history.d.cts +177 -0
- package/dist/history.d.ts +177 -0
- package/dist/history.js +618 -0
- package/dist/history.js.map +1 -0
- package/dist/index.cjs +133 -132
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/package.json +79 -10
- package/dist/chunk-43I4ZAEK.js.map +0 -1
- package/dist/chunk-NRYNK7E4.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ import { createAgentRuntime } from '@vinaverse/client/agent';
|
|
|
44
44
|
import { AgentChat, CardCarousel } from '@vinaverse/react-native/chat';
|
|
45
45
|
import { AgentLauncher, AgentRuntimeProvider } from '@vinaverse/react-native/launcher';
|
|
46
46
|
import { AskAboutRow } from '@vinaverse/react-native/ask';
|
|
47
|
+
import { AgentHistoryList, AgentTranscript } from '@vinaverse/react-native/history'; // the history screens
|
|
47
48
|
|
|
48
49
|
const agent = createAgentRuntime({ backend: { openSession, refreshSecret, status }, conversation: { locale } });
|
|
49
50
|
const components = { CardGroup: CardCarousel, Image: ExpoImage }; // module level: stable
|
|
@@ -103,9 +104,32 @@ const imagePolicy = { hosts: ['images.example.com'], aspectRatio: 1.6, Placehold
|
|
|
103
104
|
- **Policies and adapters:** `imagePolicy` (photo hosts, frame, the stand-in for a missing photo, given the card's `title` and `kind`) applies to every card
|
|
104
105
|
and every fetch ahead; `announce` reads finished replies and the greeting your way; `onChip` hears a tapped chip.
|
|
105
106
|
Card renderers get the card read once (`read`). A listing with no rating draws `copy.ratingNone` in the rating's place (empty by default; "New", say).
|
|
107
|
+
- **History** (`@vinaverse/react-native/history` only, never `.`, so an app without a history screen ships none
|
|
108
|
+
of it): `AgentHistoryList` lists the person's past conversations, newest activity first, a page at a time as
|
|
109
|
+
they scroll (title, when, how many messages, whether it ended); a row opens (`onOpen`: show `AgentTranscript`), an
|
|
110
|
+
open one continues (`onContinue(conversation, live)`: pinned under its own key, `useAgentHistory().keyOf`, show
|
|
111
|
+
`AgentChat` with it), and deletes after the person confirms (`confirmDelete`, default the platform's alert with the
|
|
112
|
+
copy's words; a refused delete is said on the row and through `onWarning`). `AgentTranscript` reads one back, the
|
|
113
|
+
newest page first and earlier pages above (a button, and the top of the list), drawn with the chat's own bubbles and
|
|
114
|
+
cards over a read-only store, so a restored card takes nothing (no proposal confirmed, no link opened, no answer),
|
|
115
|
+
a guardrail's refusal reads as it did live ("Not answered" under the person's message) and a proposal shows the
|
|
116
|
+
outcome it had; `agentKey` + `onContinue` add "Continue", except for a conversation that `ended` (pass the row's
|
|
117
|
+
`state === 'ended'`, as the list offers Continue only for an open one). Slots: `Row`, `Empty`, `Failure`, `ListComponent` on the
|
|
118
|
+
list; `Header`, `Failure`, `ListComponent`, `MessageBubble`, `Image`, `CardGroup` and `cards` on the transcript.
|
|
119
|
+
Both show when the status offers history (`useAgentFeatures().history`); your backend serves the two routes
|
|
120
|
+
(`backendRoutes`' `list` and `read`), else they say history is not available.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import { AgentHistoryList, AgentTranscript } from '@vinaverse/react-native/history';
|
|
124
|
+
|
|
125
|
+
<AgentHistoryList subject={user?.id ?? null} mode={side} timeZone={tz}
|
|
126
|
+
onOpen={(c) => router.push({ pathname: `/history/${c.id}`, params: { ended: String(c.state === 'ended') } })}
|
|
127
|
+
onContinue={(c) => router.push({ pathname: '/chat', params: { mode: c.experience_mode, scope: c.business_scope_id } })} />
|
|
128
|
+
<AgentTranscript conversationId={id} ended={ended === 'true'} agentKey={{ subject: user?.id ?? null, mode: side }} onContinue={() => router.push('/chat')} />
|
|
129
|
+
```
|
|
106
130
|
- **Hooks** for your own parts: `useAgentConversation`, `useAgentStatus`, `useAgentStatusState` (`{ status, reading,
|
|
107
131
|
failed }`: "still reading" apart from "could not read"), `useAgentFeatures`, `useAgentProfile`, `useAgentName`,
|
|
108
|
-
`useAgentLauncher`, `useAgentRuntime
|
|
132
|
+
`useAgentLauncher`, `useAgentRuntime`; `useAgentHistory`, `useAgentTranscript` (`@vinaverse/react-native/history`).
|
|
109
133
|
- **Events** for analytics through `onEvent`: sessions, ratings, chips, targets and links opened, the launcher shown,
|
|
110
134
|
opened, greeted and its greeting closed.
|
|
111
135
|
- **StrictMode, in development only:** React mounts, unmounts and mounts again, so a conversation still opening is let
|
package/dist/chat.cjs
CHANGED
|
@@ -1,245 +1,246 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4PXQ7DEY_cjs = require('./chunk-4PXQ7DEY.cjs');
|
|
4
|
+
var chunkXAG2P447_cjs = require('./chunk-XAG2P447.cjs');
|
|
4
5
|
var chunk6QYDPGRS_cjs = require('./chunk-6QYDPGRS.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
Object.defineProperty(exports, "ActivityLine", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunkNRYNK7E4_cjs.ActivityLine; }
|
|
11
|
-
});
|
|
12
9
|
Object.defineProperty(exports, "AgentChat", {
|
|
13
10
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunk4PXQ7DEY_cjs.AgentChat; }
|
|
15
12
|
});
|
|
16
13
|
Object.defineProperty(exports, "AgentFooter", {
|
|
17
14
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk4PXQ7DEY_cjs.AgentFooter; }
|
|
19
16
|
});
|
|
20
17
|
Object.defineProperty(exports, "AgentRuntimeProvider", {
|
|
21
18
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunk4PXQ7DEY_cjs.AgentRuntimeProvider; }
|
|
23
20
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
21
|
+
Object.defineProperty(exports, "Composer", {
|
|
25
22
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunk4PXQ7DEY_cjs.Composer; }
|
|
27
24
|
});
|
|
28
|
-
Object.defineProperty(exports, "
|
|
25
|
+
Object.defineProperty(exports, "DefaultComposer", {
|
|
29
26
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunk4PXQ7DEY_cjs.DefaultComposer; }
|
|
31
28
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
29
|
+
Object.defineProperty(exports, "DefaultEnded", {
|
|
33
30
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunk4PXQ7DEY_cjs.DefaultEnded; }
|
|
35
32
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
33
|
+
Object.defineProperty(exports, "DefaultUnavailable", {
|
|
37
34
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunk4PXQ7DEY_cjs.DefaultUnavailable; }
|
|
39
36
|
});
|
|
40
|
-
Object.defineProperty(exports, "
|
|
37
|
+
Object.defineProperty(exports, "DefaultUnavailableScreen", {
|
|
41
38
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunk4PXQ7DEY_cjs.DefaultUnavailableScreen; }
|
|
43
40
|
});
|
|
44
|
-
Object.defineProperty(exports, "
|
|
41
|
+
Object.defineProperty(exports, "DefaultUnreachable", {
|
|
45
42
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunk4PXQ7DEY_cjs.DefaultUnreachable; }
|
|
47
44
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
45
|
+
Object.defineProperty(exports, "StatusBanner", {
|
|
49
46
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunk4PXQ7DEY_cjs.StatusBanner; }
|
|
51
48
|
});
|
|
52
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "VinaverseChat", {
|
|
53
50
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunk4PXQ7DEY_cjs.VinaverseChat; }
|
|
55
52
|
});
|
|
56
|
-
Object.defineProperty(exports, "
|
|
53
|
+
Object.defineProperty(exports, "VinaverseChatProvider", {
|
|
57
54
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunk4PXQ7DEY_cjs.VinaverseChatProvider; }
|
|
59
56
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
57
|
+
Object.defineProperty(exports, "forgetGreeting", {
|
|
61
58
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunk4PXQ7DEY_cjs.forgetGreeting; }
|
|
63
60
|
});
|
|
64
|
-
Object.defineProperty(exports, "
|
|
61
|
+
Object.defineProperty(exports, "greetedKey", {
|
|
65
62
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunk4PXQ7DEY_cjs.greetedKey; }
|
|
67
64
|
});
|
|
68
|
-
Object.defineProperty(exports, "
|
|
65
|
+
Object.defineProperty(exports, "newestWholeReply", {
|
|
69
66
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunk4PXQ7DEY_cjs.newestWholeReply; }
|
|
71
68
|
});
|
|
72
|
-
Object.defineProperty(exports, "
|
|
69
|
+
Object.defineProperty(exports, "useAgentConversation", {
|
|
73
70
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentConversation; }
|
|
75
72
|
});
|
|
76
|
-
Object.defineProperty(exports, "
|
|
73
|
+
Object.defineProperty(exports, "useAgentFeatures", {
|
|
77
74
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentFeatures; }
|
|
79
76
|
});
|
|
80
|
-
Object.defineProperty(exports, "
|
|
77
|
+
Object.defineProperty(exports, "useAgentLauncher", {
|
|
81
78
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentLauncher; }
|
|
83
80
|
});
|
|
84
|
-
Object.defineProperty(exports, "
|
|
81
|
+
Object.defineProperty(exports, "useAgentName", {
|
|
85
82
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentName; }
|
|
87
84
|
});
|
|
88
|
-
Object.defineProperty(exports, "
|
|
85
|
+
Object.defineProperty(exports, "useAgentProfile", {
|
|
89
86
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentProfile; }
|
|
91
88
|
});
|
|
92
|
-
Object.defineProperty(exports, "
|
|
89
|
+
Object.defineProperty(exports, "useAgentRuntime", {
|
|
93
90
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentRuntime; }
|
|
95
92
|
});
|
|
96
|
-
Object.defineProperty(exports, "
|
|
93
|
+
Object.defineProperty(exports, "useAgentStatus", {
|
|
97
94
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentStatus; }
|
|
99
96
|
});
|
|
100
|
-
Object.defineProperty(exports, "
|
|
97
|
+
Object.defineProperty(exports, "useAgentStatusState", {
|
|
101
98
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunk4PXQ7DEY_cjs.useAgentStatusState; }
|
|
103
100
|
});
|
|
104
|
-
Object.defineProperty(exports, "
|
|
101
|
+
Object.defineProperty(exports, "ActivityLine", {
|
|
105
102
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkXAG2P447_cjs.ActivityLine; }
|
|
107
104
|
});
|
|
108
|
-
Object.defineProperty(exports, "
|
|
105
|
+
Object.defineProperty(exports, "Avatar", {
|
|
109
106
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkXAG2P447_cjs.Avatar; }
|
|
111
108
|
});
|
|
112
|
-
Object.defineProperty(exports, "
|
|
109
|
+
Object.defineProperty(exports, "Button", {
|
|
113
110
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkXAG2P447_cjs.Button; }
|
|
115
112
|
});
|
|
116
|
-
Object.defineProperty(exports, "
|
|
113
|
+
Object.defineProperty(exports, "CardActions", {
|
|
117
114
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkXAG2P447_cjs.CardActions; }
|
|
119
116
|
});
|
|
120
|
-
Object.defineProperty(exports, "
|
|
117
|
+
Object.defineProperty(exports, "CardCarousel", {
|
|
121
118
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkXAG2P447_cjs.CardCarousel; }
|
|
123
120
|
});
|
|
124
|
-
Object.defineProperty(exports, "
|
|
121
|
+
Object.defineProperty(exports, "CardFrame", {
|
|
125
122
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkXAG2P447_cjs.CardFrame; }
|
|
127
124
|
});
|
|
128
|
-
Object.defineProperty(exports, "
|
|
125
|
+
Object.defineProperty(exports, "CardView", {
|
|
129
126
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunkXAG2P447_cjs.CardView; }
|
|
131
128
|
});
|
|
132
|
-
Object.defineProperty(exports, "
|
|
129
|
+
Object.defineProperty(exports, "ChatHeader", {
|
|
133
130
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkXAG2P447_cjs.ChatHeader; }
|
|
135
132
|
});
|
|
136
|
-
Object.defineProperty(exports, "
|
|
133
|
+
Object.defineProperty(exports, "ChatSkeleton", {
|
|
137
134
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunkXAG2P447_cjs.ChatSkeleton; }
|
|
139
136
|
});
|
|
140
|
-
Object.defineProperty(exports, "
|
|
137
|
+
Object.defineProperty(exports, "DefaultBubble", {
|
|
141
138
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunkXAG2P447_cjs.DefaultBubble; }
|
|
143
140
|
});
|
|
144
|
-
Object.defineProperty(exports, "
|
|
141
|
+
Object.defineProperty(exports, "DefaultHeader", {
|
|
145
142
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunkXAG2P447_cjs.DefaultHeader; }
|
|
147
144
|
});
|
|
148
|
-
Object.defineProperty(exports, "
|
|
145
|
+
Object.defineProperty(exports, "DefaultTurnFailed", {
|
|
149
146
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunkXAG2P447_cjs.DefaultTurnFailed; }
|
|
151
148
|
});
|
|
152
|
-
Object.defineProperty(exports, "
|
|
149
|
+
Object.defineProperty(exports, "DisclosureBar", {
|
|
153
150
|
enumerable: true,
|
|
154
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunkXAG2P447_cjs.DisclosureBar; }
|
|
155
152
|
});
|
|
156
|
-
Object.defineProperty(exports, "
|
|
153
|
+
Object.defineProperty(exports, "FailureActionButton", {
|
|
157
154
|
enumerable: true,
|
|
158
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunkXAG2P447_cjs.FailureActionButton; }
|
|
159
156
|
});
|
|
160
|
-
Object.defineProperty(exports, "
|
|
157
|
+
Object.defineProperty(exports, "InfoCard", {
|
|
161
158
|
enumerable: true,
|
|
162
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunkXAG2P447_cjs.InfoCard; }
|
|
163
160
|
});
|
|
164
|
-
Object.defineProperty(exports, "
|
|
161
|
+
Object.defineProperty(exports, "LinksCard", {
|
|
165
162
|
enumerable: true,
|
|
166
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunkXAG2P447_cjs.LinksCard; }
|
|
167
164
|
});
|
|
168
|
-
Object.defineProperty(exports, "
|
|
165
|
+
Object.defineProperty(exports, "ListingCard", {
|
|
169
166
|
enumerable: true,
|
|
170
|
-
get: function () { return
|
|
167
|
+
get: function () { return chunkXAG2P447_cjs.ListingCard; }
|
|
171
168
|
});
|
|
172
|
-
Object.defineProperty(exports, "
|
|
169
|
+
Object.defineProperty(exports, "MessageBubble", {
|
|
173
170
|
enumerable: true,
|
|
174
|
-
get: function () { return
|
|
171
|
+
get: function () { return chunkXAG2P447_cjs.MessageBubble; }
|
|
175
172
|
});
|
|
176
|
-
Object.defineProperty(exports, "
|
|
173
|
+
Object.defineProperty(exports, "MessageList", {
|
|
177
174
|
enumerable: true,
|
|
178
|
-
get: function () { return
|
|
175
|
+
get: function () { return chunkXAG2P447_cjs.MessageList; }
|
|
179
176
|
});
|
|
180
|
-
Object.defineProperty(exports, "
|
|
177
|
+
Object.defineProperty(exports, "NextStepCard", {
|
|
181
178
|
enumerable: true,
|
|
182
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunkXAG2P447_cjs.NextStepCard; }
|
|
183
180
|
});
|
|
184
|
-
Object.defineProperty(exports, "
|
|
181
|
+
Object.defineProperty(exports, "ProposalCard", {
|
|
185
182
|
enumerable: true,
|
|
186
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunkXAG2P447_cjs.ProposalCard; }
|
|
187
184
|
});
|
|
188
|
-
Object.defineProperty(exports, "
|
|
185
|
+
Object.defineProperty(exports, "QuestionCard", {
|
|
189
186
|
enumerable: true,
|
|
190
|
-
get: function () { return
|
|
187
|
+
get: function () { return chunkXAG2P447_cjs.QuestionCard; }
|
|
191
188
|
});
|
|
192
|
-
Object.defineProperty(exports, "
|
|
189
|
+
Object.defineProperty(exports, "Row", {
|
|
193
190
|
enumerable: true,
|
|
194
|
-
get: function () { return
|
|
191
|
+
get: function () { return chunkXAG2P447_cjs.Row; }
|
|
195
192
|
});
|
|
196
|
-
Object.defineProperty(exports, "
|
|
193
|
+
Object.defineProperty(exports, "StreamingBubble", {
|
|
197
194
|
enumerable: true,
|
|
198
|
-
get: function () { return
|
|
195
|
+
get: function () { return chunkXAG2P447_cjs.StreamingBubble; }
|
|
199
196
|
});
|
|
200
|
-
Object.defineProperty(exports, "
|
|
197
|
+
Object.defineProperty(exports, "SystemRow", {
|
|
201
198
|
enumerable: true,
|
|
202
|
-
get: function () { return
|
|
199
|
+
get: function () { return chunkXAG2P447_cjs.SystemRow; }
|
|
203
200
|
});
|
|
204
|
-
Object.defineProperty(exports, "
|
|
201
|
+
Object.defineProperty(exports, "TimeSlotsCard", {
|
|
205
202
|
enumerable: true,
|
|
206
|
-
get: function () { return
|
|
203
|
+
get: function () { return chunkXAG2P447_cjs.TimeSlotsCard; }
|
|
207
204
|
});
|
|
208
|
-
Object.defineProperty(exports, "
|
|
205
|
+
Object.defineProperty(exports, "Welcome", {
|
|
209
206
|
enumerable: true,
|
|
210
|
-
get: function () { return
|
|
207
|
+
get: function () { return chunkXAG2P447_cjs.Welcome; }
|
|
211
208
|
});
|
|
212
|
-
Object.defineProperty(exports, "
|
|
209
|
+
Object.defineProperty(exports, "allowedImage", {
|
|
213
210
|
enumerable: true,
|
|
214
|
-
get: function () { return
|
|
211
|
+
get: function () { return chunkXAG2P447_cjs.allowedImage; }
|
|
215
212
|
});
|
|
216
|
-
Object.defineProperty(exports, "
|
|
213
|
+
Object.defineProperty(exports, "answerText", {
|
|
217
214
|
enumerable: true,
|
|
218
|
-
get: function () { return
|
|
215
|
+
get: function () { return chunkXAG2P447_cjs.answerText; }
|
|
219
216
|
});
|
|
220
|
-
Object.defineProperty(exports, "
|
|
217
|
+
Object.defineProperty(exports, "carousels", {
|
|
221
218
|
enumerable: true,
|
|
222
|
-
get: function () { return
|
|
219
|
+
get: function () { return chunkXAG2P447_cjs.carousels; }
|
|
223
220
|
});
|
|
224
|
-
Object.defineProperty(exports, "
|
|
221
|
+
Object.defineProperty(exports, "defaultCard", {
|
|
225
222
|
enumerable: true,
|
|
226
|
-
get: function () { return
|
|
223
|
+
get: function () { return chunkXAG2P447_cjs.defaultCard; }
|
|
227
224
|
});
|
|
228
|
-
Object.defineProperty(exports, "
|
|
225
|
+
Object.defineProperty(exports, "fieldText", {
|
|
229
226
|
enumerable: true,
|
|
230
|
-
get: function () { return
|
|
227
|
+
get: function () { return chunkXAG2P447_cjs.fieldText; }
|
|
231
228
|
});
|
|
232
|
-
Object.defineProperty(exports, "
|
|
229
|
+
Object.defineProperty(exports, "itemType", {
|
|
233
230
|
enumerable: true,
|
|
234
|
-
get: function () { return
|
|
231
|
+
get: function () { return chunkXAG2P447_cjs.itemType; }
|
|
235
232
|
});
|
|
236
|
-
Object.defineProperty(exports, "
|
|
233
|
+
Object.defineProperty(exports, "monogram", {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function () { return chunkXAG2P447_cjs.monogram; }
|
|
236
|
+
});
|
|
237
|
+
Object.defineProperty(exports, "ratingText", {
|
|
237
238
|
enumerable: true,
|
|
238
|
-
get: function () { return
|
|
239
|
+
get: function () { return chunkXAG2P447_cjs.ratingText; }
|
|
239
240
|
});
|
|
240
241
|
Object.defineProperty(exports, "useChat", {
|
|
241
242
|
enumerable: true,
|
|
242
|
-
get: function () { return
|
|
243
|
+
get: function () { return chunkXAG2P447_cjs.useChat; }
|
|
243
244
|
});
|
|
244
245
|
Object.defineProperty(exports, "ThemeProvider", {
|
|
245
246
|
enumerable: true,
|
package/dist/chat.d.cts
CHANGED
|
@@ -1,92 +1,17 @@
|
|
|
1
1
|
export { AgentRuntimeProvider, GreetingStorage, UseAgentConversation, UseAgentLauncher, forgetGreeting, greetedKey, useAgentConversation, useAgentFeatures, useAgentLauncher, useAgentName, useAgentProfile, useAgentRuntime, useAgentStatus, useAgentStatusState } from '@vinaverse/react/agent';
|
|
2
|
+
import { b as CardProps, c as ChatHandlers, d as ChatSlots, g as Chip, I as ImagePolicy, H as HeaderProps, h as ComposerProps, j as FailureState, M as MessageBubbleProps } from './context-gHCLFsJh.cjs';
|
|
3
|
+
export { C as CardCarousel, a as CardGroupProps, e as ChatStore, f as ChatWarning, E as EmptyStateProps, F as FailureAction, i as FailureProps, L as ListProps, P as ProposalDecision, u as useChat } from './context-gHCLFsJh.cjs';
|
|
2
4
|
import * as react from 'react';
|
|
3
|
-
import {
|
|
5
|
+
import { ReactNode, ComponentType } from 'react';
|
|
4
6
|
import * as _vinaverse_client_conversation from '@vinaverse/client/conversation';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { ImageProps, StyleProp, ViewStyle } from 'react-native';
|
|
7
|
+
import { CardItem, Question, ConversationStore, MessageItem, TimelineItem, SystemItem, Welcome as Welcome$1 } from '@vinaverse/client/conversation';
|
|
8
|
+
import { AgentKey, AgentPlace, AgentEntryPoint, AgentFailureReason, AgentRating } from '@vinaverse/client/agent';
|
|
8
9
|
import { CopyOverrides } from '@vinaverse/react';
|
|
10
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
9
11
|
import { a as ThemeOverrides, C as ColorSchemeSetting } from './theme-BhiEGv64.cjs';
|
|
10
12
|
export { T as Theme, b as ThemeProvider, c as createTheme, t as themeProblems, u as useTheme } from './theme-BhiEGv64.cjs';
|
|
11
13
|
import '@vinaverse/tokens';
|
|
12
14
|
|
|
13
|
-
interface HeaderProps {
|
|
14
|
-
readonly name: string;
|
|
15
|
-
readonly avatarUrl: string | null;
|
|
16
|
-
/** While a person from the business replies: their role. */
|
|
17
|
-
readonly takeoverBy: string | null;
|
|
18
|
-
readonly Default: ComponentType<Omit<HeaderProps, 'Default'>>;
|
|
19
|
-
}
|
|
20
|
-
interface MessageBubbleProps {
|
|
21
|
-
readonly item: MessageItem;
|
|
22
|
-
/** The text to draw: the message's, or the streamed text so far. */
|
|
23
|
-
readonly text: string;
|
|
24
|
-
readonly Default: ComponentType<Omit<MessageBubbleProps, 'Default'>>;
|
|
25
|
-
}
|
|
26
|
-
interface ComposerProps {
|
|
27
|
-
readonly placeholder: string;
|
|
28
|
-
readonly responding: boolean;
|
|
29
|
-
readonly onSend: (text: string) => void;
|
|
30
|
-
readonly onStop: () => void;
|
|
31
|
-
readonly Default: ComponentType<Omit<ComposerProps, 'Default'>>;
|
|
32
|
-
}
|
|
33
|
-
interface EmptyStateProps {
|
|
34
|
-
readonly agentName: string;
|
|
35
|
-
/** The tenant's greeting and chips for the session's mode (`Session.welcome`), or null. */
|
|
36
|
-
readonly welcome: Welcome$1 | null;
|
|
37
|
-
/** Sends a chip's `message` as the person's own text. */
|
|
38
|
-
readonly onChip: (message: string) => void;
|
|
39
|
-
}
|
|
40
|
-
/** `components.CardGroup`: the cards one turn drew together with `group.layout: carousel`, in order. */
|
|
41
|
-
interface CardGroupProps {
|
|
42
|
-
readonly items: readonly CardItem[];
|
|
43
|
-
}
|
|
44
|
-
/** The props the kit gives its list: FlashList's, so FlashList or LegendList take them as they are. */
|
|
45
|
-
interface ListProps {
|
|
46
|
-
readonly data: readonly TimelineItem[];
|
|
47
|
-
readonly renderItem: (info: {
|
|
48
|
-
item: TimelineItem;
|
|
49
|
-
index: number;
|
|
50
|
-
}) => ReactElement | null;
|
|
51
|
-
readonly keyExtractor: (item: TimelineItem) => string;
|
|
52
|
-
readonly getItemType: (item: TimelineItem) => string;
|
|
53
|
-
readonly maintainVisibleContentPosition: {
|
|
54
|
-
readonly startRenderingFromBottom: boolean;
|
|
55
|
-
readonly autoscrollToBottomThreshold: number;
|
|
56
|
-
readonly animateAutoScrollToBottom: boolean;
|
|
57
|
-
};
|
|
58
|
-
readonly ListFooterComponent: ReactElement | null;
|
|
59
|
-
readonly ListEmptyComponent: ReactElement | null;
|
|
60
|
-
readonly keyboardShouldPersistTaps: 'handled';
|
|
61
|
-
readonly contentContainerStyle: object;
|
|
62
|
-
}
|
|
63
|
-
/** A failure the person needs a way out of: a turn that failed before any reply, or no session to talk to. */
|
|
64
|
-
interface FailureState {
|
|
65
|
-
/** `turn_failed`: a turn failed before any of its reply; `unavailable`: the backend gave no session, or none it could use. */
|
|
66
|
-
readonly kind: 'turn_failed' | 'unavailable';
|
|
67
|
-
/** Why: the turn's error `code` (`internal`, `timeout`, …), or the conversation's status (`unavailable`, `unauthorized`). */
|
|
68
|
-
readonly reason: string | null;
|
|
69
|
-
/** Try again, when it can be: the person's text again for a turn the server allows to retry, a new session otherwise. */
|
|
70
|
-
readonly retry: (() => void) | undefined;
|
|
71
|
-
/** The conversation, once a session named it: for your support records. */
|
|
72
|
-
readonly conversationId: string | null;
|
|
73
|
-
}
|
|
74
|
-
/** A slot for a failure (`components.Error`, `components.Unavailable`): the state, and the kit's own part to wrap. */
|
|
75
|
-
interface FailureProps {
|
|
76
|
-
readonly state: FailureState;
|
|
77
|
-
readonly Default: ComponentType<{
|
|
78
|
-
readonly state: FailureState;
|
|
79
|
-
}>;
|
|
80
|
-
}
|
|
81
|
-
/** One action on every failure, drawn as a button by the kit's own parts: a person is always the way out. */
|
|
82
|
-
interface FailureAction {
|
|
83
|
-
/** Default: the copy's `talkToPerson` ("Talk to a person"), in the person's language. */
|
|
84
|
-
readonly label?: string;
|
|
85
|
-
readonly onPress: (state: FailureState) => void;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
declare function CardCarousel(props: CardGroupProps): react.JSX.Element;
|
|
89
|
-
|
|
90
15
|
declare function CardFrame(props: {
|
|
91
16
|
readonly label: string;
|
|
92
17
|
readonly restored?: boolean;
|
|
@@ -98,20 +23,6 @@ declare function ratingText(valuePpm: number, locale: string | undefined): strin
|
|
|
98
23
|
/** A photo the image policy allows: https, and from one of its hosts when it names them. */
|
|
99
24
|
declare function allowedImage(url: string | undefined, hosts: readonly string[] | undefined): string | null;
|
|
100
25
|
|
|
101
|
-
interface CardProps {
|
|
102
|
-
readonly card: HeldCard;
|
|
103
|
-
/** The card read once for drawing, every field checked (`readCard`): kind, target, photo, rating, price, group, links. */
|
|
104
|
-
readonly read: ReadCard | null;
|
|
105
|
-
/** A proposal being decided: draw its buttons busy. */
|
|
106
|
-
readonly busy: boolean;
|
|
107
|
-
/** Restored after a restart: draw it as it was, taking no answer or action. */
|
|
108
|
-
readonly restored: boolean;
|
|
109
|
-
/** Drawn inside a carousel with its group: a photo keeps the policy's fixed frame, so the row stays even. */
|
|
110
|
-
readonly grouped?: boolean;
|
|
111
|
-
/** The kit's own renderer for this kind, to wrap rather than rewrite. */
|
|
112
|
-
readonly Default: ComponentType<Omit<CardProps, 'Default'>>;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
26
|
/** The kit's own renderer for a kind. */
|
|
116
27
|
declare function defaultCard(kind: string): ComponentType<Omit<CardProps, 'Default'>>;
|
|
117
28
|
declare const CardView: react.NamedExoticComponent<{
|
|
@@ -144,115 +55,6 @@ declare function TimeSlotsCard(props: Omit<CardProps, 'Default'>): react.JSX.Ele
|
|
|
144
55
|
|
|
145
56
|
declare const ActivityLine: react.NamedExoticComponent<object>;
|
|
146
57
|
|
|
147
|
-
type ProposalDecision = 'confirm' | 'decline';
|
|
148
|
-
/** What the kit asks of the tenant's app. Only `onProposal` and `onOpenLink` are needed for the cards that use them. */
|
|
149
|
-
/** What a chat warning is about. */
|
|
150
|
-
interface ChatWarning {
|
|
151
|
-
readonly code: 'theme' | 'copy' | 'send_failed' | 'answer_failed' | 'proposal_failed' | 'photo_failed';
|
|
152
|
-
}
|
|
153
|
-
interface ChatHandlers {
|
|
154
|
-
/**
|
|
155
|
-
* The person confirmed or declined a proposal: call your backend with the person's own token, then say what
|
|
156
|
-
* happened (`confirmed`, `declined`, `failed`, or `expired` when it had expired). The kit reports it to the session.
|
|
157
|
-
*/
|
|
158
|
-
readonly onProposal?: (card: HeldCard, decision: ProposalDecision) => Promise<ProposalOutcome>;
|
|
159
|
-
/**
|
|
160
|
-
* Open a card's link in your app: a deep link that already passed the deep-link rule (route by the page it names),
|
|
161
|
-
* or a `links` card's https page (your in-app browser; without this handler the system opens it).
|
|
162
|
-
*/
|
|
163
|
-
readonly onOpenLink?: (link: string, card: HeldCard) => void;
|
|
164
|
-
/** A card action without a link (`show_times`, …): sent to the session; this tells your app too. */
|
|
165
|
-
readonly onCardAction?: (card: HeldCard, action: string) => void;
|
|
166
|
-
/** A photo question: let the person pick one, upload it to your backend, and give back its `upload_ref`. */
|
|
167
|
-
readonly onPickPhoto?: (question: Question, card: HeldCard) => Promise<{
|
|
168
|
-
readonly upload_ref: string;
|
|
169
|
-
} | null>;
|
|
170
|
-
/**
|
|
171
|
-
* A way out on a failed turn and on "couldn't connect": a button with your label (default "Talk to a person"),
|
|
172
|
-
* drawn by the kit's own parts when no `components.Error` or `components.Unavailable` replaces them.
|
|
173
|
-
*/
|
|
174
|
-
readonly failureAction?: FailureAction;
|
|
175
|
-
/**
|
|
176
|
-
* Warnings for the app's logger: a theme that is hard to read, copy that says "assistant", a send, an answer, a
|
|
177
|
-
* proposal or a photo pick that failed. `warning.code` says which, so a logger counts them without the text.
|
|
178
|
-
*/
|
|
179
|
-
readonly onWarning?: (message: string, warning: ChatWarning) => void;
|
|
180
|
-
/**
|
|
181
|
-
* The person tapped a card about something of yours (its `ref`: a professional, a space, a booking): open its page
|
|
182
|
-
* with your router. Without it, only the card's own actions open anything.
|
|
183
|
-
*/
|
|
184
|
-
readonly onOpenTarget?: (target: AgentCardTarget, card: HeldCard) => void;
|
|
185
|
-
/** Card photos arrive: fetch them ahead with your image library (`Image.prefetch`), so the cards draw at once. */
|
|
186
|
-
readonly prefetchImage?: (url: string) => void;
|
|
187
|
-
/** Reads a line to a screen reader (a finished reply, the launcher's greeting). Default: the platform's. */
|
|
188
|
-
readonly announce?: (text: string) => void;
|
|
189
|
-
/** A chip was tapped (a welcome chip, a starter, the suggestion); its message is sent as the person's own. */
|
|
190
|
-
readonly onChip?: (chip: Chip) => void;
|
|
191
|
-
}
|
|
192
|
-
/** Which card photos are drawn, in what frame, and what stands in for one that is not. */
|
|
193
|
-
interface ImagePolicy {
|
|
194
|
-
/** Hosts a photo may come from (exact names); default any https host. */
|
|
195
|
-
readonly hosts?: readonly string[];
|
|
196
|
-
/**
|
|
197
|
-
* Width / height of a listing's photo frame. Default 1.6 (16:10). `natural`: a card on its own takes its photo's
|
|
198
|
-
* own shape (its `width` and `height`), held within `naturalAspect`; a card in a carousel keeps 1.6, so the row
|
|
199
|
-
* stays even, and a photo without its size too.
|
|
200
|
-
*/
|
|
201
|
-
readonly aspectRatio?: number | 'natural';
|
|
202
|
-
/** The shapes a `natural` photo is held within. Default square to 2:1 (`{ min: 1, max: 2 }`). */
|
|
203
|
-
readonly naturalAspect?: {
|
|
204
|
-
readonly min: number;
|
|
205
|
-
readonly max: number;
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* What stands in for a missing, refused or failed photo, by the card's `kind` (a person's tile, a space's tile).
|
|
209
|
-
* Default the name's monogram.
|
|
210
|
-
*/
|
|
211
|
-
readonly Placeholder?: ComponentType<{
|
|
212
|
-
readonly title: string;
|
|
213
|
-
readonly kind: string;
|
|
214
|
-
}>;
|
|
215
|
-
}
|
|
216
|
-
/** Parts a tenant can replace. Each gets the default's props and the default itself (`Default`), to wrap it. */
|
|
217
|
-
interface ChatSlots {
|
|
218
|
-
readonly Header?: ComponentType<HeaderProps>;
|
|
219
|
-
readonly MessageBubble?: ComponentType<MessageBubbleProps>;
|
|
220
|
-
readonly Composer?: ComponentType<ComposerProps>;
|
|
221
|
-
readonly EmptyState?: ComponentType<EmptyStateProps>;
|
|
222
|
-
readonly Image?: ComponentType<ImageProps>;
|
|
223
|
-
/** A list with FlashList's props (LegendList works). Default: FlashList. */
|
|
224
|
-
readonly ListComponent?: ComponentType<ListProps>;
|
|
225
|
-
/** A turn that failed before any reply: replaces the "Something went wrong." row. */
|
|
226
|
-
readonly Error?: ComponentType<FailureProps>;
|
|
227
|
-
/** No session to talk to: replaces the "Couldn't connect." banner. */
|
|
228
|
-
readonly Unavailable?: ComponentType<FailureProps>;
|
|
229
|
-
/**
|
|
230
|
-
* Draws a turn's cards that ask for a carousel (`group.layout: carousel`) in one row: the kit's `CardCarousel`, or
|
|
231
|
-
* yours. Without it they draw one under another. Opt-in, so an app that never draws a carousel does not ship one.
|
|
232
|
-
*/
|
|
233
|
-
readonly CardGroup?: ComponentType<CardGroupProps>;
|
|
234
|
-
/** Card renderers by kind (`professional`, `proposal`, …). */
|
|
235
|
-
readonly cards?: Readonly<Partial<Record<string, ComponentType<CardProps>>>>;
|
|
236
|
-
}
|
|
237
|
-
interface ChatContextValue {
|
|
238
|
-
readonly store: ConversationStore;
|
|
239
|
-
readonly handlers: RefObject<ChatHandlers>;
|
|
240
|
-
readonly slots: ChatSlots;
|
|
241
|
-
readonly agentAvatar: string | undefined;
|
|
242
|
-
readonly timeZone: string | undefined;
|
|
243
|
-
/** The failure action's label when there is one (`label` undefined: the copy's); `onPress` is read from `handlers`. */
|
|
244
|
-
readonly failureAction: {
|
|
245
|
-
readonly label: string | undefined;
|
|
246
|
-
} | null;
|
|
247
|
-
/** Chips for an empty conversation when the session brings no welcome. */
|
|
248
|
-
readonly starters: readonly Chip[] | undefined;
|
|
249
|
-
readonly imagePolicy: ImagePolicy | undefined;
|
|
250
|
-
}
|
|
251
|
-
/** A tap target that sends `message` as the person's own text (a welcome chip, a starter, a suggestion). */
|
|
252
|
-
type Chip = Welcome$1['chips'][number];
|
|
253
|
-
/** The conversation, handlers and slots; only inside `VinaverseChat` (or `VinaverseChatProvider`). */
|
|
254
|
-
declare function useChat(): ChatContextValue;
|
|
255
|
-
|
|
256
58
|
interface VinaverseChatProps extends ChatHandlers {
|
|
257
59
|
/** The conversation (`createConversation`), created where it can outlive the screen. */
|
|
258
60
|
readonly conversation: ConversationStore;
|
|
@@ -487,4 +289,4 @@ declare function useReducedMotion(): boolean;
|
|
|
487
289
|
/** Reads a line to a screen reader, without moving focus. */
|
|
488
290
|
declare function announce(text: string): void;
|
|
489
291
|
|
|
490
|
-
export { ActivityLine, AgentChat, type AgentChatProps, type AgentChatSlots, type AgentEndedProps, AgentFooter, type AgentFooterProps, type AgentUnavailableScreenProps, type AgentUnreachableProps, Avatar, Button, type ButtonProps, CardActions,
|
|
292
|
+
export { ActivityLine, AgentChat, type AgentChatProps, type AgentChatSlots, type AgentEndedProps, AgentFooter, type AgentFooterProps, type AgentUnavailableScreenProps, type AgentUnreachableProps, Avatar, Button, type ButtonProps, CardActions, CardFrame, CardProps, CardView, ChatHandlers, ChatHeader, ChatSkeleton, ChatSlots, Chip, ColorSchemeSetting, Composer, ComposerProps, DefaultBubble, DefaultComposer, DefaultEnded, DefaultHeader, DefaultTurnFailed, DefaultUnavailable, DefaultUnavailableScreen, DefaultUnreachable, DisclosureBar, FailureActionButton, FailureState, HeaderProps, ImagePolicy, InfoCard, type LifecycleTarget, LinksCard, ListingCard, MessageBubble, MessageBubbleProps, MessageList, NextStepCard, ProposalCard, QuestionCard, Row, StatusBanner, StreamingBubble, SystemRow, ThemeOverrides, TimeSlotsCard, VinaverseChat, type VinaverseChatProps, VinaverseChatProvider, Welcome, allowedImage, announce, answerText, carousels, defaultCard, fieldText, itemType, monogram, newestWholeReply, ratingText, useNativeLifecycle, useReducedMotion };
|