pixelon 0.3.27 → 0.3.28
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/core/chat/ChatConfigContext.d.ts +8 -0
- package/dist/core/eventBus/chatEventBus.d.ts +6 -1
- package/dist/index.esm.js +376 -96
- package/dist/index.js +376 -96
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -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,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 */
|
|
@@ -82,6 +82,10 @@ export type ChatEvents = {
|
|
|
82
82
|
result: unknown;
|
|
83
83
|
formValues: Record<string, unknown>;
|
|
84
84
|
formLabels?: Record<string, string>;
|
|
85
|
+
onSuccess?: {
|
|
86
|
+
type: string;
|
|
87
|
+
message: string;
|
|
88
|
+
};
|
|
85
89
|
};
|
|
86
90
|
/** Backend -> Consumer: agent lifecycle event from WebSocket */
|
|
87
91
|
agentEvent: {
|
|
@@ -107,7 +111,8 @@ export type ChatEvents = {
|
|
|
107
111
|
chatId: string;
|
|
108
112
|
formTitle: string;
|
|
109
113
|
source?: string;
|
|
110
|
-
phase: 'request' | 'response';
|
|
114
|
+
phase: 'request' | 'response' | 'cancel';
|
|
115
|
+
data?: Record<string, unknown>;
|
|
111
116
|
service: string;
|
|
112
117
|
url: string;
|
|
113
118
|
method: string;
|