@base44-preview/platform 0.5.0-pr.346.ce5b5be → 0.5.0-pr.353.656b952
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/react/chat.types.d.ts +56 -1
- package/package.json +1 -1
|
@@ -191,6 +191,23 @@ export interface ChoiceQuestion {
|
|
|
191
191
|
* @param picked - One list of picked labels per question, in the order of `questions`.
|
|
192
192
|
* @param texts - One free-text answer per question, in the same order. Use it for a `text_input` question, or as a note beside a pick. A question with no pick and no text is skipped.
|
|
193
193
|
* @returns Promise resolving once Base44 accepts the answer, or once sending it fails and sets [`error`](#error). It never rejects.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```tsx
|
|
197
|
+
* // Answer a one-question choice with a button per option
|
|
198
|
+
* function ChoiceButtons({ question }: { question: ChoiceQuestion }) {
|
|
199
|
+
* const [entry] = question.questions;
|
|
200
|
+
* return (
|
|
201
|
+
* <div>
|
|
202
|
+
* <p>{entry.text}</p>
|
|
203
|
+
* {entry.options.map((label) => (
|
|
204
|
+
* <button key={label} onClick={() => question.answer([[label]])}>{label}</button>
|
|
205
|
+
* ))}
|
|
206
|
+
* <button onClick={question.decline}>Skip</button>
|
|
207
|
+
* </div>
|
|
208
|
+
* );
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
194
211
|
*/
|
|
195
212
|
answer(picked: string[][], texts?: string[]): Promise<void>;
|
|
196
213
|
/**
|
|
@@ -218,6 +235,31 @@ export interface SecretsQuestion {
|
|
|
218
235
|
*
|
|
219
236
|
* @param values - The values, keyed by each field's `name`.
|
|
220
237
|
* @returns Promise resolving once Base44 accepts the values, or once sending it fails and sets [`error`](#error). It never rejects.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```tsx
|
|
241
|
+
* // Ask for each secret, then submit the values by name
|
|
242
|
+
* function SecretsForm({ question }: { question: SecretsQuestion }) {
|
|
243
|
+
* return (
|
|
244
|
+
* <form
|
|
245
|
+
* onSubmit={(event) => {
|
|
246
|
+
* event.preventDefault();
|
|
247
|
+
* const form = new FormData(event.currentTarget);
|
|
248
|
+
* question.submit(Object.fromEntries(question.fields.map((field) => [field.name, String(form.get(field.name) ?? "")])));
|
|
249
|
+
* }}
|
|
250
|
+
* >
|
|
251
|
+
* {question.fields.map((field) => (
|
|
252
|
+
* <label key={field.name}>
|
|
253
|
+
* {field.name}
|
|
254
|
+
* <input name={field.name} type="password" placeholder={field.description} />
|
|
255
|
+
* </label>
|
|
256
|
+
* ))}
|
|
257
|
+
* <button type="submit">Save</button>
|
|
258
|
+
* <button type="button" onClick={question.decline}>Skip</button>
|
|
259
|
+
* </form>
|
|
260
|
+
* );
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
221
263
|
*/
|
|
222
264
|
submit(values: Record<string, string>): Promise<void>;
|
|
223
265
|
/**
|
|
@@ -374,6 +416,19 @@ export interface UseChatResult {
|
|
|
374
416
|
* @returns Promise resolving once the app exists, or once creating it fails and sets [`error`](#error). It never rejects.
|
|
375
417
|
*/
|
|
376
418
|
create(prompt: string): Promise<void>;
|
|
377
|
-
/**
|
|
419
|
+
/**
|
|
420
|
+
* Clears a failed call's or the connection's [`error`](#error). A failed build's error stays while Base44 reports it.
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```tsx
|
|
424
|
+
* // Show the error, with a dismiss button unless the build failed
|
|
425
|
+
* {chat.error && (
|
|
426
|
+
* <div role="alert">
|
|
427
|
+
* {chat.error.message}
|
|
428
|
+
* {chat.error.code !== "build_failed" && <button onClick={chat.clearError}>Dismiss</button>}
|
|
429
|
+
* </div>
|
|
430
|
+
* )}
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
378
433
|
clearError(): void;
|
|
379
434
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/platform",
|
|
3
|
-
"version": "0.5.0-pr.
|
|
3
|
+
"version": "0.5.0-pr.353.656b952",
|
|
4
4
|
"description": "Base44 Platform SDK for white-label platforms: a browser client for following the AI chat and a server entrypoint for webhooks",
|
|
5
5
|
"main": "dist/client/index.js",
|
|
6
6
|
"types": "dist/client/index.d.ts",
|