@paymanai/payman-ask-sdk 1.2.15 → 1.2.17
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 +86 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -82
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.js +119 -102
- package/dist/index.native.js.map +1 -1
- package/dist/styles.css +10 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -52,6 +52,7 @@ function formatElapsedTime(ms) {
|
|
|
52
52
|
if (ms < 1e3) return `${ms}ms`;
|
|
53
53
|
return `${(ms / 1e3).toFixed(1)}s`;
|
|
54
54
|
}
|
|
55
|
+
var AI_DISCLAIMER_TEXT = "AI can make mistakes. Please double-check responses.";
|
|
55
56
|
function ChatInput({
|
|
56
57
|
value,
|
|
57
58
|
onChange,
|
|
@@ -119,94 +120,97 @@ function ChatInput({
|
|
|
119
120
|
ref: containerRef,
|
|
120
121
|
className: cn("flex-shrink-0 w-full", className),
|
|
121
122
|
style: { flexShrink: 0 },
|
|
122
|
-
children: /* @__PURE__ */ jsx("div", { className: "px-3 pb-3 pt-1.5 w-full", children: /* @__PURE__ */
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
children: [
|
|
131
|
-
/* @__PURE__ */ jsx(
|
|
132
|
-
"textarea",
|
|
133
|
-
{
|
|
134
|
-
ref: textareaRef,
|
|
135
|
-
value,
|
|
136
|
-
onChange: (e) => onChange(e.target.value),
|
|
137
|
-
onKeyDown: handleKeyDown,
|
|
138
|
-
onClick,
|
|
139
|
-
disabled: isInputDisabled,
|
|
140
|
-
placeholder: getPlaceholder(),
|
|
141
|
-
className: cn(
|
|
142
|
-
"payman-chat-input-field",
|
|
143
|
-
"focus:outline-none resize-none overflow-y-auto",
|
|
144
|
-
"flex-1 min-w-0 py-3"
|
|
145
|
-
),
|
|
146
|
-
style: {
|
|
147
|
-
minHeight: "44px",
|
|
148
|
-
maxHeight: "160px",
|
|
149
|
-
paddingLeft: "18px",
|
|
150
|
-
paddingRight: "8px"
|
|
151
|
-
},
|
|
152
|
-
rows: 1
|
|
153
|
-
}
|
|
123
|
+
children: /* @__PURE__ */ jsx("div", { className: "px-3 pb-3 pt-1.5 w-full", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full max-w-2xl mx-auto", children: [
|
|
124
|
+
/* @__PURE__ */ jsxs(
|
|
125
|
+
motion.div,
|
|
126
|
+
{
|
|
127
|
+
initial: false,
|
|
128
|
+
className: cn(
|
|
129
|
+
"flex items-end overflow-hidden",
|
|
130
|
+
"payman-chat-input"
|
|
154
131
|
),
|
|
155
|
-
|
|
156
|
-
showVoiceButton && /* @__PURE__ */ jsxs(
|
|
157
|
-
"button",
|
|
158
|
-
{
|
|
159
|
-
type: "button",
|
|
160
|
-
onClick: onVoicePress,
|
|
161
|
-
disabled: isVoiceButtonDisabled,
|
|
162
|
-
className: cn(
|
|
163
|
-
"relative flex items-center justify-center",
|
|
164
|
-
"w-8 h-8 rounded-full transition-all duration-200",
|
|
165
|
-
"payman-chat-input-btn-voice",
|
|
166
|
-
isRecording && "recording"
|
|
167
|
-
),
|
|
168
|
-
"aria-label": isRecording ? "Stop recording" : "Voice input",
|
|
169
|
-
children: [
|
|
170
|
-
isRecording && /* @__PURE__ */ jsx(
|
|
171
|
-
"span",
|
|
172
|
-
{
|
|
173
|
-
className: "absolute inset-0 rounded-full border-2 animate-ping opacity-40",
|
|
174
|
-
style: {
|
|
175
|
-
borderColor: "var(--payman-input-btn-voice-recording-ring)"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
),
|
|
179
|
-
isRecording ? /* @__PURE__ */ jsx(
|
|
180
|
-
Square,
|
|
181
|
-
{
|
|
182
|
-
className: "w-3 h-3 relative z-10",
|
|
183
|
-
fill: "currentColor"
|
|
184
|
-
}
|
|
185
|
-
) : /* @__PURE__ */ jsx(Mic, { className: "w-4 h-4" })
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
),
|
|
132
|
+
children: [
|
|
189
133
|
/* @__PURE__ */ jsx(
|
|
190
|
-
"
|
|
134
|
+
"textarea",
|
|
191
135
|
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
136
|
+
ref: textareaRef,
|
|
137
|
+
value,
|
|
138
|
+
onChange: (e) => onChange(e.target.value),
|
|
139
|
+
onKeyDown: handleKeyDown,
|
|
140
|
+
onClick,
|
|
141
|
+
disabled: isInputDisabled,
|
|
142
|
+
placeholder: getPlaceholder(),
|
|
195
143
|
className: cn(
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"hover:opacity-90 active:scale-95",
|
|
200
|
-
"transition-all duration-150"
|
|
144
|
+
"payman-chat-input-field",
|
|
145
|
+
"focus:outline-none resize-none overflow-y-auto",
|
|
146
|
+
"flex-1 min-w-0 py-3"
|
|
201
147
|
),
|
|
202
|
-
|
|
203
|
-
|
|
148
|
+
style: {
|
|
149
|
+
minHeight: "44px",
|
|
150
|
+
maxHeight: "160px",
|
|
151
|
+
paddingLeft: "18px",
|
|
152
|
+
paddingRight: "8px"
|
|
153
|
+
},
|
|
154
|
+
rows: 1
|
|
204
155
|
}
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
156
|
+
),
|
|
157
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0 p-2", children: [
|
|
158
|
+
showVoiceButton && /* @__PURE__ */ jsxs(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
type: "button",
|
|
162
|
+
onClick: onVoicePress,
|
|
163
|
+
disabled: isVoiceButtonDisabled,
|
|
164
|
+
className: cn(
|
|
165
|
+
"relative flex items-center justify-center",
|
|
166
|
+
"w-8 h-8 rounded-full transition-all duration-200",
|
|
167
|
+
"payman-chat-input-btn-voice",
|
|
168
|
+
isRecording && "recording"
|
|
169
|
+
),
|
|
170
|
+
"aria-label": isRecording ? "Stop recording" : "Voice input",
|
|
171
|
+
children: [
|
|
172
|
+
isRecording && /* @__PURE__ */ jsx(
|
|
173
|
+
"span",
|
|
174
|
+
{
|
|
175
|
+
className: "absolute inset-0 rounded-full border-2 animate-ping opacity-40",
|
|
176
|
+
style: {
|
|
177
|
+
borderColor: "var(--payman-input-btn-voice-recording-ring)"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
isRecording ? /* @__PURE__ */ jsx(
|
|
182
|
+
Square,
|
|
183
|
+
{
|
|
184
|
+
className: "w-3 h-3 relative z-10",
|
|
185
|
+
fill: "currentColor"
|
|
186
|
+
}
|
|
187
|
+
) : /* @__PURE__ */ jsx(Mic, { className: "w-4 h-4" })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
"button",
|
|
193
|
+
{
|
|
194
|
+
type: "button",
|
|
195
|
+
onClick: onSend,
|
|
196
|
+
disabled: !canSend,
|
|
197
|
+
className: cn(
|
|
198
|
+
"flex items-center justify-center",
|
|
199
|
+
"w-8 h-8 rounded-full",
|
|
200
|
+
"payman-chat-input-btn-send",
|
|
201
|
+
"hover:opacity-90 active:scale-95",
|
|
202
|
+
"transition-all duration-150"
|
|
203
|
+
),
|
|
204
|
+
"aria-label": "Send message",
|
|
205
|
+
children: /* @__PURE__ */ jsx(ArrowUp, { className: "w-4 h-4", strokeWidth: 2.5 })
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
] })
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsx("p", { className: "payman-chat-input-disclaimer", children: AI_DISCLAIMER_TEXT })
|
|
213
|
+
] }) })
|
|
210
214
|
}
|
|
211
215
|
);
|
|
212
216
|
}
|