pixelon 0.3.27 → 0.3.29
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/components/atoms/chat/CurrencyDisplay/ChatCurrencyDisplay.d.ts +18 -0
- package/dist/components/atoms/chat/CurrencyDisplay/index.d.ts +2 -0
- package/dist/components/atoms/chat/index.d.ts +2 -0
- package/dist/components/molecules/chat/StructuredContent/components/ReactiveForm/CostSummaryField.d.ts +13 -0
- package/dist/components/molecules/chat/StructuredContent/components/ReactiveForm/ReactiveFormView.d.ts +2 -0
- package/dist/components/molecules/chat/StructuredContent/components/ReactiveForm/types.d.ts +19 -1
- package/dist/components/molecules/chat/StructuredContent/components/ReactiveForm/useReactiveForm.d.ts +1 -0
- package/dist/components/molecules/chat/StructuredContent/components/SelectWithConfirm/types.d.ts +11 -0
- package/dist/components/molecules/chat/StructuredContent/components/SelectWithConfirm/useSelectEndpoint.d.ts +11 -0
- package/dist/components/molecules/chat/StructuredContent/components/index.d.ts +1 -0
- package/dist/components/molecules/chat/StructuredContent/helpers/AnsweredSummary.d.ts +5 -0
- package/dist/components/molecules/chat/StructuredContent/helpers/types.d.ts +18 -0
- package/dist/components/molecules/chat/StructuredContent/helpers/useComponentInteraction.d.ts +1 -1
- package/dist/core/chat/ChatConfigContext.d.ts +8 -0
- package/dist/core/eventBus/chatEventBus.d.ts +8 -1
- package/dist/index.esm.js +443 -99
- package/dist/index.js +443 -99
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './ChatCurrencyDisplay.scss';
|
|
3
|
+
export interface ChatCurrencyDisplayProps {
|
|
4
|
+
/** Numeric value to display */
|
|
5
|
+
value: number | string | null | undefined;
|
|
6
|
+
/** Override currency code (defaults to ChatConfig.currency.code) */
|
|
7
|
+
currencyCode?: string;
|
|
8
|
+
/** Override currency symbol (defaults to ChatConfig.currency.symbol) */
|
|
9
|
+
currencySymbol?: string;
|
|
10
|
+
/** Show the currency code (e.g. "COP") */
|
|
11
|
+
showCode?: boolean;
|
|
12
|
+
/** Size variant */
|
|
13
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
/** Additional CSS class */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const ChatCurrencyDisplay: React.FC<ChatCurrencyDisplayProps>;
|
|
18
|
+
export default ChatCurrencyDisplay;
|
|
@@ -13,5 +13,7 @@ export { default as Textarea } from './Textarea/Textarea';
|
|
|
13
13
|
export * from './Icon/Icon';
|
|
14
14
|
export * from './AudioWaves/AudioWaves';
|
|
15
15
|
export * from './DateDivider/DateDivider';
|
|
16
|
+
export { ChatCurrencyDisplay } from './CurrencyDisplay';
|
|
17
|
+
export type { ChatCurrencyDisplayProps } from './CurrencyDisplay';
|
|
16
18
|
export { default as Loader } from './Loader/Loader';
|
|
17
19
|
export * from './Loader/Loader';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactiveFormField, FieldState } from './types';
|
|
3
|
+
import type { ChatEventBus } from '../../../../../../core/eventBus';
|
|
4
|
+
interface CostSummaryFieldProps {
|
|
5
|
+
field: ReactiveFormField;
|
|
6
|
+
values: Record<string, unknown>;
|
|
7
|
+
fieldStates: Record<string, FieldState>;
|
|
8
|
+
eventBus?: ChatEventBus;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
onCostResolved?: (fieldName: string, label: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const CostSummaryField: React.FC<CostSummaryFieldProps>;
|
|
13
|
+
export {};
|
|
@@ -2,9 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import type { ReactiveFormProps } from './types';
|
|
3
3
|
import type { UseReactiveFormReturn } from './useReactiveForm';
|
|
4
4
|
import './ReactiveFormView.scss';
|
|
5
|
+
import { type ChatEventBus } from '../../../../../../core/eventBus';
|
|
5
6
|
interface ReactiveFormViewProps extends ReactiveFormProps {
|
|
6
7
|
form: UseReactiveFormReturn;
|
|
7
8
|
drawerPlacement?: 'bottom' | 'right';
|
|
9
|
+
eventBus?: ChatEventBus;
|
|
8
10
|
}
|
|
9
11
|
export declare const ReactiveFormView: React.FC<ReactiveFormViewProps>;
|
|
10
12
|
export {};
|
|
@@ -16,6 +16,7 @@ export interface FieldEndpoint {
|
|
|
16
16
|
value_field: string;
|
|
17
17
|
label_field: string;
|
|
18
18
|
extra_fields?: string[];
|
|
19
|
+
total_field?: string;
|
|
19
20
|
}
|
|
20
21
|
export interface FieldOptionsFrom {
|
|
21
22
|
source_field: string;
|
|
@@ -39,10 +40,19 @@ export interface FieldValidation {
|
|
|
39
40
|
};
|
|
40
41
|
email?: string;
|
|
41
42
|
}
|
|
43
|
+
export interface CostSummaryItemsFrom {
|
|
44
|
+
source_field: string;
|
|
45
|
+
label_key: string;
|
|
46
|
+
value_key: string;
|
|
47
|
+
}
|
|
48
|
+
export interface CostSummaryOnCancel {
|
|
49
|
+
type: 'system_message';
|
|
50
|
+
message: string;
|
|
51
|
+
}
|
|
42
52
|
export interface ReactiveFormField {
|
|
43
53
|
name: string;
|
|
44
54
|
label?: string;
|
|
45
|
-
type: 'select' | 'select_multiple' | 'date' | 'time' | 'text' | 'email' | 'number' | 'textarea' | 'hidden';
|
|
55
|
+
type: 'select' | 'select_multiple' | 'date' | 'time' | 'text' | 'email' | 'number' | 'textarea' | 'hidden' | 'cost_summary';
|
|
46
56
|
default_value?: unknown;
|
|
47
57
|
placeholder?: string;
|
|
48
58
|
validation?: FieldValidation;
|
|
@@ -56,6 +66,13 @@ export interface ReactiveFormField {
|
|
|
56
66
|
default_match?: string[];
|
|
57
67
|
min_date?: string;
|
|
58
68
|
max_date?: string;
|
|
69
|
+
empty_message?: string;
|
|
70
|
+
items_from?: CostSummaryItemsFrom;
|
|
71
|
+
on_cancel?: CostSummaryOnCancel;
|
|
72
|
+
}
|
|
73
|
+
export interface ReactiveFormSubmitOnSuccess {
|
|
74
|
+
type: 'system_message';
|
|
75
|
+
message: string;
|
|
59
76
|
}
|
|
60
77
|
export interface ReactiveFormSubmit {
|
|
61
78
|
url: string;
|
|
@@ -63,6 +80,7 @@ export interface ReactiveFormSubmit {
|
|
|
63
80
|
service: string;
|
|
64
81
|
label: string;
|
|
65
82
|
payload_map: Record<string, unknown>;
|
|
83
|
+
on_success?: ReactiveFormSubmitOnSuccess;
|
|
66
84
|
}
|
|
67
85
|
export interface SummaryAction {
|
|
68
86
|
label: string;
|
|
@@ -21,6 +21,7 @@ export interface UseReactiveFormReturn {
|
|
|
21
21
|
handleNext: () => Promise<void>;
|
|
22
22
|
handleBack: () => void;
|
|
23
23
|
handleSubmit: () => Promise<void>;
|
|
24
|
+
isSubmitting: boolean;
|
|
24
25
|
getDependencies: (field: ReactiveFormField) => string[];
|
|
25
26
|
allDepsResolved: (deps: string[], formValues: Record<string, unknown>) => boolean;
|
|
26
27
|
resolveSummaryRows: (rows: Array<{
|
package/dist/components/molecules/chat/StructuredContent/components/SelectWithConfirm/types.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SelectOption } from '../../../../../atoms/chat/Select';
|
|
2
|
+
export interface SelectEndpoint {
|
|
3
|
+
url: string;
|
|
4
|
+
method: string;
|
|
5
|
+
service: string;
|
|
6
|
+
body?: Record<string, unknown>;
|
|
7
|
+
response_path?: string;
|
|
8
|
+
value_field: string;
|
|
9
|
+
label_field: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function mapResponseToOptions(data: unknown, endpoint: SelectEndpoint): SelectOption[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SelectOption } from '../../../../../atoms/chat/Select';
|
|
2
|
+
import type { ChatEventBus } from '../../../../../../core/eventBus';
|
|
3
|
+
import type { SelectEndpoint } from './types';
|
|
4
|
+
export type SelectEndpointStatus = 'idle' | 'loading' | 'error';
|
|
5
|
+
interface UseSelectEndpointResult {
|
|
6
|
+
options: SelectOption[];
|
|
7
|
+
status: SelectEndpointStatus;
|
|
8
|
+
errorMessage: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function useSelectEndpoint(endpoint?: SelectEndpoint, eventBus?: ChatEventBus): UseSelectEndpointResult;
|
|
11
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { SelectWithConfirm } from './SelectWithConfirm/SelectWithConfirm';
|
|
2
|
+
export type { SelectEndpoint } from './SelectWithConfirm/types';
|
|
2
3
|
export { SelectMultipleWithConfirm } from './SelectMultipleWithConfirm/SelectMultipleWithConfirm';
|
|
3
4
|
export { InputWithConfirm } from './InputWithConfirm/InputWithConfirm';
|
|
4
5
|
export { DateInputWithConfirm } from './DateInputWithConfirm/DateInputWithConfirm';
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import type { ChatEventBus } from '../../../../../core/eventBus';
|
|
2
|
+
export interface ComponentAction {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
kind?: string;
|
|
6
|
+
emits_value?: boolean;
|
|
7
|
+
value?: unknown;
|
|
8
|
+
intent?: 'primary' | 'secondary' | 'danger';
|
|
9
|
+
}
|
|
2
10
|
export interface UIComponentData {
|
|
3
11
|
type: string;
|
|
4
12
|
props: Record<string, unknown>;
|
|
13
|
+
status?: string;
|
|
14
|
+
visibility_policy?: 'hide_on_terminal' | 'keep_visible' | 'collapse';
|
|
15
|
+
actions?: ComponentAction[];
|
|
16
|
+
/** SPEC-023: respuesta persistida por el backend al cerrar el componente */
|
|
17
|
+
selected_values?: Array<{
|
|
18
|
+
value: unknown;
|
|
19
|
+
label: string;
|
|
20
|
+
}>;
|
|
21
|
+
/** @deprecated contrato legacy (pre SPEC-023); usar status */
|
|
5
22
|
answered?: boolean;
|
|
6
23
|
}
|
|
7
24
|
export interface ChatComponentProps {
|
|
@@ -10,4 +27,5 @@ export interface ChatComponentProps {
|
|
|
10
27
|
assistantMessageId?: string;
|
|
11
28
|
}
|
|
12
29
|
export type OnConfirm = (value: unknown, label: string) => void;
|
|
30
|
+
export declare const TERMINAL_STATUS: Set<string>;
|
|
13
31
|
export declare const DISPLAY_COMPONENTS: Set<string>;
|
package/dist/components/molecules/chat/StructuredContent/helpers/useComponentInteraction.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface UseComponentInteractionParams {
|
|
|
6
6
|
assistantMessageId: string;
|
|
7
7
|
}
|
|
8
8
|
export declare function useComponentInteraction({ eventBus, fieldName, componentType, assistantMessageId, }: UseComponentInteractionParams): {
|
|
9
|
-
emitInteraction: (value: unknown, label: string) => void;
|
|
9
|
+
emitInteraction: (value: unknown, label: string, actionId?: string) => void;
|
|
10
10
|
isConfirmed: boolean;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
export interface ChatCurrency {
|
|
3
|
+
/** ISO 4217 currency code (e.g. "COP", "USD") */
|
|
4
|
+
code: string;
|
|
5
|
+
/** Currency symbol (e.g. "$", "€") */
|
|
6
|
+
symbol?: string;
|
|
7
|
+
}
|
|
2
8
|
export interface ChatConfig {
|
|
3
9
|
/** IANA timezone identifier (e.g. "America/Bogota") */
|
|
4
10
|
timezone: string;
|
|
5
11
|
/** BCP 47 locale string (e.g. "es-CO") */
|
|
6
12
|
locale: string;
|
|
13
|
+
/** Currency info for formatting monetary values */
|
|
14
|
+
currency?: ChatCurrency;
|
|
7
15
|
/** Title displayed in the chat header */
|
|
8
16
|
headerTitle: string;
|
|
9
17
|
/** Subtitle displayed in the chat header */
|
|
@@ -26,6 +26,8 @@ export type ChatEvents = {
|
|
|
26
26
|
label: string;
|
|
27
27
|
componentType: string;
|
|
28
28
|
assistantMessageId: string;
|
|
29
|
+
/** SPEC-023 T8: id de la Action disparada (opcional) */
|
|
30
|
+
actionId?: string;
|
|
29
31
|
};
|
|
30
32
|
/** Consumer -> Chat: update the displayed messages */
|
|
31
33
|
messagesUpdated: {
|
|
@@ -82,6 +84,10 @@ export type ChatEvents = {
|
|
|
82
84
|
result: unknown;
|
|
83
85
|
formValues: Record<string, unknown>;
|
|
84
86
|
formLabels?: Record<string, string>;
|
|
87
|
+
onSuccess?: {
|
|
88
|
+
type: string;
|
|
89
|
+
message: string;
|
|
90
|
+
};
|
|
85
91
|
};
|
|
86
92
|
/** Backend -> Consumer: agent lifecycle event from WebSocket */
|
|
87
93
|
agentEvent: {
|
|
@@ -107,7 +113,8 @@ export type ChatEvents = {
|
|
|
107
113
|
chatId: string;
|
|
108
114
|
formTitle: string;
|
|
109
115
|
source?: string;
|
|
110
|
-
phase: 'request' | 'response';
|
|
116
|
+
phase: 'request' | 'response' | 'cancel';
|
|
117
|
+
data?: Record<string, unknown>;
|
|
111
118
|
service: string;
|
|
112
119
|
url: string;
|
|
113
120
|
method: string;
|