pika-shared 1.4.5 → 1.4.7
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/types/chatbot/chatbot-types.d.mts +158 -108
- package/dist/types/chatbot/chatbot-types.d.ts +158 -108
- package/dist/types/chatbot/chatbot-types.js +1 -0
- package/dist/types/chatbot/chatbot-types.js.map +1 -1
- package/dist/types/chatbot/chatbot-types.mjs +1 -0
- package/dist/types/chatbot/chatbot-types.mjs.map +1 -1
- package/dist/types/chatbot/webcomp-types.d.mts +152 -11
- package/dist/types/chatbot/webcomp-types.d.ts +152 -11
- package/dist/util/server-utils.js.map +1 -1
- package/dist/util/server-utils.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UploadStatus } from '../upload-types.mjs';
|
|
2
|
-
import { ShowToastFn, ChatUser, RecordOrUndef, UserAwsCredentials, WidgetRenderingContextType, ShareSessionState, UserPrefs, ChatAppMode, IUserWidgetDataStoreState, CustomDataUiRepresentation, ChatAppOverridableFeatures, TagDefinition, TagDefinitionWidget, ChatSession, UserDataOverrideSettings, ChatMessageForRendering, ChatApp, ChatAppActionMenu, ChatAppAction, WidgetInstance,
|
|
2
|
+
import { ShowToastFn, ChatUser, RecordOrUndef, UserAwsCredentials, WidgetRenderingContextType, ShareSessionState, UserPrefs, ChatAppMode, IUserWidgetDataStoreState, CustomDataUiRepresentation, ChatAppOverridableFeatures, TagDefinition, TagDefinitionWidget, ChatSession, UserDataOverrideSettings, ChatMessageForRendering, ChatApp, ChatAppActionMenu, ChatAppAction, WidgetInstance, WidgetSizing, InvokeAgentAsComponentOptions } from './chatbot-types.mjs';
|
|
3
3
|
import '@aws-sdk/client-bedrock-agent-runtime';
|
|
4
4
|
import '@aws-sdk/client-bedrock-agentcore';
|
|
5
5
|
|
|
@@ -177,6 +177,11 @@ interface IChatAppState {
|
|
|
177
177
|
readonly customDataForChatApp: Record<string, unknown> | undefined;
|
|
178
178
|
readonly customTitleBarActions: (ChatAppActionMenu | ChatAppAction)[];
|
|
179
179
|
readonly widgetInstances: Map<string, WidgetInstance>;
|
|
180
|
+
/**
|
|
181
|
+
* Current user information
|
|
182
|
+
* @since 0.11.0
|
|
183
|
+
*/
|
|
184
|
+
readonly user: ChatUser<RecordOrUndef>;
|
|
180
185
|
setCurrentSessionById(sessionId: string): void;
|
|
181
186
|
removeFile(s3Key: string): void;
|
|
182
187
|
startNewChatSession(): void;
|
|
@@ -187,12 +192,22 @@ interface IChatAppState {
|
|
|
187
192
|
getMessageByMessageId(messageId: string): ChatMessageForRendering | undefined;
|
|
188
193
|
uploadFiles(files: File[]): Promise<void>;
|
|
189
194
|
initializeData(): Promise<void>;
|
|
190
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Render a tag in a specific context
|
|
197
|
+
* @param metadata - Optional metadata for the widget (title, actions, icon)
|
|
198
|
+
* @since 0.11.0 - Added metadata parameter
|
|
199
|
+
*/
|
|
200
|
+
renderTag(tagId: string, context: 'spotlight' | 'inline' | 'dialog' | 'canvas' | 'static', data?: Record<string, any>, metadata?: WidgetMetadata): Promise<void>;
|
|
191
201
|
closeCanvas(): void;
|
|
192
202
|
closeDialog(): void;
|
|
193
203
|
setOrUpdateCustomTitleBarAction(action: ChatAppActionMenu | ChatAppAction): void;
|
|
194
204
|
removeCustomTitleBarAction(actionId: string): void;
|
|
195
205
|
getWidgetInstance(instanceId: string): WidgetInstance | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* Get the full context for a widget instance
|
|
208
|
+
* @since 0.11.0
|
|
209
|
+
*/
|
|
210
|
+
getWidgetContext(instanceId: string): PikaWCContext | undefined;
|
|
196
211
|
/**
|
|
197
212
|
* Update context for a widget. Call this when your widget's context has changed.
|
|
198
213
|
*
|
|
@@ -271,6 +286,7 @@ interface IChatAppState {
|
|
|
271
286
|
* @param dataKey - The key to store data under (default: 'data')
|
|
272
287
|
* @param metadata - Optional widget metadata (title, actions, icon, etc.)
|
|
273
288
|
* @returns The instance ID (UUID)
|
|
289
|
+
* @since 0.11.0 - Added metadata parameter
|
|
274
290
|
*
|
|
275
291
|
* @example
|
|
276
292
|
* ```typescript
|
|
@@ -445,14 +461,52 @@ interface IUploadInstance {
|
|
|
445
461
|
* Called after the element is created but before it's added to the DOM.
|
|
446
462
|
*/
|
|
447
463
|
interface OnReadyCallback {
|
|
448
|
-
(params:
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
464
|
+
(params: WidgetCallbackContext): void;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Action button that appears in the widget's chrome (title bar, toolbar, etc.)
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```js
|
|
471
|
+
* const action: WidgetAction = {
|
|
472
|
+
* id: 'refresh',
|
|
473
|
+
* title: 'Refresh data',
|
|
474
|
+
* iconSvg: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20">...</svg>',
|
|
475
|
+
* callback: async () => { await fetchData(); }
|
|
476
|
+
* };
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
480
|
+
*/
|
|
481
|
+
interface WidgetAction {
|
|
482
|
+
/** Unique identifier for this action */
|
|
483
|
+
id: string;
|
|
484
|
+
/** Tooltip/label for the action (also button text in dialog context) */
|
|
485
|
+
title: string;
|
|
486
|
+
/** SVG markup string for the icon (e.g., from extractIconSvg() helper) */
|
|
487
|
+
iconSvg: string;
|
|
488
|
+
/** Whether action is currently disabled */
|
|
489
|
+
disabled?: boolean;
|
|
490
|
+
/** If true, renders as default/prominent button (used in dialog context) */
|
|
491
|
+
primary?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Handler when clicked
|
|
494
|
+
* @since 0.11.0 - Callback now receives WidgetCallbackContext parameter
|
|
495
|
+
*/
|
|
496
|
+
callback: (context: WidgetCallbackContext) => void | Promise<void>;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* The context object that is passed to the onReady callback and in action callbacks functions.
|
|
500
|
+
*
|
|
501
|
+
* @since 0.11.0
|
|
502
|
+
*/
|
|
503
|
+
interface WidgetCallbackContext {
|
|
504
|
+
/** The web component element that was created */
|
|
505
|
+
element: HTMLElement;
|
|
506
|
+
/** The unique instance ID assigned to this component */
|
|
507
|
+
instanceId: string;
|
|
508
|
+
/** The full Pika context with instanceId */
|
|
509
|
+
context: PikaWCContext;
|
|
456
510
|
}
|
|
457
511
|
/**
|
|
458
512
|
* Structure for data passed to web components.
|
|
@@ -512,5 +566,92 @@ interface PikaWCContextRequestDetail {
|
|
|
512
566
|
interface PikaWCContextRequestEvent extends CustomEvent<PikaWCContextRequestDetail> {
|
|
513
567
|
detail: PikaWCContextRequestDetail;
|
|
514
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* Metadata that widgets register with the parent app
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* ```js
|
|
574
|
+
* const metadata: WidgetMetadata = {
|
|
575
|
+
* title: 'My Widget',
|
|
576
|
+
* iconSvg: '<svg>...</svg>',
|
|
577
|
+
* iconColor: '#001F3F',
|
|
578
|
+
* actions: [
|
|
579
|
+
* { id: 'refresh', title: 'Refresh', iconSvg: '<svg>...</svg>', callback: () => refresh() }
|
|
580
|
+
* ]
|
|
581
|
+
* };
|
|
582
|
+
* ```
|
|
583
|
+
*
|
|
584
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
585
|
+
*/
|
|
586
|
+
interface WidgetMetadata {
|
|
587
|
+
/** Widget title shown in chrome */
|
|
588
|
+
title: string;
|
|
589
|
+
/**
|
|
590
|
+
* Optional Lucide icon name (will be fetched automatically and set as iconSvg).
|
|
591
|
+
*
|
|
592
|
+
* The name will be snake cased as in `arrow-big-down` and not `arrowBigDown`
|
|
593
|
+
*/
|
|
594
|
+
lucideIconName?: string;
|
|
595
|
+
/** Optional icon SVG markup for the widget title */
|
|
596
|
+
iconSvg?: string;
|
|
597
|
+
/** Optional color for the widget icon (hex, rgb, or CSS color name) */
|
|
598
|
+
iconColor?: string;
|
|
599
|
+
/** Optional action buttons */
|
|
600
|
+
actions?: WidgetAction[];
|
|
601
|
+
/** Optional loading status */
|
|
602
|
+
loadingStatus?: {
|
|
603
|
+
loading: boolean;
|
|
604
|
+
loadingMsg?: string;
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Internal state tracked for each widget instance
|
|
609
|
+
*
|
|
610
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
611
|
+
*/
|
|
612
|
+
interface WidgetMetadataState extends WidgetMetadata {
|
|
613
|
+
/** Unique instance ID for this widget */
|
|
614
|
+
instanceId: string;
|
|
615
|
+
/** Widget scope (e.g., 'weather', 'pika') */
|
|
616
|
+
scope: string;
|
|
617
|
+
/** Widget tag (e.g., 'favorite-cities') */
|
|
618
|
+
tag: string;
|
|
619
|
+
/** Rendering context (spotlight, canvas, dialog, inline) */
|
|
620
|
+
renderingContext: WidgetRenderingContextType;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* This is used when manually registering a custom element as a spotlight widget by a component in the client.
|
|
624
|
+
*
|
|
625
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
626
|
+
*/
|
|
627
|
+
interface SpotlightWidgetDefinition {
|
|
628
|
+
/** @see TagDefinition.tag */
|
|
629
|
+
tag: string;
|
|
630
|
+
/** @see TagDefinition.scope */
|
|
631
|
+
scope: string;
|
|
632
|
+
/** @see TagDefinitionWidgetWebComponent.customElementName */
|
|
633
|
+
customElementName?: string;
|
|
634
|
+
/** @see TagDefinition.tagTitle */
|
|
635
|
+
tagTitle: string;
|
|
636
|
+
/** @see TagDefinitionWidgetWebComponent.sizing */
|
|
637
|
+
sizing?: WidgetSizing;
|
|
638
|
+
/** @see TagDefinition.componentAgentInstructionsMd */
|
|
639
|
+
componentAgentInstructionsMd?: Record<string, string>;
|
|
640
|
+
/**
|
|
641
|
+
* If true and there isn't an instance of this widget already created as a spotlight widget, then a new instance will be created.
|
|
642
|
+
*/
|
|
643
|
+
autoCreateInstance?: boolean;
|
|
644
|
+
/** The display order of the widget in the spotlight. If not provided, is put first. */
|
|
645
|
+
displayOrder?: number;
|
|
646
|
+
/** Defaults to true. If true, then only one instance of this widget can be created. */
|
|
647
|
+
singleton?: boolean;
|
|
648
|
+
/** If false, widget won't appear in unpinned menu. Default: true. Use false for base widgets that only create instances */
|
|
649
|
+
showInUnpinnedMenu?: boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Optional metadata (title, actions, icon) to apply to the widget when rendered
|
|
652
|
+
* @since 0.11.0
|
|
653
|
+
*/
|
|
654
|
+
metadata?: WidgetMetadata;
|
|
655
|
+
}
|
|
515
656
|
|
|
516
|
-
export type { DataForWidget, IAppState, IChatAppState, IIdentityState, IUploadInstance, IUserPrefsState, IWidgetMetadataAPI, OnReadyCallback, PikaWCContext, PikaWCContextRequestCallbackFn, PikaWCContextRequestDetail, PikaWCContextRequestEvent, PikaWCContextWithoutInstanceId, SidebarState, Snippet };
|
|
657
|
+
export type { DataForWidget, IAppState, IChatAppState, IIdentityState, IUploadInstance, IUserPrefsState, IWidgetMetadataAPI, OnReadyCallback, PikaWCContext, PikaWCContextRequestCallbackFn, PikaWCContextRequestDetail, PikaWCContextRequestEvent, PikaWCContextWithoutInstanceId, SidebarState, Snippet, SpotlightWidgetDefinition, WidgetAction, WidgetCallbackContext, WidgetMetadata, WidgetMetadataState };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UploadStatus } from '../upload-types.js';
|
|
2
|
-
import { ShowToastFn, ChatUser, RecordOrUndef, UserAwsCredentials, WidgetRenderingContextType, ShareSessionState, UserPrefs, ChatAppMode, IUserWidgetDataStoreState, CustomDataUiRepresentation, ChatAppOverridableFeatures, TagDefinition, TagDefinitionWidget, ChatSession, UserDataOverrideSettings, ChatMessageForRendering, ChatApp, ChatAppActionMenu, ChatAppAction, WidgetInstance,
|
|
2
|
+
import { ShowToastFn, ChatUser, RecordOrUndef, UserAwsCredentials, WidgetRenderingContextType, ShareSessionState, UserPrefs, ChatAppMode, IUserWidgetDataStoreState, CustomDataUiRepresentation, ChatAppOverridableFeatures, TagDefinition, TagDefinitionWidget, ChatSession, UserDataOverrideSettings, ChatMessageForRendering, ChatApp, ChatAppActionMenu, ChatAppAction, WidgetInstance, WidgetSizing, InvokeAgentAsComponentOptions } from './chatbot-types.js';
|
|
3
3
|
import '@aws-sdk/client-bedrock-agent-runtime';
|
|
4
4
|
import '@aws-sdk/client-bedrock-agentcore';
|
|
5
5
|
|
|
@@ -177,6 +177,11 @@ interface IChatAppState {
|
|
|
177
177
|
readonly customDataForChatApp: Record<string, unknown> | undefined;
|
|
178
178
|
readonly customTitleBarActions: (ChatAppActionMenu | ChatAppAction)[];
|
|
179
179
|
readonly widgetInstances: Map<string, WidgetInstance>;
|
|
180
|
+
/**
|
|
181
|
+
* Current user information
|
|
182
|
+
* @since 0.11.0
|
|
183
|
+
*/
|
|
184
|
+
readonly user: ChatUser<RecordOrUndef>;
|
|
180
185
|
setCurrentSessionById(sessionId: string): void;
|
|
181
186
|
removeFile(s3Key: string): void;
|
|
182
187
|
startNewChatSession(): void;
|
|
@@ -187,12 +192,22 @@ interface IChatAppState {
|
|
|
187
192
|
getMessageByMessageId(messageId: string): ChatMessageForRendering | undefined;
|
|
188
193
|
uploadFiles(files: File[]): Promise<void>;
|
|
189
194
|
initializeData(): Promise<void>;
|
|
190
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Render a tag in a specific context
|
|
197
|
+
* @param metadata - Optional metadata for the widget (title, actions, icon)
|
|
198
|
+
* @since 0.11.0 - Added metadata parameter
|
|
199
|
+
*/
|
|
200
|
+
renderTag(tagId: string, context: 'spotlight' | 'inline' | 'dialog' | 'canvas' | 'static', data?: Record<string, any>, metadata?: WidgetMetadata): Promise<void>;
|
|
191
201
|
closeCanvas(): void;
|
|
192
202
|
closeDialog(): void;
|
|
193
203
|
setOrUpdateCustomTitleBarAction(action: ChatAppActionMenu | ChatAppAction): void;
|
|
194
204
|
removeCustomTitleBarAction(actionId: string): void;
|
|
195
205
|
getWidgetInstance(instanceId: string): WidgetInstance | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* Get the full context for a widget instance
|
|
208
|
+
* @since 0.11.0
|
|
209
|
+
*/
|
|
210
|
+
getWidgetContext(instanceId: string): PikaWCContext | undefined;
|
|
196
211
|
/**
|
|
197
212
|
* Update context for a widget. Call this when your widget's context has changed.
|
|
198
213
|
*
|
|
@@ -271,6 +286,7 @@ interface IChatAppState {
|
|
|
271
286
|
* @param dataKey - The key to store data under (default: 'data')
|
|
272
287
|
* @param metadata - Optional widget metadata (title, actions, icon, etc.)
|
|
273
288
|
* @returns The instance ID (UUID)
|
|
289
|
+
* @since 0.11.0 - Added metadata parameter
|
|
274
290
|
*
|
|
275
291
|
* @example
|
|
276
292
|
* ```typescript
|
|
@@ -445,14 +461,52 @@ interface IUploadInstance {
|
|
|
445
461
|
* Called after the element is created but before it's added to the DOM.
|
|
446
462
|
*/
|
|
447
463
|
interface OnReadyCallback {
|
|
448
|
-
(params:
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
464
|
+
(params: WidgetCallbackContext): void;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Action button that appears in the widget's chrome (title bar, toolbar, etc.)
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```js
|
|
471
|
+
* const action: WidgetAction = {
|
|
472
|
+
* id: 'refresh',
|
|
473
|
+
* title: 'Refresh data',
|
|
474
|
+
* iconSvg: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20">...</svg>',
|
|
475
|
+
* callback: async () => { await fetchData(); }
|
|
476
|
+
* };
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
480
|
+
*/
|
|
481
|
+
interface WidgetAction {
|
|
482
|
+
/** Unique identifier for this action */
|
|
483
|
+
id: string;
|
|
484
|
+
/** Tooltip/label for the action (also button text in dialog context) */
|
|
485
|
+
title: string;
|
|
486
|
+
/** SVG markup string for the icon (e.g., from extractIconSvg() helper) */
|
|
487
|
+
iconSvg: string;
|
|
488
|
+
/** Whether action is currently disabled */
|
|
489
|
+
disabled?: boolean;
|
|
490
|
+
/** If true, renders as default/prominent button (used in dialog context) */
|
|
491
|
+
primary?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Handler when clicked
|
|
494
|
+
* @since 0.11.0 - Callback now receives WidgetCallbackContext parameter
|
|
495
|
+
*/
|
|
496
|
+
callback: (context: WidgetCallbackContext) => void | Promise<void>;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* The context object that is passed to the onReady callback and in action callbacks functions.
|
|
500
|
+
*
|
|
501
|
+
* @since 0.11.0
|
|
502
|
+
*/
|
|
503
|
+
interface WidgetCallbackContext {
|
|
504
|
+
/** The web component element that was created */
|
|
505
|
+
element: HTMLElement;
|
|
506
|
+
/** The unique instance ID assigned to this component */
|
|
507
|
+
instanceId: string;
|
|
508
|
+
/** The full Pika context with instanceId */
|
|
509
|
+
context: PikaWCContext;
|
|
456
510
|
}
|
|
457
511
|
/**
|
|
458
512
|
* Structure for data passed to web components.
|
|
@@ -512,5 +566,92 @@ interface PikaWCContextRequestDetail {
|
|
|
512
566
|
interface PikaWCContextRequestEvent extends CustomEvent<PikaWCContextRequestDetail> {
|
|
513
567
|
detail: PikaWCContextRequestDetail;
|
|
514
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* Metadata that widgets register with the parent app
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* ```js
|
|
574
|
+
* const metadata: WidgetMetadata = {
|
|
575
|
+
* title: 'My Widget',
|
|
576
|
+
* iconSvg: '<svg>...</svg>',
|
|
577
|
+
* iconColor: '#001F3F',
|
|
578
|
+
* actions: [
|
|
579
|
+
* { id: 'refresh', title: 'Refresh', iconSvg: '<svg>...</svg>', callback: () => refresh() }
|
|
580
|
+
* ]
|
|
581
|
+
* };
|
|
582
|
+
* ```
|
|
583
|
+
*
|
|
584
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
585
|
+
*/
|
|
586
|
+
interface WidgetMetadata {
|
|
587
|
+
/** Widget title shown in chrome */
|
|
588
|
+
title: string;
|
|
589
|
+
/**
|
|
590
|
+
* Optional Lucide icon name (will be fetched automatically and set as iconSvg).
|
|
591
|
+
*
|
|
592
|
+
* The name will be snake cased as in `arrow-big-down` and not `arrowBigDown`
|
|
593
|
+
*/
|
|
594
|
+
lucideIconName?: string;
|
|
595
|
+
/** Optional icon SVG markup for the widget title */
|
|
596
|
+
iconSvg?: string;
|
|
597
|
+
/** Optional color for the widget icon (hex, rgb, or CSS color name) */
|
|
598
|
+
iconColor?: string;
|
|
599
|
+
/** Optional action buttons */
|
|
600
|
+
actions?: WidgetAction[];
|
|
601
|
+
/** Optional loading status */
|
|
602
|
+
loadingStatus?: {
|
|
603
|
+
loading: boolean;
|
|
604
|
+
loadingMsg?: string;
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Internal state tracked for each widget instance
|
|
609
|
+
*
|
|
610
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
611
|
+
*/
|
|
612
|
+
interface WidgetMetadataState extends WidgetMetadata {
|
|
613
|
+
/** Unique instance ID for this widget */
|
|
614
|
+
instanceId: string;
|
|
615
|
+
/** Widget scope (e.g., 'weather', 'pika') */
|
|
616
|
+
scope: string;
|
|
617
|
+
/** Widget tag (e.g., 'favorite-cities') */
|
|
618
|
+
tag: string;
|
|
619
|
+
/** Rendering context (spotlight, canvas, dialog, inline) */
|
|
620
|
+
renderingContext: WidgetRenderingContextType;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* This is used when manually registering a custom element as a spotlight widget by a component in the client.
|
|
624
|
+
*
|
|
625
|
+
* @since 0.11.0 - Moved from chatbot-types to webcomp-types
|
|
626
|
+
*/
|
|
627
|
+
interface SpotlightWidgetDefinition {
|
|
628
|
+
/** @see TagDefinition.tag */
|
|
629
|
+
tag: string;
|
|
630
|
+
/** @see TagDefinition.scope */
|
|
631
|
+
scope: string;
|
|
632
|
+
/** @see TagDefinitionWidgetWebComponent.customElementName */
|
|
633
|
+
customElementName?: string;
|
|
634
|
+
/** @see TagDefinition.tagTitle */
|
|
635
|
+
tagTitle: string;
|
|
636
|
+
/** @see TagDefinitionWidgetWebComponent.sizing */
|
|
637
|
+
sizing?: WidgetSizing;
|
|
638
|
+
/** @see TagDefinition.componentAgentInstructionsMd */
|
|
639
|
+
componentAgentInstructionsMd?: Record<string, string>;
|
|
640
|
+
/**
|
|
641
|
+
* If true and there isn't an instance of this widget already created as a spotlight widget, then a new instance will be created.
|
|
642
|
+
*/
|
|
643
|
+
autoCreateInstance?: boolean;
|
|
644
|
+
/** The display order of the widget in the spotlight. If not provided, is put first. */
|
|
645
|
+
displayOrder?: number;
|
|
646
|
+
/** Defaults to true. If true, then only one instance of this widget can be created. */
|
|
647
|
+
singleton?: boolean;
|
|
648
|
+
/** If false, widget won't appear in unpinned menu. Default: true. Use false for base widgets that only create instances */
|
|
649
|
+
showInUnpinnedMenu?: boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Optional metadata (title, actions, icon) to apply to the widget when rendered
|
|
652
|
+
* @since 0.11.0
|
|
653
|
+
*/
|
|
654
|
+
metadata?: WidgetMetadata;
|
|
655
|
+
}
|
|
515
656
|
|
|
516
|
-
export type { DataForWidget, IAppState, IChatAppState, IIdentityState, IUploadInstance, IUserPrefsState, IWidgetMetadataAPI, OnReadyCallback, PikaWCContext, PikaWCContextRequestCallbackFn, PikaWCContextRequestDetail, PikaWCContextRequestEvent, PikaWCContextWithoutInstanceId, SidebarState, Snippet };
|
|
657
|
+
export type { DataForWidget, IAppState, IChatAppState, IIdentityState, IUploadInstance, IUserPrefsState, IWidgetMetadataAPI, OnReadyCallback, PikaWCContext, PikaWCContextRequestCallbackFn, PikaWCContextRequestDetail, PikaWCContextRequestEvent, PikaWCContextWithoutInstanceId, SidebarState, Snippet, SpotlightWidgetDefinition, WidgetAction, WidgetCallbackContext, WidgetMetadata, WidgetMetadataState };
|