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.
Files changed (36) hide show
  1. package/esm2022/lib/aigc/chat/chat-modal-input/modal-input.component.mjs +1 -1
  2. package/esm2022/lib/core/agent/chat/fmode-chat.mjs +1 -1
  3. package/esm2022/lib/core/agent/chat/message/index.mjs +10 -0
  4. package/esm2022/lib/core/agent/chat/message/message-manager.mjs +10 -0
  5. package/esm2022/lib/core/agent/chat/message/message.mjs +10 -0
  6. package/esm2022/lib/core/ecom/index.mjs +10 -0
  7. package/esm2022/lib/core/ecom/shopee/index.mjs +10 -0
  8. package/esm2022/lib/core/ecom/shopee/src/client.mjs +10 -0
  9. package/esm2022/lib/core/ecom/shopee/src/index.mjs +10 -0
  10. package/esm2022/lib/core/ecom/shopee/src/merchant.mjs +10 -0
  11. package/esm2022/lib/core/ecom/shopee/src/public.mjs +10 -0
  12. package/esm2022/lib/core/ecom/shopee/src/shop.mjs +10 -0
  13. package/esm2022/lib/core/ecom/shopee/src/types.mjs +10 -0
  14. package/esm2022/lib/core/index.mjs +1 -1
  15. package/esm2022/lib/core/parse/fmode.cloud.mjs +1 -1
  16. package/esm2022/lib/core/parse/fmode.parse.mjs +1 -1
  17. package/esm2022/lib/user/account/account.service.mjs +1 -1
  18. package/fesm2022/fmode-ng.mjs +1 -1
  19. package/fesm2022/fmode-ng.mjs.map +1 -1
  20. package/lib/core/agent/chat/fmode-chat.d.ts +35 -1
  21. package/lib/core/agent/chat/interface.d.ts +2 -0
  22. package/lib/core/agent/chat/message/index.d.ts +2 -0
  23. package/lib/core/agent/chat/message/message-manager.d.ts +86 -0
  24. package/lib/core/agent/chat/message/message.d.ts +175 -0
  25. package/lib/core/ecom/index.d.ts +1 -0
  26. package/lib/core/ecom/shopee/index.d.ts +1 -0
  27. package/lib/core/ecom/shopee/src/client.d.ts +51 -0
  28. package/lib/core/ecom/shopee/src/index.d.ts +37 -0
  29. package/lib/core/ecom/shopee/src/merchant.d.ts +214 -0
  30. package/lib/core/ecom/shopee/src/public.d.ts +204 -0
  31. package/lib/core/ecom/shopee/src/shop.d.ts +177 -0
  32. package/lib/core/ecom/shopee/src/types.d.ts +102 -0
  33. package/lib/core/index.d.ts +1 -0
  34. package/lib/core/parse/fmode.cloud.d.ts +5 -4
  35. package/lib/user/account/account.service.d.ts +5 -0
  36. package/package.json +2 -1
@@ -0,0 +1,204 @@
1
+ import { ShopeeClient } from './client';
2
+ import { ApiResponse } from './types';
3
+ /**
4
+ * Shopee Public API Class
5
+ * Handles public/partner-level operations that don't require shop_id or main_account_id
6
+ */
7
+ export declare class ShopeePublic {
8
+ private client;
9
+ constructor(client: ShopeeClient);
10
+ /**
11
+ * Generate authorization URL for merchant/shop linking
12
+ * @param redirectUri Callback URL after authorization
13
+ */
14
+ generateAuthUrl(redirectUri: string): Promise<ApiResponse<{
15
+ auth_url: string;
16
+ partner_id: number;
17
+ environment: string;
18
+ expires_in: number;
19
+ }>>;
20
+ /**
21
+ * Generate cancel authorization URL
22
+ * @param redirectUri Callback URL after cancellation
23
+ */
24
+ generateCancelAuthUrl(redirectUri: string): Promise<ApiResponse<{
25
+ cancel_auth_url: string;
26
+ partner_id: number;
27
+ environment: string;
28
+ expires_in: number;
29
+ }>>;
30
+ /**
31
+ * Get partner configuration information
32
+ */
33
+ getConfig(): Promise<ApiResponse<{
34
+ partner_id: number;
35
+ environment: string;
36
+ auth_url: string;
37
+ token_urls: {
38
+ get_token: string;
39
+ refresh_token: string;
40
+ };
41
+ timestamp: number;
42
+ }>>;
43
+ /**
44
+ * Check API health status
45
+ */
46
+ healthCheck(): Promise<ApiResponse<{
47
+ status: string;
48
+ service: string;
49
+ timestamp: number;
50
+ environment: string;
51
+ partner_id: number;
52
+ }>>;
53
+ /**
54
+ * Verify API signature (for debugging and testing)
55
+ * @param path API path
56
+ * @param params Request parameters
57
+ * @param timestamp Request timestamp
58
+ */
59
+ verifySignature(path: string, params: Record<string, any>, timestamp: number): Promise<ApiResponse<{
60
+ base_string: string;
61
+ signature: string;
62
+ partner_id: number;
63
+ environment: string;
64
+ }>>;
65
+ /**
66
+ * Get public category tree for a region
67
+ * @param region Region code (e.g., 'sg', 'my', 'th', 'tw', 'ph', 'vn', 'id')
68
+ */
69
+ getPublicCategories(region: string): Promise<ApiResponse<any>>;
70
+ /**
71
+ * Get public item details (without authentication)
72
+ * @param itemId Item ID
73
+ * @param shopId Shop ID
74
+ * @param region Region code
75
+ */
76
+ getPublicItemDetail(itemId: number, shopId: number, region: string): Promise<ApiResponse<any>>;
77
+ /**
78
+ * Search public items
79
+ * @param options Search options
80
+ */
81
+ searchPublicItems(options: {
82
+ keyword?: string;
83
+ region: string;
84
+ category_id?: number;
85
+ limit?: number;
86
+ offset?: number;
87
+ sort_by?: 'relevance' | 'price_asc' | 'price_desc' | 'sales' | 'rating';
88
+ min_price?: number;
89
+ max_price?: number;
90
+ }): Promise<ApiResponse<{
91
+ items?: Array<{
92
+ item_id: number;
93
+ shop_id: number;
94
+ name: string;
95
+ price: number;
96
+ currency: string;
97
+ image: string;
98
+ rating?: number;
99
+ sales?: number;
100
+ }>;
101
+ total_count?: number;
102
+ has_more?: boolean;
103
+ }>>;
104
+ /**
105
+ * Get public shop information
106
+ * @param shopId Shop ID
107
+ * @param region Region code
108
+ */
109
+ getPublicShopInfo(shopId: number, region: string): Promise<ApiResponse<any>>;
110
+ /**
111
+ * Get public shop items
112
+ * @param shopId Shop ID
113
+ * @param region Region code
114
+ * @param options Pagination options
115
+ */
116
+ getPublicShopItems(shopId: number, region: string, options?: {
117
+ limit?: number;
118
+ offset?: number;
119
+ status?: 'NORMAL' | 'UNLIST';
120
+ sort_by?: 'created_time_desc' | 'created_time_asc' | 'price_asc' | 'price_desc';
121
+ }): Promise<ApiResponse<{
122
+ items?: Array<{
123
+ item_id: number;
124
+ name: string;
125
+ price: number;
126
+ currency: string;
127
+ image: string;
128
+ stock: number;
129
+ status: string;
130
+ }>;
131
+ total_count?: number;
132
+ has_more?: boolean;
133
+ }>>;
134
+ /**
135
+ * Get regional logistics information
136
+ * @param region Region code
137
+ */
138
+ getPublicLogistics(region: string): Promise<ApiResponse<{
139
+ channels?: Array<{
140
+ channel_id: number;
141
+ name: string;
142
+ shipping_fee?: number;
143
+ estimated_days?: number;
144
+ enabled: boolean;
145
+ }>;
146
+ }>>;
147
+ /**
148
+ * Get exchange rates
149
+ * @param fromCurrency Source currency
150
+ * @param toCurrency Target currency
151
+ */
152
+ getExchangeRates(fromCurrency?: string, toCurrency?: string): Promise<ApiResponse<{
153
+ rates?: Array<{
154
+ from_currency: string;
155
+ to_currency: string;
156
+ rate: number;
157
+ updated_time: number;
158
+ }>;
159
+ }>>;
160
+ /**
161
+ * Get marketplace statistics
162
+ * @param region Region code
163
+ */
164
+ getMarketplaceStats(region: string): Promise<ApiResponse<{
165
+ total_sellers?: number;
166
+ total_products?: number;
167
+ top_categories?: Array<{
168
+ category_id: number;
169
+ name: string;
170
+ product_count: number;
171
+ }>;
172
+ updated_time?: number;
173
+ }>>;
174
+ /**
175
+ * Get trending items
176
+ * @param region Region code
177
+ * @param category Optional category filter
178
+ */
179
+ getTrendingItems(region: string, category?: number): Promise<ApiResponse<{
180
+ items?: Array<{
181
+ item_id: number;
182
+ shop_id: number;
183
+ name: string;
184
+ price: number;
185
+ currency: string;
186
+ image: string;
187
+ trending_score?: number;
188
+ }>;
189
+ updated_time?: number;
190
+ }>>;
191
+ /**
192
+ * Validate webhook signature
193
+ * @param payload Webhook payload
194
+ * @param signature Webhook signature
195
+ */
196
+ validateWebhook(payload: any, signature: string): Promise<ApiResponse<{
197
+ valid: boolean;
198
+ partner_id: number;
199
+ }>>;
200
+ /**
201
+ * Get the underlying client instance
202
+ */
203
+ getClient(): ShopeeClient;
204
+ }
@@ -0,0 +1,177 @@
1
+ import { ShopeeClient } from './client';
2
+ import { ApiResponse, ProductItem, ShopInfo } from './types';
3
+ /**
4
+ * Shopee Shop API Class
5
+ * Handles shop-specific operations using a shop_id
6
+ */
7
+ export declare class ShopeeShop {
8
+ private client;
9
+ private shopId;
10
+ constructor(client: ShopeeClient, shopId: number);
11
+ /**
12
+ * Get shop information
13
+ */
14
+ getShopInfo(): Promise<ApiResponse<ShopInfo>>;
15
+ /**
16
+ * Get shop categories
17
+ */
18
+ getCategories(): Promise<ApiResponse<any>>;
19
+ /**
20
+ * Get shop comment
21
+ */
22
+ getComments(options: any): Promise<ApiResponse<any>>;
23
+ /**
24
+ * Get product list
25
+ * @param options Query options for pagination and filtering
26
+ */
27
+ getProductList(options?: {
28
+ page_size?: number;
29
+ offset?: number;
30
+ cursor?: string;
31
+ item_status?: 'NORMAL' | 'UNLIST' | 'DELETED' | 'BANNED';
32
+ include_deleted_items?: boolean;
33
+ product_type?: 'NORMAL' | 'PRE_ORDER';
34
+ update_time_from?: number;
35
+ update_time_to?: number;
36
+ }): Promise<ApiResponse<{
37
+ item?: ProductItem[];
38
+ next_cursor?: string;
39
+ has_more_page?: boolean;
40
+ }>>;
41
+ /**
42
+ * Get product details
43
+ * @param itemId Product ID
44
+ */
45
+ getProductDetail(itemId: number): Promise<ApiResponse<ProductItem>>;
46
+ /**
47
+ * Add a new product
48
+ * @param productData Product information
49
+ */
50
+ addProduct(productData: {
51
+ name: string;
52
+ description: string;
53
+ category_id: number;
54
+ price: number;
55
+ stock: number;
56
+ images: string[];
57
+ attributes?: Record<string, any>;
58
+ logistics?: Array<{
59
+ logistic_id: number;
60
+ enabled: boolean;
61
+ }>;
62
+ weight?: number;
63
+ dimension?: {
64
+ length: number;
65
+ width: number;
66
+ height: number;
67
+ };
68
+ }): Promise<ApiResponse<{
69
+ item_id: number;
70
+ }>>;
71
+ /**
72
+ * Update product information
73
+ * @param itemId Product ID
74
+ * @param updateData Update information
75
+ */
76
+ updateProduct(itemId: number, updateData: {
77
+ name?: string;
78
+ description?: string;
79
+ price?: number;
80
+ stock?: number;
81
+ images?: string[];
82
+ attributes?: Record<string, any>;
83
+ logistics?: Array<{
84
+ logistic_id: number;
85
+ enabled: boolean;
86
+ }>;
87
+ weight?: number;
88
+ dimension?: {
89
+ length: number;
90
+ width: number;
91
+ height: number;
92
+ };
93
+ }): Promise<ApiResponse<{
94
+ item_id: number;
95
+ }>>;
96
+ /**
97
+ * Delete a product
98
+ * @param itemId Product ID
99
+ */
100
+ deleteProduct(itemId: number): Promise<ApiResponse<{
101
+ item_id: number;
102
+ }>>;
103
+ /**
104
+ * Unlist a product (remove from sale but don't delete)
105
+ * @param itemId Product ID
106
+ */
107
+ unlistProduct(itemId: number): Promise<ApiResponse<{
108
+ item_id: number;
109
+ }>>;
110
+ /**
111
+ * Get shop order list
112
+ * @param options Query options for pagination and filtering
113
+ */
114
+ getOrderList(options?: {
115
+ page_size?: number;
116
+ cursor?: string;
117
+ order_status?: 'UNPAID' | 'READY_TO_SHIP' | 'COMPLETED' | 'IN_CANCEL' | 'CANCELLED' | 'TO_RETURN' | 'RETURNED';
118
+ create_time_from?: number;
119
+ create_time_to?: number;
120
+ update_time_from?: number;
121
+ update_time_to?: number;
122
+ response?: 'ALL' | 'TIMEOUT';
123
+ }): Promise<ApiResponse<{
124
+ orders?: Array<{
125
+ order_sn: string;
126
+ order_status: string;
127
+ create_time: number;
128
+ update_time: number;
129
+ total_amount: number;
130
+ currency: string;
131
+ pay_time?: number;
132
+ ship_by_date?: number;
133
+ package_list?: Array<{
134
+ package_no: string;
135
+ tracking_number?: string;
136
+ shipping_carrier?: string;
137
+ }>;
138
+ }>;
139
+ next_cursor?: string;
140
+ has_more_page?: boolean;
141
+ }>>;
142
+ /**
143
+ * Get order details
144
+ * @param orderSn Order serial number
145
+ */
146
+ getOrderDetail(orderSn: string): Promise<ApiResponse<any>>;
147
+ /**
148
+ * Get shop performance metrics
149
+ */
150
+ getPerformanceMetrics(): Promise<ApiResponse<any>>;
151
+ /**
152
+ * Get shop logistics information
153
+ */
154
+ getLogistics(): Promise<ApiResponse<any>>;
155
+ /**
156
+ * Get shop discount and promotion information
157
+ */
158
+ getDiscounts(): Promise<ApiResponse<any>>;
159
+ /**
160
+ * Get shop analytics data
161
+ * @param options Query options for time range and metrics
162
+ */
163
+ getAnalytics(options?: {
164
+ start_date?: string;
165
+ end_date?: string;
166
+ metrics?: string[];
167
+ granularity?: 'daily' | 'weekly' | 'monthly';
168
+ }): Promise<ApiResponse<any>>;
169
+ /**
170
+ * Get the shop ID
171
+ */
172
+ getShopId(): number;
173
+ /**
174
+ * Get the underlying client instance
175
+ */
176
+ getClient(): ShopeeClient;
177
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * SDK Configuration Options
3
+ */
4
+ export interface ShopeeSDKConfig {
5
+ /** Server base URL where the forwarding API is hosted */
6
+ serverUrl: string;
7
+ /** Request timeout in milliseconds (default: 30000) */
8
+ timeout?: number;
9
+ /** Additional headers to include in requests */
10
+ headers?: Record<string, string>;
11
+ }
12
+ /**
13
+ * API Request Options
14
+ */
15
+ export interface RequestOptions {
16
+ /** HTTP method (GET, POST, PUT, DELETE) */
17
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
18
+ /** API path (e.g., '/api/v2/product/get_item_list') */
19
+ path: string;
20
+ /** Query parameters */
21
+ query?: Record<string, any>;
22
+ /** Request body data */
23
+ body?: any;
24
+ }
25
+ /**
26
+ * API Response
27
+ */
28
+ export interface ApiResponse<T = any> {
29
+ success: boolean;
30
+ data?: T;
31
+ error?: string;
32
+ message?: string;
33
+ request_info?: {
34
+ shop_id: number;
35
+ method: string;
36
+ path: string;
37
+ timestamp: number;
38
+ };
39
+ }
40
+ /**
41
+ * Authorization Required Response
42
+ */
43
+ export interface AuthRequiredResponse {
44
+ success: false;
45
+ error: 'AUTH_REQUIRED' | 'AUTH_EXPIRED';
46
+ message: string;
47
+ data: {
48
+ auth_url: string;
49
+ shop_id: number;
50
+ redirect_uri: string;
51
+ };
52
+ }
53
+ /**
54
+ * API Error Response
55
+ */
56
+ export interface ApiErrorResponse {
57
+ success: false;
58
+ error: string;
59
+ message: string;
60
+ data: {
61
+ status_code: number;
62
+ api_response: any;
63
+ request_info: {
64
+ shop_id: number;
65
+ method: string;
66
+ path: string;
67
+ timestamp: number;
68
+ };
69
+ };
70
+ }
71
+ /**
72
+ * Shop Information
73
+ */
74
+ export interface ShopInfo {
75
+ shop_id: number;
76
+ shop_name?: string;
77
+ region?: string;
78
+ status?: string;
79
+ }
80
+ /**
81
+ * Merchant Information
82
+ */
83
+ export interface MerchantInfo {
84
+ merchant_id: number;
85
+ merchant_name?: string;
86
+ region?: string;
87
+ status?: string;
88
+ }
89
+ /**
90
+ * Product Item
91
+ */
92
+ export interface ProductItem {
93
+ item_id: number;
94
+ shop_id: number;
95
+ item_name: string;
96
+ description?: string;
97
+ price?: number;
98
+ stock?: number;
99
+ status?: string;
100
+ created_time?: number;
101
+ update_time?: number;
102
+ }
@@ -5,3 +5,4 @@ export * from "./social";
5
5
  export * from "./storage";
6
6
  export * from "./storage/util-file-md5";
7
7
  export * from "./storage/util-file-metadata";
8
+ export * from "./ecom";
@@ -1,4 +1,3 @@
1
- import { FmodeConfig } from './types';
2
1
  export interface CloudFunctionRequest {
3
2
  params: any;
4
3
  user?: any;
@@ -11,12 +10,14 @@ export interface CloudFunctionResponse {
11
10
  }
12
11
  export type CloudFunction = (request: CloudFunctionRequest, response: CloudFunctionResponse) => void;
13
12
  export declare class FmodeCloud {
14
- private static _instance;
15
- private _config;
13
+ private static _singletonInstance;
16
14
  private _cloudFunctions;
17
15
  private constructor();
18
16
  static getInstance(): FmodeCloud;
19
- bindInstance(config: FmodeConfig): void;
17
+ static _instance: any;
18
+ static bindInstance(instance: any): void;
19
+ private get currentConfig();
20
+ static get instance(): any;
20
21
  define(functionName: string, cloudFunction: CloudFunction): void;
21
22
  run(functionName: string, params?: any, options?: any): Promise<any>;
22
23
  afterDelete(className: string, func: CloudFunction): Promise<void>;
@@ -9,6 +9,10 @@ export declare class AccountService {
9
9
  private http;
10
10
  company: string;
11
11
  billing: any;
12
+ private billingCache;
13
+ private billingCachePromise;
14
+ private billingCacheTime;
15
+ private readonly CACHE_EXPIRY_TIME;
12
16
  profile: FmodeObject | any;
13
17
  wxAppId: string;
14
18
  wxpayEnabled: boolean;
@@ -17,6 +21,7 @@ export declare class AccountService {
17
21
  constructor(ncloud: NovaCloudService, authServ: AuthService, http: HttpClient);
18
22
  getProfile(): Promise<void>;
19
23
  getBilling(): Promise<any>;
24
+ private fetchBillingData;
20
25
  getUserOpenid(): Promise<void>;
21
26
  authWechat(url?: string): void;
22
27
  getQueryStringByName(name: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmode-ng",
3
- "version": "0.0.231",
3
+ "version": "0.0.233",
4
4
  "author": "未来全栈",
5
5
  "license": "COPYRIGHT © 未来飞马 未来全栈 www.fmode.cn All RIGHTS RESERVED",
6
6
  "exports": {
@@ -74,6 +74,7 @@
74
74
  "@awesome-cordova-plugins/core": "^7.0.0 || ^8.0.0",
75
75
  "@awesome-cordova-plugins/media-capture": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
76
76
  "@wecom/jssdk": "^2.2.4",
77
+ "dingtalk-jsapi": "^3.2.0",
77
78
  "quill": "^2.0.0",
78
79
  "plupload": "^2.0.0 || 2.3.9",
79
80
  "swiper": "^10.0.0 || ^11.0.0",