@prodact.ai/sdk 0.0.2 → 0.0.6
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/cdn/sdk.global.js +367 -0
- package/dist/cdn/sdk.global.js.map +1 -0
- package/dist/index.js +2153 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2136 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +2906 -409
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +2921 -425
- package/dist/react.mjs.map +1 -1
- package/package.json +11 -2
- package/dist/index.d.mts +0 -135
- package/dist/index.d.ts +0 -135
- package/dist/react.d.mts +0 -244
- package/dist/react.d.ts +0 -244
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prodact.ai/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Interactive SDK for Prodact.ai - AI-powered UI interactions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"types": "./dist/react.d.ts",
|
|
16
16
|
"import": "./dist/react.mjs",
|
|
17
17
|
"require": "./dist/react.js"
|
|
18
|
+
},
|
|
19
|
+
"./cdn": {
|
|
20
|
+
"import": "./dist/cdn/sdk.js",
|
|
21
|
+
"require": "./dist/cdn/sdk.js"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
24
|
"files": [
|
|
@@ -23,11 +27,16 @@
|
|
|
23
27
|
],
|
|
24
28
|
"scripts": {
|
|
25
29
|
"build": "tsup",
|
|
30
|
+
"build:cdn": "tsup --config tsup.cdn.config.ts",
|
|
26
31
|
"build:wordpress": "tsup --config tsup.wordpress.config.ts",
|
|
32
|
+
"build:all": "npm run build && npm run build:cdn",
|
|
27
33
|
"dev": "tsup --watch",
|
|
28
34
|
"lint": "eslint src",
|
|
29
35
|
"typecheck": "tsc --noEmit",
|
|
30
|
-
"prepublishOnly": "npm run build"
|
|
36
|
+
"prepublishOnly": "npm run build:all"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"rrweb": "^2.0.0-alpha.17"
|
|
31
40
|
},
|
|
32
41
|
"peerDependencies": {
|
|
33
42
|
"react": ">=18.0.0",
|
package/dist/index.d.mts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
interface ProduckConfig {
|
|
2
|
-
guiderId?: string;
|
|
3
|
-
sdkKey?: string;
|
|
4
|
-
apiUrl?: string;
|
|
5
|
-
onAction?: (actionKey: string, action: ActionPayload) => void;
|
|
6
|
-
onMessage?: (message: ChatMessage) => void;
|
|
7
|
-
onError?: (error: Error) => void;
|
|
8
|
-
onFlowStart?: (flow: FlowPayload) => void;
|
|
9
|
-
onFlowStepComplete?: (step: FlowStepResult, flow: FlowPayload) => void;
|
|
10
|
-
onFlowComplete?: (result: FlowResult) => void;
|
|
11
|
-
}
|
|
12
|
-
interface ActionPayload {
|
|
13
|
-
actionKey: string;
|
|
14
|
-
name: string;
|
|
15
|
-
actionType: string;
|
|
16
|
-
actionConfig: Record<string, any>;
|
|
17
|
-
responseMessage?: string;
|
|
18
|
-
}
|
|
19
|
-
interface FlowStep {
|
|
20
|
-
operationId: string;
|
|
21
|
-
order: number;
|
|
22
|
-
condition?: Record<string, any>;
|
|
23
|
-
inputMapping?: Record<string, any>;
|
|
24
|
-
}
|
|
25
|
-
interface FlowPayload {
|
|
26
|
-
flowId: string;
|
|
27
|
-
name: string;
|
|
28
|
-
description: string;
|
|
29
|
-
steps: FlowStep[];
|
|
30
|
-
}
|
|
31
|
-
interface FlowStepResult {
|
|
32
|
-
operationId: string;
|
|
33
|
-
order: number;
|
|
34
|
-
success: boolean;
|
|
35
|
-
data?: any;
|
|
36
|
-
error?: string;
|
|
37
|
-
}
|
|
38
|
-
interface FlowResult {
|
|
39
|
-
flowId: string;
|
|
40
|
-
name: string;
|
|
41
|
-
steps: FlowStepResult[];
|
|
42
|
-
completed: boolean;
|
|
43
|
-
totalSteps: number;
|
|
44
|
-
successfulSteps: number;
|
|
45
|
-
}
|
|
46
|
-
interface ChatMessage {
|
|
47
|
-
role: 'user' | 'assistant';
|
|
48
|
-
content: string;
|
|
49
|
-
action?: ActionPayload;
|
|
50
|
-
flow?: FlowPayload;
|
|
51
|
-
flowResult?: FlowResult;
|
|
52
|
-
}
|
|
53
|
-
interface ActionHandler {
|
|
54
|
-
(payload: ActionPayload): void | Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
interface RegisteredAction {
|
|
57
|
-
key: string;
|
|
58
|
-
handler: ActionHandler;
|
|
59
|
-
}
|
|
60
|
-
type ProduckEventType = 'action' | 'message' | 'error' | 'ready' | 'flowStart' | 'flowStepComplete' | 'flowComplete';
|
|
61
|
-
interface ProduckEvent {
|
|
62
|
-
type: ProduckEventType;
|
|
63
|
-
data: any;
|
|
64
|
-
}
|
|
65
|
-
declare class ProduckSDK {
|
|
66
|
-
private config;
|
|
67
|
-
private actions;
|
|
68
|
-
private eventListeners;
|
|
69
|
-
private sessionToken;
|
|
70
|
-
private isReady;
|
|
71
|
-
constructor(config: ProduckConfig);
|
|
72
|
-
/**
|
|
73
|
-
* Initialize the SDK and create a chat session
|
|
74
|
-
*/
|
|
75
|
-
init(): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Register an action handler
|
|
78
|
-
*/
|
|
79
|
-
register(actionKey: string, handler: ActionHandler): void;
|
|
80
|
-
/**
|
|
81
|
-
* Unregister an action handler
|
|
82
|
-
*/
|
|
83
|
-
unregister(actionKey: string): void;
|
|
84
|
-
/**
|
|
85
|
-
* Send a message and handle potential action or flow triggers
|
|
86
|
-
*/
|
|
87
|
-
sendMessage(message: string): Promise<ChatMessage>;
|
|
88
|
-
/**
|
|
89
|
-
* Execute a flow by running each step's operation sequentially
|
|
90
|
-
*/
|
|
91
|
-
executeFlow(flow: FlowPayload): Promise<FlowResult>;
|
|
92
|
-
/**
|
|
93
|
-
* Send log data to backend for analytics
|
|
94
|
-
*/
|
|
95
|
-
private sendLogToBackend;
|
|
96
|
-
/**
|
|
97
|
-
* Send detailed log to backend
|
|
98
|
-
*/
|
|
99
|
-
private log;
|
|
100
|
-
/**
|
|
101
|
-
* Execute a registered action
|
|
102
|
-
*/
|
|
103
|
-
private executeAction;
|
|
104
|
-
/**
|
|
105
|
-
* Add event listener
|
|
106
|
-
*/
|
|
107
|
-
on(event: ProduckEventType, callback: Function): void;
|
|
108
|
-
/**
|
|
109
|
-
* Remove event listener
|
|
110
|
-
*/
|
|
111
|
-
off(event: ProduckEventType, callback: Function): void;
|
|
112
|
-
/**
|
|
113
|
-
* Emit event
|
|
114
|
-
*/
|
|
115
|
-
private emit;
|
|
116
|
-
/**
|
|
117
|
-
* Get session token
|
|
118
|
-
*/
|
|
119
|
-
getSessionToken(): string | null;
|
|
120
|
-
/**
|
|
121
|
-
* Check if SDK is ready
|
|
122
|
-
*/
|
|
123
|
-
getIsReady(): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Get registered action keys
|
|
126
|
-
*/
|
|
127
|
-
getRegisteredActions(): string[];
|
|
128
|
-
/**
|
|
129
|
-
* Destroy the SDK instance
|
|
130
|
-
*/
|
|
131
|
-
destroy(): void;
|
|
132
|
-
}
|
|
133
|
-
declare function createProduck(config: ProduckConfig): ProduckSDK;
|
|
134
|
-
|
|
135
|
-
export { type ActionHandler, type ActionPayload, type ChatMessage, type FlowPayload, type FlowResult, type FlowStep, type FlowStepResult, type ProduckConfig, type ProduckEvent, type ProduckEventType, ProduckSDK, type RegisteredAction, createProduck };
|
package/dist/index.d.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
interface ProduckConfig {
|
|
2
|
-
guiderId?: string;
|
|
3
|
-
sdkKey?: string;
|
|
4
|
-
apiUrl?: string;
|
|
5
|
-
onAction?: (actionKey: string, action: ActionPayload) => void;
|
|
6
|
-
onMessage?: (message: ChatMessage) => void;
|
|
7
|
-
onError?: (error: Error) => void;
|
|
8
|
-
onFlowStart?: (flow: FlowPayload) => void;
|
|
9
|
-
onFlowStepComplete?: (step: FlowStepResult, flow: FlowPayload) => void;
|
|
10
|
-
onFlowComplete?: (result: FlowResult) => void;
|
|
11
|
-
}
|
|
12
|
-
interface ActionPayload {
|
|
13
|
-
actionKey: string;
|
|
14
|
-
name: string;
|
|
15
|
-
actionType: string;
|
|
16
|
-
actionConfig: Record<string, any>;
|
|
17
|
-
responseMessage?: string;
|
|
18
|
-
}
|
|
19
|
-
interface FlowStep {
|
|
20
|
-
operationId: string;
|
|
21
|
-
order: number;
|
|
22
|
-
condition?: Record<string, any>;
|
|
23
|
-
inputMapping?: Record<string, any>;
|
|
24
|
-
}
|
|
25
|
-
interface FlowPayload {
|
|
26
|
-
flowId: string;
|
|
27
|
-
name: string;
|
|
28
|
-
description: string;
|
|
29
|
-
steps: FlowStep[];
|
|
30
|
-
}
|
|
31
|
-
interface FlowStepResult {
|
|
32
|
-
operationId: string;
|
|
33
|
-
order: number;
|
|
34
|
-
success: boolean;
|
|
35
|
-
data?: any;
|
|
36
|
-
error?: string;
|
|
37
|
-
}
|
|
38
|
-
interface FlowResult {
|
|
39
|
-
flowId: string;
|
|
40
|
-
name: string;
|
|
41
|
-
steps: FlowStepResult[];
|
|
42
|
-
completed: boolean;
|
|
43
|
-
totalSteps: number;
|
|
44
|
-
successfulSteps: number;
|
|
45
|
-
}
|
|
46
|
-
interface ChatMessage {
|
|
47
|
-
role: 'user' | 'assistant';
|
|
48
|
-
content: string;
|
|
49
|
-
action?: ActionPayload;
|
|
50
|
-
flow?: FlowPayload;
|
|
51
|
-
flowResult?: FlowResult;
|
|
52
|
-
}
|
|
53
|
-
interface ActionHandler {
|
|
54
|
-
(payload: ActionPayload): void | Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
interface RegisteredAction {
|
|
57
|
-
key: string;
|
|
58
|
-
handler: ActionHandler;
|
|
59
|
-
}
|
|
60
|
-
type ProduckEventType = 'action' | 'message' | 'error' | 'ready' | 'flowStart' | 'flowStepComplete' | 'flowComplete';
|
|
61
|
-
interface ProduckEvent {
|
|
62
|
-
type: ProduckEventType;
|
|
63
|
-
data: any;
|
|
64
|
-
}
|
|
65
|
-
declare class ProduckSDK {
|
|
66
|
-
private config;
|
|
67
|
-
private actions;
|
|
68
|
-
private eventListeners;
|
|
69
|
-
private sessionToken;
|
|
70
|
-
private isReady;
|
|
71
|
-
constructor(config: ProduckConfig);
|
|
72
|
-
/**
|
|
73
|
-
* Initialize the SDK and create a chat session
|
|
74
|
-
*/
|
|
75
|
-
init(): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Register an action handler
|
|
78
|
-
*/
|
|
79
|
-
register(actionKey: string, handler: ActionHandler): void;
|
|
80
|
-
/**
|
|
81
|
-
* Unregister an action handler
|
|
82
|
-
*/
|
|
83
|
-
unregister(actionKey: string): void;
|
|
84
|
-
/**
|
|
85
|
-
* Send a message and handle potential action or flow triggers
|
|
86
|
-
*/
|
|
87
|
-
sendMessage(message: string): Promise<ChatMessage>;
|
|
88
|
-
/**
|
|
89
|
-
* Execute a flow by running each step's operation sequentially
|
|
90
|
-
*/
|
|
91
|
-
executeFlow(flow: FlowPayload): Promise<FlowResult>;
|
|
92
|
-
/**
|
|
93
|
-
* Send log data to backend for analytics
|
|
94
|
-
*/
|
|
95
|
-
private sendLogToBackend;
|
|
96
|
-
/**
|
|
97
|
-
* Send detailed log to backend
|
|
98
|
-
*/
|
|
99
|
-
private log;
|
|
100
|
-
/**
|
|
101
|
-
* Execute a registered action
|
|
102
|
-
*/
|
|
103
|
-
private executeAction;
|
|
104
|
-
/**
|
|
105
|
-
* Add event listener
|
|
106
|
-
*/
|
|
107
|
-
on(event: ProduckEventType, callback: Function): void;
|
|
108
|
-
/**
|
|
109
|
-
* Remove event listener
|
|
110
|
-
*/
|
|
111
|
-
off(event: ProduckEventType, callback: Function): void;
|
|
112
|
-
/**
|
|
113
|
-
* Emit event
|
|
114
|
-
*/
|
|
115
|
-
private emit;
|
|
116
|
-
/**
|
|
117
|
-
* Get session token
|
|
118
|
-
*/
|
|
119
|
-
getSessionToken(): string | null;
|
|
120
|
-
/**
|
|
121
|
-
* Check if SDK is ready
|
|
122
|
-
*/
|
|
123
|
-
getIsReady(): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Get registered action keys
|
|
126
|
-
*/
|
|
127
|
-
getRegisteredActions(): string[];
|
|
128
|
-
/**
|
|
129
|
-
* Destroy the SDK instance
|
|
130
|
-
*/
|
|
131
|
-
destroy(): void;
|
|
132
|
-
}
|
|
133
|
-
declare function createProduck(config: ProduckConfig): ProduckSDK;
|
|
134
|
-
|
|
135
|
-
export { type ActionHandler, type ActionPayload, type ChatMessage, type FlowPayload, type FlowResult, type FlowStep, type FlowStepResult, type ProduckConfig, type ProduckEvent, type ProduckEventType, ProduckSDK, type RegisteredAction, createProduck };
|
package/dist/react.d.mts
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import React__default, { ReactNode, CSSProperties } from 'react';
|
|
4
|
-
|
|
5
|
-
interface ProduckConfig {
|
|
6
|
-
guiderId?: string;
|
|
7
|
-
sdkKey?: string;
|
|
8
|
-
apiUrl?: string;
|
|
9
|
-
onAction?: (actionKey: string, action: ActionPayload) => void;
|
|
10
|
-
onMessage?: (message: ChatMessage) => void;
|
|
11
|
-
onError?: (error: Error) => void;
|
|
12
|
-
onFlowStart?: (flow: FlowPayload) => void;
|
|
13
|
-
onFlowStepComplete?: (step: FlowStepResult, flow: FlowPayload) => void;
|
|
14
|
-
onFlowComplete?: (result: FlowResult) => void;
|
|
15
|
-
}
|
|
16
|
-
interface ActionPayload {
|
|
17
|
-
actionKey: string;
|
|
18
|
-
name: string;
|
|
19
|
-
actionType: string;
|
|
20
|
-
actionConfig: Record<string, any>;
|
|
21
|
-
responseMessage?: string;
|
|
22
|
-
}
|
|
23
|
-
interface FlowStep {
|
|
24
|
-
operationId: string;
|
|
25
|
-
order: number;
|
|
26
|
-
condition?: Record<string, any>;
|
|
27
|
-
inputMapping?: Record<string, any>;
|
|
28
|
-
}
|
|
29
|
-
interface FlowPayload {
|
|
30
|
-
flowId: string;
|
|
31
|
-
name: string;
|
|
32
|
-
description: string;
|
|
33
|
-
steps: FlowStep[];
|
|
34
|
-
}
|
|
35
|
-
interface FlowStepResult {
|
|
36
|
-
operationId: string;
|
|
37
|
-
order: number;
|
|
38
|
-
success: boolean;
|
|
39
|
-
data?: any;
|
|
40
|
-
error?: string;
|
|
41
|
-
}
|
|
42
|
-
interface FlowResult {
|
|
43
|
-
flowId: string;
|
|
44
|
-
name: string;
|
|
45
|
-
steps: FlowStepResult[];
|
|
46
|
-
completed: boolean;
|
|
47
|
-
totalSteps: number;
|
|
48
|
-
successfulSteps: number;
|
|
49
|
-
}
|
|
50
|
-
interface ChatMessage {
|
|
51
|
-
role: 'user' | 'assistant';
|
|
52
|
-
content: string;
|
|
53
|
-
action?: ActionPayload;
|
|
54
|
-
flow?: FlowPayload;
|
|
55
|
-
flowResult?: FlowResult;
|
|
56
|
-
}
|
|
57
|
-
interface ActionHandler {
|
|
58
|
-
(payload: ActionPayload): void | Promise<void>;
|
|
59
|
-
}
|
|
60
|
-
type ProduckEventType = 'action' | 'message' | 'error' | 'ready' | 'flowStart' | 'flowStepComplete' | 'flowComplete';
|
|
61
|
-
declare class ProduckSDK {
|
|
62
|
-
private config;
|
|
63
|
-
private actions;
|
|
64
|
-
private eventListeners;
|
|
65
|
-
private sessionToken;
|
|
66
|
-
private isReady;
|
|
67
|
-
constructor(config: ProduckConfig);
|
|
68
|
-
/**
|
|
69
|
-
* Initialize the SDK and create a chat session
|
|
70
|
-
*/
|
|
71
|
-
init(): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Register an action handler
|
|
74
|
-
*/
|
|
75
|
-
register(actionKey: string, handler: ActionHandler): void;
|
|
76
|
-
/**
|
|
77
|
-
* Unregister an action handler
|
|
78
|
-
*/
|
|
79
|
-
unregister(actionKey: string): void;
|
|
80
|
-
/**
|
|
81
|
-
* Send a message and handle potential action or flow triggers
|
|
82
|
-
*/
|
|
83
|
-
sendMessage(message: string): Promise<ChatMessage>;
|
|
84
|
-
/**
|
|
85
|
-
* Execute a flow by running each step's operation sequentially
|
|
86
|
-
*/
|
|
87
|
-
executeFlow(flow: FlowPayload): Promise<FlowResult>;
|
|
88
|
-
/**
|
|
89
|
-
* Send log data to backend for analytics
|
|
90
|
-
*/
|
|
91
|
-
private sendLogToBackend;
|
|
92
|
-
/**
|
|
93
|
-
* Send detailed log to backend
|
|
94
|
-
*/
|
|
95
|
-
private log;
|
|
96
|
-
/**
|
|
97
|
-
* Execute a registered action
|
|
98
|
-
*/
|
|
99
|
-
private executeAction;
|
|
100
|
-
/**
|
|
101
|
-
* Add event listener
|
|
102
|
-
*/
|
|
103
|
-
on(event: ProduckEventType, callback: Function): void;
|
|
104
|
-
/**
|
|
105
|
-
* Remove event listener
|
|
106
|
-
*/
|
|
107
|
-
off(event: ProduckEventType, callback: Function): void;
|
|
108
|
-
/**
|
|
109
|
-
* Emit event
|
|
110
|
-
*/
|
|
111
|
-
private emit;
|
|
112
|
-
/**
|
|
113
|
-
* Get session token
|
|
114
|
-
*/
|
|
115
|
-
getSessionToken(): string | null;
|
|
116
|
-
/**
|
|
117
|
-
* Check if SDK is ready
|
|
118
|
-
*/
|
|
119
|
-
getIsReady(): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Get registered action keys
|
|
122
|
-
*/
|
|
123
|
-
getRegisteredActions(): string[];
|
|
124
|
-
/**
|
|
125
|
-
* Destroy the SDK instance
|
|
126
|
-
*/
|
|
127
|
-
destroy(): void;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
interface ProduckProviderProps {
|
|
131
|
-
config: Omit<ProduckConfig, 'onAction' | 'onMessage' | 'onError' | 'onFlowStart' | 'onFlowStepComplete' | 'onFlowComplete'>;
|
|
132
|
-
children: ReactNode;
|
|
133
|
-
onAction?: (actionKey: string, payload: ActionPayload) => void;
|
|
134
|
-
onError?: (error: Error) => void;
|
|
135
|
-
onFlowStart?: (flow: FlowPayload) => void;
|
|
136
|
-
onFlowStepComplete?: (step: FlowStepResult, flow: FlowPayload) => void;
|
|
137
|
-
onFlowComplete?: (result: FlowResult) => void;
|
|
138
|
-
}
|
|
139
|
-
declare function ProduckProvider({ config, children, onAction, onError, onFlowStart, onFlowStepComplete, onFlowComplete, }: ProduckProviderProps): react_jsx_runtime.JSX.Element;
|
|
140
|
-
|
|
141
|
-
interface ProduckChatAppearance {
|
|
142
|
-
width?: string | number;
|
|
143
|
-
height?: string | number;
|
|
144
|
-
borderRadius?: string | number;
|
|
145
|
-
backgroundColor?: string;
|
|
146
|
-
headerBackgroundColor?: string;
|
|
147
|
-
headerTextColor?: string;
|
|
148
|
-
inputBackgroundColor?: string;
|
|
149
|
-
inputTextColor?: string;
|
|
150
|
-
inputBorderColor?: string;
|
|
151
|
-
userMessageBackgroundColor?: string;
|
|
152
|
-
userMessageTextColor?: string;
|
|
153
|
-
assistantMessageBackgroundColor?: string;
|
|
154
|
-
assistantMessageTextColor?: string;
|
|
155
|
-
buttonBackgroundColor?: string;
|
|
156
|
-
buttonTextColor?: string;
|
|
157
|
-
buttonBorderRadius?: string | number;
|
|
158
|
-
floatingButtonSize?: string | number;
|
|
159
|
-
fontFamily?: string;
|
|
160
|
-
fontSize?: string | number;
|
|
161
|
-
headerFontSize?: string | number;
|
|
162
|
-
border?: string;
|
|
163
|
-
boxShadow?: string;
|
|
164
|
-
floatingButtonIcon?: React__default.ReactNode;
|
|
165
|
-
floatingButtonLoadingIcon?: React__default.ReactNode;
|
|
166
|
-
showCloseButton?: boolean;
|
|
167
|
-
headerIcon?: React__default.ReactNode;
|
|
168
|
-
sendButtonText?: string;
|
|
169
|
-
sendButtonIcon?: React__default.ReactNode;
|
|
170
|
-
emptyStateIcon?: React__default.ReactNode;
|
|
171
|
-
emptyStateTitle?: string;
|
|
172
|
-
emptyStateSubtitle?: string;
|
|
173
|
-
}
|
|
174
|
-
interface ProduckChatProps {
|
|
175
|
-
placeholder?: string;
|
|
176
|
-
title?: string;
|
|
177
|
-
position?: 'bottom-right' | 'bottom-left' | 'inline';
|
|
178
|
-
theme?: 'light' | 'dark';
|
|
179
|
-
primaryColor?: string;
|
|
180
|
-
className?: string;
|
|
181
|
-
style?: CSSProperties;
|
|
182
|
-
defaultOpen?: boolean;
|
|
183
|
-
appearance?: ProduckChatAppearance;
|
|
184
|
-
}
|
|
185
|
-
declare function ProduckChat({ placeholder, title, position, theme, primaryColor, className, style, defaultOpen, appearance, }: ProduckChatProps): react_jsx_runtime.JSX.Element;
|
|
186
|
-
|
|
187
|
-
interface ProduckTargetProps {
|
|
188
|
-
actionKey: string;
|
|
189
|
-
children: ReactNode;
|
|
190
|
-
onTrigger?: (payload: ActionPayload) => void;
|
|
191
|
-
highlightStyle?: React__default.CSSProperties;
|
|
192
|
-
highlightDuration?: number;
|
|
193
|
-
scrollIntoView?: boolean;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Wrapper component that registers an action and can highlight/scroll to the target
|
|
197
|
-
*/
|
|
198
|
-
declare function ProduckTarget({ actionKey, children, onTrigger, highlightStyle, highlightDuration, scrollIntoView, }: ProduckTargetProps): react_jsx_runtime.JSX.Element;
|
|
199
|
-
|
|
200
|
-
interface ProduckContextValue {
|
|
201
|
-
sdk: ProduckSDK | null;
|
|
202
|
-
isReady: boolean;
|
|
203
|
-
sessionToken: string | null;
|
|
204
|
-
messages: ChatMessage[];
|
|
205
|
-
isLoading: boolean;
|
|
206
|
-
sendMessage: (message: string) => Promise<void>;
|
|
207
|
-
register: (actionKey: string, handler: (payload: ActionPayload) => void) => void;
|
|
208
|
-
unregister: (actionKey: string) => void;
|
|
209
|
-
activeFlow: FlowPayload | null;
|
|
210
|
-
flowResult: FlowResult | null;
|
|
211
|
-
isExecutingFlow: boolean;
|
|
212
|
-
}
|
|
213
|
-
declare const ProduckContext: React.Context<ProduckContextValue | null>;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Hook to access Produck SDK functionality
|
|
217
|
-
*/
|
|
218
|
-
declare function useProduck(): ProduckContextValue;
|
|
219
|
-
/**
|
|
220
|
-
* Hook to register an action handler
|
|
221
|
-
*/
|
|
222
|
-
declare function useProduckAction(actionKey: string, handler: (payload: ActionPayload) => void, deps?: any[]): void;
|
|
223
|
-
/**
|
|
224
|
-
* Hook to check if SDK is ready
|
|
225
|
-
*/
|
|
226
|
-
declare function useProduckReady(): boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Hook to get chat messages
|
|
229
|
-
*/
|
|
230
|
-
declare function useProduckMessages(): {
|
|
231
|
-
messages: ChatMessage[];
|
|
232
|
-
isLoading: boolean;
|
|
233
|
-
sendMessage: (message: string) => Promise<void>;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Hook to get flow execution status
|
|
237
|
-
*/
|
|
238
|
-
declare function useProduckFlow(): {
|
|
239
|
-
activeFlow: FlowPayload | null;
|
|
240
|
-
flowResult: FlowResult | null;
|
|
241
|
-
isExecutingFlow: boolean;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
export { type ActionHandler, type ActionPayload, type ChatMessage, type FlowPayload, type FlowResult, type FlowStep, type FlowStepResult, ProduckChat, type ProduckChatAppearance, type ProduckChatProps, type ProduckConfig, ProduckContext, type ProduckContextValue, ProduckProvider, type ProduckProviderProps, ProduckTarget, type ProduckTargetProps, useProduck, useProduckAction, useProduckFlow, useProduckMessages, useProduckReady };
|