update
This commit is contained in:
83
sdk/dist/index.d.ts
vendored
83
sdk/dist/index.d.ts
vendored
@@ -42,27 +42,54 @@ export type NodePresentation = {
|
||||
content: string;
|
||||
};
|
||||
};
|
||||
export type KnowledgeCollectionOption = {
|
||||
value: string;
|
||||
label: string;
|
||||
parents?: string[];
|
||||
suggested?: boolean;
|
||||
};
|
||||
export type KnowledgeCollectionStep = {
|
||||
field_key: string;
|
||||
export type DimensionValue = {
|
||||
value_key: string;
|
||||
name: string;
|
||||
weight: number;
|
||||
hot: boolean;
|
||||
};
|
||||
export type DimensionState = {
|
||||
dim_key: string;
|
||||
name: string;
|
||||
values: DimensionValue[];
|
||||
};
|
||||
export type ScriptOption = {
|
||||
option_key: string;
|
||||
label: string;
|
||||
};
|
||||
export type ScriptProduct = {
|
||||
sku_code: string;
|
||||
product_name: string;
|
||||
};
|
||||
export type ScriptItem = {
|
||||
script_key: string;
|
||||
name: string;
|
||||
script_type: string;
|
||||
content: string;
|
||||
dimension_value_key?: string;
|
||||
weight?: number;
|
||||
confirm_threshold?: number;
|
||||
show_threshold?: number;
|
||||
options?: ScriptOption[];
|
||||
products?: ScriptProduct[];
|
||||
feedback: boolean;
|
||||
required: boolean;
|
||||
multiple: boolean;
|
||||
from_field?: string;
|
||||
options: KnowledgeCollectionOption[];
|
||||
};
|
||||
export type KnowledgeCollection = {
|
||||
context_fields: NodeField[];
|
||||
context_title?: string;
|
||||
context_hint?: string;
|
||||
selection_title?: string;
|
||||
selection_hint?: string;
|
||||
steps: KnowledgeCollectionStep[];
|
||||
export type StageForm = {
|
||||
fields: NodeField[];
|
||||
};
|
||||
export type StageState = {
|
||||
stage_key: string;
|
||||
name: string;
|
||||
purpose: string;
|
||||
dimensions: DimensionState[];
|
||||
scripts: ScriptItem[];
|
||||
fallback?: string;
|
||||
form?: StageForm;
|
||||
screening_required: boolean;
|
||||
can_next: boolean;
|
||||
can_next_reason?: string;
|
||||
};
|
||||
export type NodeView = {
|
||||
node_key: string;
|
||||
@@ -71,8 +98,8 @@ export type NodeView = {
|
||||
content: string;
|
||||
fields?: NodeField[];
|
||||
presentation?: NodePresentation;
|
||||
stage?: StageState;
|
||||
outputs?: unknown[];
|
||||
collection?: KnowledgeCollection;
|
||||
};
|
||||
export type ScenarioState = {
|
||||
run_id: number;
|
||||
@@ -98,6 +125,21 @@ export type FinishOptions = {
|
||||
result?: string;
|
||||
finalResult?: Record<string, unknown> | null;
|
||||
};
|
||||
export type ScriptAnswer = {
|
||||
script_key: string;
|
||||
option_keys?: string[];
|
||||
value?: string;
|
||||
};
|
||||
export type AnswerOptions = {
|
||||
scriptKey?: string;
|
||||
optionKeys?: string[];
|
||||
value?: string;
|
||||
scriptAnswers?: ScriptAnswer[];
|
||||
dimensionSelects?: Record<string, boolean>;
|
||||
answers?: ScenarioInput;
|
||||
dimensionValueKey?: string;
|
||||
selected?: boolean;
|
||||
};
|
||||
export declare class SalesScenario {
|
||||
private readonly options;
|
||||
private token;
|
||||
@@ -106,9 +148,14 @@ export declare class SalesScenario {
|
||||
constructor(options: CreateOptions);
|
||||
start(): Promise<ScenarioState>;
|
||||
getState(): ScenarioState;
|
||||
getStage(): StageState;
|
||||
getCurrentNode(): Promise<ScenarioState>;
|
||||
/** Answer stage questions without advancing. Answer locally on the client and submit the whole stage once: pass every answered script in scriptAnswers together with dimensionSelects and the content form in answers. */
|
||||
answer(options?: AnswerOptions): Promise<ScenarioState>;
|
||||
submit(values: ScenarioInput): Promise<ScenarioState>;
|
||||
next(): Promise<ScenarioState>;
|
||||
back(): Promise<ScenarioState>;
|
||||
feedback(scriptKey: string, feedbackType: 'like' | 'report' | 'unreasonable', note?: string): Promise<boolean>;
|
||||
finish(options?: FinishOptions): Promise<ScenarioState>;
|
||||
reset(): Promise<ScenarioState>;
|
||||
destroy(): void;
|
||||
|
||||
Reference in New Issue
Block a user