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