@asgard-js/react 0.2.39 → 0.2.40-canary.2

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 CHANGED
@@ -292,6 +292,7 @@ config: {
292
292
  - `onRunDone?`: `DoneEventHandler` - Handler for run completion events
293
293
  - `onRunError?`: `ErrorEventHandler` - Error handler for execution errors
294
294
  - **customActions?**: `ReactNode[]` - Custom actions to display on the chatbot header
295
+ - **customFooterActions?**: `ReactNode[]` - Custom action buttons rendered alongside the built-in footer attachment buttons (upload / export / document). Each item is a `ReactNode`; the consumer controls styling. Mirrors the pattern of `customActions`. See [Custom Footer Actions](#custom-footer-actions) section for details.
295
296
  - **enableLoadConfigFromService?**: `boolean` - Enable loading configuration from service
296
297
  - **enableUpload?**: `boolean` - Enable file upload functionality. When set, it takes priority over the `embedConfig.enableUpload` setting from the bot provider metadata. Defaults to `false` if not specified in either location. Supports image files (JPEG, PNG, GIF, WebP) up to 20MB per file, maximum 10 files at once.
297
298
  - **enableExport?**: `boolean` - Enable conversation export functionality. When set, it takes priority over the `embedConfig.enableExport` setting from the bot provider metadata. Defaults to `false` if not specified in either location. Adds a download button to the chatbot footer that exports the conversation history as a Markdown file with timestamps and trace IDs.
@@ -1320,6 +1321,52 @@ const App = () => {
1320
1321
  };
1321
1322
  ```
1322
1323
 
1324
+ <a id="custom-footer-actions"></a>
1325
+ <br/>
1326
+
1327
+ ### Custom Footer Actions
1328
+
1329
+ The `customFooterActions` prop adds extra buttons to the built-in footer alongside the default attachment buttons (upload / export / document). The rest of the footer — textarea, IME composition handling, send button, mic button, drag-and-drop — stays untouched. This is the right tool for the common "I just want to add a button" case; if you need to fully replace the footer, that requires a different (not-yet-shipped) prop.
1330
+
1331
+ Items are plain `ReactNode`s; the consumer styles each button as they like.
1332
+
1333
+ #### Usage Example
1334
+
1335
+ ```typescript
1336
+ import { Chatbot } from '@asgard-js/react';
1337
+
1338
+ const App = () => {
1339
+ const handleExportPdf = (): void => {
1340
+ // ...
1341
+ };
1342
+
1343
+ return (
1344
+ <Chatbot
1345
+ config={{
1346
+ apiKey: 'your-api-key',
1347
+ botProviderEndpoint: 'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}',
1348
+ }}
1349
+ customChannelId="your-channel-id"
1350
+ customFooterActions={[
1351
+ <button key="pdf" onClick={handleExportPdf} title="Export PDF">
1352
+ 📄
1353
+ </button>,
1354
+ <button key="bookmark" onClick={() => console.log('Bookmark')} title="Bookmark">
1355
+ 🔖
1356
+ </button>,
1357
+ ]}
1358
+ />
1359
+ );
1360
+ };
1361
+ ```
1362
+
1363
+ #### Notes
1364
+
1365
+ - Items render in the same row as the built-in attachment buttons (after upload / export / document, before the textarea).
1366
+ - They do **not** participate in the built-in collapse-into-`+`-menu logic; they always render inline. Avoid passing many items, or the row may overflow.
1367
+ - When the chatbot is in preview mode (`sendMessage` unavailable) the built-in buttons remain visible but inert. Your custom buttons stay clickable — disable them yourself if that matters.
1368
+ - For the rare case where you need a completely different input UX (e.g. structured form, code editor), this prop is not enough; use `useAsgardContext()` to read SDK state and build something on the side, or open an issue for a `renderFooter` escape hatch.
1369
+
1323
1370
  <a id="custom-menu"></a>
1324
1371
  <br/>
1325
1372
 
@@ -1,4 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
 
3
- export declare function ChatbotFooter(): ReactNode;
3
+ interface ChatbotFooterProps {
4
+ customFooterActions?: ReactNode[];
5
+ }
6
+ export declare function ChatbotFooter({ customFooterActions }?: ChatbotFooterProps): ReactNode;
7
+ export {};
4
8
  //# sourceMappingURL=chatbot-footer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAMV,MAAM,OAAO,CAAC;AA0Bf,wBAAgB,aAAa,IAAI,SAAS,CA23BzC"}
1
+ {"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAMV,MAAM,OAAO,CAAC;AA0Bf,UAAU,kBAAkB;IAC1B,mBAAmB,CAAC,EAAE,SAAS,EAAE,CAAC;CACnC;AAED,wBAAgB,aAAa,CAAC,EAAE,mBAAmB,EAAE,GAAE,kBAAuB,GAAG,SAAS,CA43BzF"}
@@ -52,6 +52,12 @@ interface ChatbotProps extends AsgardTemplateContextValue {
52
52
  onChannelReady?: () => void;
53
53
  /** Custom header renderer. When provided, replaces the default header entirely. */
54
54
  renderHeader?: () => ReactNode;
55
+ /**
56
+ * Custom action buttons rendered alongside the built-in footer buttons
57
+ * (upload / export / document). Each item is a ReactNode and the consumer
58
+ * controls styling. Mirrors the pattern of `customActions` (header).
59
+ */
60
+ customFooterActions?: ReactNode[];
55
61
  /** Custom menu renderer. When provided, renders between chat body and footer. */
56
62
  renderMenu?: () => ReactNode;
57
63
  /** Custom renderer for tool call group. Return null to hide, or return custom JSX. */
@@ -1 +1 @@
1
- {"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EACT,aAAa,EAId,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAA8B,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AACzG,OAAO,EAEL,yBAAyB,EAEzB,0BAA0B,EAE1B,iCAAiC,EAGjC,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAY5C,UAAU,YAAa,SAAQ,0BAA0B;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM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