fmode-ng 0.0.231 → 0.0.233
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/esm2022/lib/aigc/chat/chat-modal-input/modal-input.component.mjs +1 -1
- package/esm2022/lib/core/agent/chat/fmode-chat.mjs +1 -1
- package/esm2022/lib/core/agent/chat/message/index.mjs +10 -0
- package/esm2022/lib/core/agent/chat/message/message-manager.mjs +10 -0
- package/esm2022/lib/core/agent/chat/message/message.mjs +10 -0
- package/esm2022/lib/core/ecom/index.mjs +10 -0
- package/esm2022/lib/core/ecom/shopee/index.mjs +10 -0
- package/esm2022/lib/core/ecom/shopee/src/client.mjs +10 -0
- package/esm2022/lib/core/ecom/shopee/src/index.mjs +10 -0
- package/esm2022/lib/core/ecom/shopee/src/merchant.mjs +10 -0
- package/esm2022/lib/core/ecom/shopee/src/public.mjs +10 -0
- package/esm2022/lib/core/ecom/shopee/src/shop.mjs +10 -0
- package/esm2022/lib/core/ecom/shopee/src/types.mjs +10 -0
- package/esm2022/lib/core/index.mjs +1 -1
- package/esm2022/lib/core/parse/fmode.cloud.mjs +1 -1
- package/esm2022/lib/core/parse/fmode.parse.mjs +1 -1
- package/esm2022/lib/user/account/account.service.mjs +1 -1
- package/fesm2022/fmode-ng.mjs +1 -1
- package/fesm2022/fmode-ng.mjs.map +1 -1
- package/lib/core/agent/chat/fmode-chat.d.ts +35 -1
- package/lib/core/agent/chat/interface.d.ts +2 -0
- package/lib/core/agent/chat/message/index.d.ts +2 -0
- package/lib/core/agent/chat/message/message-manager.d.ts +86 -0
- package/lib/core/agent/chat/message/message.d.ts +175 -0
- package/lib/core/ecom/index.d.ts +1 -0
- package/lib/core/ecom/shopee/index.d.ts +1 -0
- package/lib/core/ecom/shopee/src/client.d.ts +51 -0
- package/lib/core/ecom/shopee/src/index.d.ts +37 -0
- package/lib/core/ecom/shopee/src/merchant.d.ts +214 -0
- package/lib/core/ecom/shopee/src/public.d.ts +204 -0
- package/lib/core/ecom/shopee/src/shop.d.ts +177 -0
- package/lib/core/ecom/shopee/src/types.d.ts +102 -0
- package/lib/core/index.d.ts +1 -0
- package/lib/core/parse/fmode.cloud.d.ts +5 -4
- package/lib/user/account/account.service.d.ts +5 -0
- package/package.json +2 -1
|
@@ -3,6 +3,7 @@ import { FmodeTTS } from "../../voice/tts";
|
|
|
3
3
|
import { NovaCloudService } from "../../../nova-cloud";
|
|
4
4
|
import { NovaUploadService } from "../../../storage/service-upload/nova-upload.service";
|
|
5
5
|
import { ChatImageContentItem, FmodeChatEventMap, FmodeChatMessage, FmodeChatMessageVoice, FmodeChatVoiceConfig } from "./interface";
|
|
6
|
+
import { MessageScene } from "./message";
|
|
6
7
|
export declare function getMessageContentText(content: any | string | Array<ChatImageContentItem>): string;
|
|
7
8
|
export declare function getMessageImageUrl(content: any | string | Array<ChatImageContentItem>): any;
|
|
8
9
|
/**
|
|
@@ -15,7 +16,8 @@ export declare class FmodeChat {
|
|
|
15
16
|
ChatSession: new () => FmodeObject;
|
|
16
17
|
chatSession: FmodeObject;
|
|
17
18
|
role: any;
|
|
18
|
-
|
|
19
|
+
private messageManager;
|
|
20
|
+
private company;
|
|
19
21
|
latestAIResponse: string | undefined;
|
|
20
22
|
chatServ: any;
|
|
21
23
|
userInput: string;
|
|
@@ -87,6 +89,38 @@ export declare class FmodeChat {
|
|
|
87
89
|
uploadServ: NovaUploadService;
|
|
88
90
|
constructor(sessionId: string, role?: FmodeObject, chatSession?: FmodeObject, chatServ?: any, navCtrl?: any, //NavController,
|
|
89
91
|
ncloud?: NovaCloudService, uploadServ?: NovaUploadService);
|
|
92
|
+
/**
|
|
93
|
+
* 获取消息列表(兼容老版本)
|
|
94
|
+
*/
|
|
95
|
+
getMessageList(): Promise<FmodeChatMessage[]>;
|
|
96
|
+
/**
|
|
97
|
+
* 获取消息列表(同步版本,用于兼容)
|
|
98
|
+
*/
|
|
99
|
+
get messageList(): FmodeChatMessage[];
|
|
100
|
+
/**
|
|
101
|
+
* 设置消息列表(主要用于兼容老版本)
|
|
102
|
+
*/
|
|
103
|
+
set messageList(messages: FmodeChatMessage[]);
|
|
104
|
+
/**
|
|
105
|
+
* 初始化消息管理器
|
|
106
|
+
*/
|
|
107
|
+
private initMessageManager;
|
|
108
|
+
/**
|
|
109
|
+
* 初始化企业信息
|
|
110
|
+
*/
|
|
111
|
+
initCompany(): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* 添加消息
|
|
114
|
+
*/
|
|
115
|
+
addMessage(content: FmodeChatMessage, scene?: MessageScene): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* 更新消息
|
|
118
|
+
*/
|
|
119
|
+
updateMessage(index: number, content: FmodeChatMessage): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* 重新加载消息
|
|
122
|
+
*/
|
|
123
|
+
reloadMessages(): Promise<void>;
|
|
90
124
|
/**
|
|
91
125
|
* 会话Avatar控制
|
|
92
126
|
*/
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { FmodeObject } from "../../../../core/parse";
|
|
2
|
+
import { FmodeChatMessage } from "../interface";
|
|
3
|
+
import { MessageScene } from "./message";
|
|
4
|
+
/**
|
|
5
|
+
* MessageManagerOptions - 消息管理器配置
|
|
6
|
+
*/
|
|
7
|
+
export interface MessageManagerOptions {
|
|
8
|
+
chatSession?: FmodeObject;
|
|
9
|
+
role?: FmodeObject;
|
|
10
|
+
company: FmodeObject;
|
|
11
|
+
group?: FmodeObject;
|
|
12
|
+
userFrom?: FmodeObject;
|
|
13
|
+
userTo?: FmodeObject;
|
|
14
|
+
contact?: FmodeObject;
|
|
15
|
+
scene?: MessageScene;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* MessageManager - 通用消息管理器
|
|
19
|
+
* 职责:管理不同场景的消息获取、缓存、合并
|
|
20
|
+
*/
|
|
21
|
+
export declare class MessageManager {
|
|
22
|
+
private options;
|
|
23
|
+
private _newMessages;
|
|
24
|
+
private _legacyMessages;
|
|
25
|
+
private _mergedMessages;
|
|
26
|
+
private _isDirty;
|
|
27
|
+
constructor(options: MessageManagerOptions);
|
|
28
|
+
/**
|
|
29
|
+
* 获取合并后的消息列表
|
|
30
|
+
*/
|
|
31
|
+
getMessages(): Promise<FmodeChatMessage[]>;
|
|
32
|
+
/**
|
|
33
|
+
* 添加新消息(通用方法)
|
|
34
|
+
*/
|
|
35
|
+
addMessage(message: FmodeChatMessage, scene?: MessageScene): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* 更新消息
|
|
38
|
+
*/
|
|
39
|
+
updateMessage(index: number, message: FmodeChatMessage): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* 重新加载消息
|
|
42
|
+
*/
|
|
43
|
+
reloadMessages(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* 加载并合并消息
|
|
46
|
+
*/
|
|
47
|
+
private loadAndMergeMessages;
|
|
48
|
+
/**
|
|
49
|
+
* 获取消息统计
|
|
50
|
+
*/
|
|
51
|
+
getStats(): {
|
|
52
|
+
total: number;
|
|
53
|
+
legacy: number;
|
|
54
|
+
new: number;
|
|
55
|
+
user: number;
|
|
56
|
+
assistant: number;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* 搜索消息
|
|
60
|
+
*/
|
|
61
|
+
searchMessages(keyword: string): Promise<FmodeChatMessage[]>;
|
|
62
|
+
/**
|
|
63
|
+
* 清空缓存
|
|
64
|
+
*/
|
|
65
|
+
clearCache(): void;
|
|
66
|
+
/**
|
|
67
|
+
* 创建智能体对话消息管理器
|
|
68
|
+
*/
|
|
69
|
+
static createForRole(chatSession: FmodeObject, role: FmodeObject, company: FmodeObject): MessageManager;
|
|
70
|
+
/**
|
|
71
|
+
* 创建群聊消息管理器
|
|
72
|
+
*/
|
|
73
|
+
static createForGroup(group: FmodeObject, company: FmodeObject): MessageManager;
|
|
74
|
+
/**
|
|
75
|
+
* 创建用户私聊消息管理器
|
|
76
|
+
*/
|
|
77
|
+
static createForUser(userFrom: FmodeObject, userTo: FmodeObject, company: FmodeObject): MessageManager;
|
|
78
|
+
/**
|
|
79
|
+
* 创建客服消息管理器
|
|
80
|
+
*/
|
|
81
|
+
static createForService(contact: FmodeObject, company: FmodeObject): MessageManager;
|
|
82
|
+
/**
|
|
83
|
+
* 创建通用消息管理器
|
|
84
|
+
*/
|
|
85
|
+
static create(options: MessageManagerOptions): MessageManager;
|
|
86
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { FmodeObject, FmodeQuery } from "../../../../core/parse";
|
|
2
|
+
import { FmodeChatMessage, ChatImageContentItem, FmodeChatMessageVoice } from "../interface";
|
|
3
|
+
/**
|
|
4
|
+
* 消息场景枚举
|
|
5
|
+
*/
|
|
6
|
+
export declare enum MessageScene {
|
|
7
|
+
ROLE = "role",// 智能体角色对话
|
|
8
|
+
USER = "user",// 用户私聊
|
|
9
|
+
GROUP = "group",// 群聊消息
|
|
10
|
+
SERVICE = "service"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 消息类型枚举
|
|
14
|
+
*/
|
|
15
|
+
export declare enum MessageType {
|
|
16
|
+
TEXT = "text",
|
|
17
|
+
IMAGE = "image",
|
|
18
|
+
VOICE = "voice",
|
|
19
|
+
AGENT_TASK = "agent_task",
|
|
20
|
+
SYSTEM = "system",
|
|
21
|
+
EXTERNAL = "external"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 消息角色枚举
|
|
25
|
+
*/
|
|
26
|
+
export declare enum MessageRole {
|
|
27
|
+
USER = "user",
|
|
28
|
+
ASSISTANT = "assistant",
|
|
29
|
+
SYSTEM = "system",
|
|
30
|
+
AGENT = "agent",
|
|
31
|
+
EXTERNAL = "external"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 消息状态枚举
|
|
35
|
+
*/
|
|
36
|
+
export declare enum MessageStatus {
|
|
37
|
+
SENDING = "sending",
|
|
38
|
+
SENT = "sent",
|
|
39
|
+
DELIVERED = "delivered",
|
|
40
|
+
READ = "read",
|
|
41
|
+
FAILED = "failed"
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 发送消息参数接口
|
|
45
|
+
*/
|
|
46
|
+
export interface SendMessageParams {
|
|
47
|
+
content: {
|
|
48
|
+
type: string;
|
|
49
|
+
role: string;
|
|
50
|
+
content: string | Array<ChatImageContentItem>;
|
|
51
|
+
json?: any;
|
|
52
|
+
hidden?: boolean;
|
|
53
|
+
complete?: boolean;
|
|
54
|
+
voice?: FmodeChatMessageVoice;
|
|
55
|
+
cid?: string;
|
|
56
|
+
createdAt?: Date;
|
|
57
|
+
};
|
|
58
|
+
scene: MessageScene;
|
|
59
|
+
company: FmodeObject;
|
|
60
|
+
session?: FmodeObject;
|
|
61
|
+
group?: FmodeObject;
|
|
62
|
+
userFrom?: FmodeObject;
|
|
63
|
+
userTo?: FmodeObject;
|
|
64
|
+
role?: FmodeObject;
|
|
65
|
+
external?: {
|
|
66
|
+
source: string;
|
|
67
|
+
id: string;
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
};
|
|
70
|
+
contact?: FmodeObject;
|
|
71
|
+
attachments?: Array<any>;
|
|
72
|
+
metadata?: any;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Message 类 - 纯粹的CRUD操作类
|
|
76
|
+
* 职责单一:只负责Message表的数据操作
|
|
77
|
+
*/
|
|
78
|
+
export declare class Message {
|
|
79
|
+
private parseObject;
|
|
80
|
+
constructor(parseObject?: FmodeObject);
|
|
81
|
+
/**
|
|
82
|
+
* 创建新消息
|
|
83
|
+
*/
|
|
84
|
+
static create(params: SendMessageParams): Message;
|
|
85
|
+
/**
|
|
86
|
+
* 保存消息
|
|
87
|
+
*/
|
|
88
|
+
save(options?: {
|
|
89
|
+
useMasterKey?: boolean;
|
|
90
|
+
}): Promise<Message>;
|
|
91
|
+
/**
|
|
92
|
+
* 更新消息内容
|
|
93
|
+
*/
|
|
94
|
+
updateContent(content: any): Message;
|
|
95
|
+
/**
|
|
96
|
+
* 更新消息状态
|
|
97
|
+
*/
|
|
98
|
+
updateStatus(status: MessageStatus): Message;
|
|
99
|
+
/**
|
|
100
|
+
* 获取消息ID
|
|
101
|
+
*/
|
|
102
|
+
get id(): string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* 获取消息内容
|
|
105
|
+
*/
|
|
106
|
+
get(key: string): any;
|
|
107
|
+
/**
|
|
108
|
+
* 设置消息内容
|
|
109
|
+
*/
|
|
110
|
+
set(key: string, value: any): Message;
|
|
111
|
+
/**
|
|
112
|
+
* 转换为 FmodeChatMessage 格式
|
|
113
|
+
*/
|
|
114
|
+
toFmodeChatMessage(): FmodeChatMessage;
|
|
115
|
+
/**
|
|
116
|
+
* 获取Parse对象
|
|
117
|
+
*/
|
|
118
|
+
getParseObject(): FmodeObject;
|
|
119
|
+
/**
|
|
120
|
+
* 静态方法:从Parse对象创建
|
|
121
|
+
*/
|
|
122
|
+
static fromParseObject(parseObject: FmodeObject): Message;
|
|
123
|
+
/**
|
|
124
|
+
* 静态方法:创建查询
|
|
125
|
+
*/
|
|
126
|
+
static query(): FmodeQuery;
|
|
127
|
+
/**
|
|
128
|
+
* 静态方法:根据场景查询
|
|
129
|
+
*/
|
|
130
|
+
static queryByScene(scene: MessageScene): FmodeQuery;
|
|
131
|
+
/**
|
|
132
|
+
* 静态方法:查询角色对话消息
|
|
133
|
+
*/
|
|
134
|
+
static findRoleMessages(session: FmodeObject, options?: {
|
|
135
|
+
limit?: number;
|
|
136
|
+
skip?: number;
|
|
137
|
+
ascending?: boolean;
|
|
138
|
+
}): Promise<Message[]>;
|
|
139
|
+
/**
|
|
140
|
+
* 静态方法:查询群聊消息
|
|
141
|
+
*/
|
|
142
|
+
static findGroupMessages(group: FmodeObject, options?: {
|
|
143
|
+
limit?: number;
|
|
144
|
+
skip?: number;
|
|
145
|
+
ascending?: boolean;
|
|
146
|
+
}): Promise<Message[]>;
|
|
147
|
+
/**
|
|
148
|
+
* 静态方法:查询用户私聊消息
|
|
149
|
+
*/
|
|
150
|
+
static findUserMessages(userFrom: FmodeObject, userTo: FmodeObject, options?: {
|
|
151
|
+
limit?: number;
|
|
152
|
+
skip?: number;
|
|
153
|
+
ascending?: boolean;
|
|
154
|
+
}): Promise<Message[]>;
|
|
155
|
+
/**
|
|
156
|
+
* 静态方法:查询客服消息
|
|
157
|
+
*/
|
|
158
|
+
static findServiceMessages(contact: FmodeObject, options?: {
|
|
159
|
+
limit?: number;
|
|
160
|
+
skip?: number;
|
|
161
|
+
ascending?: boolean;
|
|
162
|
+
}): Promise<Message[]>;
|
|
163
|
+
/**
|
|
164
|
+
* 静态方法:根据外部消息ID查询
|
|
165
|
+
*/
|
|
166
|
+
static findByExternalId(source: string, externalId: string): Promise<Message | null>;
|
|
167
|
+
/**
|
|
168
|
+
* 根据 FmodeChatMessage 判断消息类型
|
|
169
|
+
*/
|
|
170
|
+
static getMessageType(fmodeMessage: FmodeChatMessage): string;
|
|
171
|
+
/**
|
|
172
|
+
* 从 FmodeChatMessage 创建 Message 对象
|
|
173
|
+
*/
|
|
174
|
+
static fromFmodeChatMessage(fmodeMessage: FmodeChatMessage, params: Omit<SendMessageParams, 'content'>): Message;
|
|
175
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./shopee/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ShopeeSDKConfig, RequestOptions, ApiResponse } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Base Shopee SDK Client
|
|
4
|
+
* Provides the core functionality for making API requests to Shopee via the forwarding endpoint
|
|
5
|
+
*/
|
|
6
|
+
export declare class ShopeeClient {
|
|
7
|
+
private serverUrl;
|
|
8
|
+
private timeout;
|
|
9
|
+
private headers;
|
|
10
|
+
environment: string;
|
|
11
|
+
constructor(config: ShopeeSDKConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Make an API request to the forwarding endpoint
|
|
14
|
+
* @param shopId Shop ID
|
|
15
|
+
* @param options Request options
|
|
16
|
+
* @returns Promise resolving to the API response
|
|
17
|
+
*/
|
|
18
|
+
request<T = any>(shopId: number, options: RequestOptions): Promise<ApiResponse<T>>;
|
|
19
|
+
/**
|
|
20
|
+
* Convenience method for GET requests
|
|
21
|
+
*/
|
|
22
|
+
get<T = any>(shopId: number, path: string, query?: Record<string, any>): Promise<ApiResponse<T>>;
|
|
23
|
+
/**
|
|
24
|
+
* Convenience method for POST requests
|
|
25
|
+
*/
|
|
26
|
+
post<T = any>(shopId: number, path: string, body?: any, query?: Record<string, any>): Promise<ApiResponse<T>>;
|
|
27
|
+
/**
|
|
28
|
+
* Convenience method for PUT requests
|
|
29
|
+
*/
|
|
30
|
+
put<T = any>(shopId: number, path: string, body?: any, query?: Record<string, any>): Promise<ApiResponse<T>>;
|
|
31
|
+
/**
|
|
32
|
+
* Convenience method for DELETE requests
|
|
33
|
+
*/
|
|
34
|
+
delete<T = any>(shopId: number, path: string, query?: Record<string, any>): Promise<ApiResponse<T>>;
|
|
35
|
+
/**
|
|
36
|
+
* Get the server URL
|
|
37
|
+
*/
|
|
38
|
+
getServerUrl(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get the timeout setting
|
|
41
|
+
*/
|
|
42
|
+
getTimeout(): number;
|
|
43
|
+
/**
|
|
44
|
+
* Update headers
|
|
45
|
+
*/
|
|
46
|
+
setHeaders(headers: Record<string, string>): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get current headers
|
|
49
|
+
*/
|
|
50
|
+
getHeaders(): Record<string, string>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ShopeeClient } from './client';
|
|
2
|
+
import { ShopeeShop } from './shop';
|
|
3
|
+
import { ShopeeMerchant } from './merchant';
|
|
4
|
+
import { ShopeePublic } from './public';
|
|
5
|
+
import type { ShopeeSDKConfig, RequestOptions, ApiResponse, AuthRequiredResponse, ApiErrorResponse, ShopInfo, MerchantInfo, ProductItem } from './types';
|
|
6
|
+
export { ShopeeClient };
|
|
7
|
+
export { ShopeeShop };
|
|
8
|
+
export { ShopeeMerchant };
|
|
9
|
+
export { ShopeePublic };
|
|
10
|
+
export type { ShopeeSDKConfig, RequestOptions, ApiResponse, AuthRequiredResponse, ApiErrorResponse, ShopInfo, MerchantInfo, ProductItem };
|
|
11
|
+
/**
|
|
12
|
+
* Main SDK class that provides easy access to all Shopee APIs
|
|
13
|
+
*/
|
|
14
|
+
export declare class ShopeeSDK {
|
|
15
|
+
client: ShopeeClient;
|
|
16
|
+
public: ShopeePublic;
|
|
17
|
+
constructor(config: ShopeeSDKConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Create a shop instance for shop-specific operations
|
|
20
|
+
* @param shopId Shop ID
|
|
21
|
+
*/
|
|
22
|
+
shop(shopId: number, environment?: string): ShopeeShop;
|
|
23
|
+
/**
|
|
24
|
+
* Create a merchant instance for merchant-level operations
|
|
25
|
+
* @param mainAccountId Main Account ID
|
|
26
|
+
*/
|
|
27
|
+
merchant(mainAccountId: number): ShopeeMerchant;
|
|
28
|
+
/**
|
|
29
|
+
* Get the underlying client instance
|
|
30
|
+
*/
|
|
31
|
+
getClient(): ShopeeClient;
|
|
32
|
+
/**
|
|
33
|
+
* Update SDK configuration
|
|
34
|
+
*/
|
|
35
|
+
updateConfig(config: Partial<ShopeeSDKConfig>): void;
|
|
36
|
+
}
|
|
37
|
+
export default ShopeeSDK;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { ShopeeClient } from './client';
|
|
2
|
+
import { ApiResponse, MerchantInfo } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Shopee Merchant API Class
|
|
5
|
+
* Handles merchant-level operations using a main_account_id
|
|
6
|
+
*/
|
|
7
|
+
export declare class ShopeeMerchant {
|
|
8
|
+
private client;
|
|
9
|
+
private mainAccountId;
|
|
10
|
+
constructor(client: ShopeeClient, mainAccountId: number);
|
|
11
|
+
/**
|
|
12
|
+
* Get merchant information
|
|
13
|
+
*/
|
|
14
|
+
getMerchantInfo(): Promise<ApiResponse<MerchantInfo>>;
|
|
15
|
+
/**
|
|
16
|
+
* Get all shops under the merchant account
|
|
17
|
+
*/
|
|
18
|
+
getShopList(): Promise<ApiResponse<{
|
|
19
|
+
shops?: Array<{
|
|
20
|
+
shop_id: number;
|
|
21
|
+
shop_name: string;
|
|
22
|
+
region: string;
|
|
23
|
+
status: string;
|
|
24
|
+
is_default: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
}>>;
|
|
27
|
+
/**
|
|
28
|
+
* Get merchant profile information
|
|
29
|
+
*/
|
|
30
|
+
getProfile(): Promise<ApiResponse<any>>;
|
|
31
|
+
/**
|
|
32
|
+
* Update merchant profile
|
|
33
|
+
* @param profileData Profile update data
|
|
34
|
+
*/
|
|
35
|
+
updateProfile(profileData: {
|
|
36
|
+
username?: string;
|
|
37
|
+
phone?: string;
|
|
38
|
+
email?: string;
|
|
39
|
+
company_name?: string;
|
|
40
|
+
company_address?: string;
|
|
41
|
+
company_registration_number?: string;
|
|
42
|
+
}): Promise<ApiResponse<any>>;
|
|
43
|
+
/**
|
|
44
|
+
* Get merchant financial information
|
|
45
|
+
*/
|
|
46
|
+
getFinancialInfo(): Promise<ApiResponse<any>>;
|
|
47
|
+
/**
|
|
48
|
+
* Get merchant wallet balance
|
|
49
|
+
*/
|
|
50
|
+
getWalletBalance(): Promise<ApiResponse<{
|
|
51
|
+
available_balance: number;
|
|
52
|
+
frozen_balance: number;
|
|
53
|
+
pending_balance: number;
|
|
54
|
+
currency: string;
|
|
55
|
+
}>>;
|
|
56
|
+
/**
|
|
57
|
+
* Get transaction history
|
|
58
|
+
* @param options Query options for pagination and filtering
|
|
59
|
+
*/
|
|
60
|
+
getTransactionHistory(options?: {
|
|
61
|
+
page_size?: number;
|
|
62
|
+
cursor?: string;
|
|
63
|
+
transaction_type?: 'ORDER_INCOME' | 'WITHDRAWAL' | 'REFUND' | 'PENALTY' | 'REWARD';
|
|
64
|
+
start_time?: number;
|
|
65
|
+
end_time?: number;
|
|
66
|
+
}): Promise<ApiResponse<{
|
|
67
|
+
transactions?: Array<{
|
|
68
|
+
transaction_id: string;
|
|
69
|
+
transaction_type: string;
|
|
70
|
+
amount: number;
|
|
71
|
+
currency: string;
|
|
72
|
+
description: string;
|
|
73
|
+
create_time: number;
|
|
74
|
+
status: string;
|
|
75
|
+
}>;
|
|
76
|
+
next_cursor?: string;
|
|
77
|
+
has_more_page?: boolean;
|
|
78
|
+
}>>;
|
|
79
|
+
/**
|
|
80
|
+
* Create withdrawal request
|
|
81
|
+
* @param withdrawalData Withdrawal information
|
|
82
|
+
*/
|
|
83
|
+
createWithdrawal(withdrawalData: {
|
|
84
|
+
amount: number;
|
|
85
|
+
bank_account_id: number;
|
|
86
|
+
password?: string;
|
|
87
|
+
}): Promise<ApiResponse<{
|
|
88
|
+
withdrawal_id: string;
|
|
89
|
+
amount: number;
|
|
90
|
+
currency: string;
|
|
91
|
+
status: string;
|
|
92
|
+
}>>;
|
|
93
|
+
/**
|
|
94
|
+
* Get withdrawal history
|
|
95
|
+
* @param options Query options for pagination
|
|
96
|
+
*/
|
|
97
|
+
getWithdrawalHistory(options?: {
|
|
98
|
+
page_size?: number;
|
|
99
|
+
cursor?: string;
|
|
100
|
+
start_time?: number;
|
|
101
|
+
end_time?: number;
|
|
102
|
+
}): Promise<ApiResponse<{
|
|
103
|
+
withdrawals?: Array<{
|
|
104
|
+
withdrawal_id: string;
|
|
105
|
+
amount: number;
|
|
106
|
+
currency: string;
|
|
107
|
+
status: string;
|
|
108
|
+
create_time: number;
|
|
109
|
+
complete_time?: number;
|
|
110
|
+
}>;
|
|
111
|
+
next_cursor?: string;
|
|
112
|
+
has_more_page?: boolean;
|
|
113
|
+
}>>;
|
|
114
|
+
/**
|
|
115
|
+
* Get merchant-level statistics
|
|
116
|
+
* @param options Query options for time range
|
|
117
|
+
*/
|
|
118
|
+
getStatistics(options?: {
|
|
119
|
+
start_date?: string;
|
|
120
|
+
end_date?: string;
|
|
121
|
+
shop_ids?: number[];
|
|
122
|
+
}): Promise<ApiResponse<{
|
|
123
|
+
total_orders: number;
|
|
124
|
+
total_revenue: number;
|
|
125
|
+
total_products: number;
|
|
126
|
+
active_shops: number;
|
|
127
|
+
growth_rate?: number;
|
|
128
|
+
}>>;
|
|
129
|
+
/**
|
|
130
|
+
* Get merchant notifications
|
|
131
|
+
* @param options Query options for pagination
|
|
132
|
+
*/
|
|
133
|
+
getNotifications(options?: {
|
|
134
|
+
page_size?: number;
|
|
135
|
+
cursor?: string;
|
|
136
|
+
notification_type?: 'SYSTEM' | 'ORDER' | 'PRODUCT' | 'FINANCIAL';
|
|
137
|
+
read_status?: 'READ' | 'UNREAD';
|
|
138
|
+
}): Promise<ApiResponse<{
|
|
139
|
+
notifications?: Array<{
|
|
140
|
+
notification_id: string;
|
|
141
|
+
type: string;
|
|
142
|
+
title: string;
|
|
143
|
+
content: string;
|
|
144
|
+
create_time: number;
|
|
145
|
+
read_status: string;
|
|
146
|
+
}>;
|
|
147
|
+
next_cursor?: string;
|
|
148
|
+
has_more_page?: boolean;
|
|
149
|
+
unread_count?: number;
|
|
150
|
+
}>>;
|
|
151
|
+
/**
|
|
152
|
+
* Mark notification as read
|
|
153
|
+
* @param notificationId Notification ID
|
|
154
|
+
*/
|
|
155
|
+
markNotificationAsRead(notificationId: string): Promise<ApiResponse<any>>;
|
|
156
|
+
/**
|
|
157
|
+
* Get merchant settings
|
|
158
|
+
*/
|
|
159
|
+
getSettings(): Promise<ApiResponse<any>>;
|
|
160
|
+
/**
|
|
161
|
+
* Update merchant settings
|
|
162
|
+
* @param settingsData Settings update data
|
|
163
|
+
*/
|
|
164
|
+
updateSettings(settingsData: {
|
|
165
|
+
timezone?: string;
|
|
166
|
+
language?: string;
|
|
167
|
+
currency?: string;
|
|
168
|
+
notification_preferences?: Record<string, boolean>;
|
|
169
|
+
}): Promise<ApiResponse<any>>;
|
|
170
|
+
/**
|
|
171
|
+
* Get merchant permissions and access control
|
|
172
|
+
*/
|
|
173
|
+
getPermissions(): Promise<ApiResponse<{
|
|
174
|
+
permissions?: Array<{
|
|
175
|
+
permission_id: string;
|
|
176
|
+
name: string;
|
|
177
|
+
description: string;
|
|
178
|
+
granted: boolean;
|
|
179
|
+
}>;
|
|
180
|
+
}>>;
|
|
181
|
+
/**
|
|
182
|
+
* Get merchant audit logs
|
|
183
|
+
* @param options Query options for pagination and filtering
|
|
184
|
+
*/
|
|
185
|
+
getAuditLogs(options?: {
|
|
186
|
+
page_size?: number;
|
|
187
|
+
cursor?: string;
|
|
188
|
+
action?: 'CREATE' | 'UPDATE' | 'DELETE' | 'LOGIN';
|
|
189
|
+
user_id?: string;
|
|
190
|
+
start_time?: number;
|
|
191
|
+
end_time?: number;
|
|
192
|
+
}): Promise<ApiResponse<{
|
|
193
|
+
logs?: Array<{
|
|
194
|
+
log_id: string;
|
|
195
|
+
action: string;
|
|
196
|
+
user_id: string;
|
|
197
|
+
resource_type: string;
|
|
198
|
+
resource_id: string;
|
|
199
|
+
details: any;
|
|
200
|
+
ip_address: string;
|
|
201
|
+
create_time: number;
|
|
202
|
+
}>;
|
|
203
|
+
next_cursor?: string;
|
|
204
|
+
has_more_page?: boolean;
|
|
205
|
+
}>>;
|
|
206
|
+
/**
|
|
207
|
+
* Get the main account ID
|
|
208
|
+
*/
|
|
209
|
+
getMainAccountId(): number;
|
|
210
|
+
/**
|
|
211
|
+
* Get the underlying client instance
|
|
212
|
+
*/
|
|
213
|
+
getClient(): ShopeeClient;
|
|
214
|
+
}
|