@doubao-dev/framework 0.0.38-canary-1b929937-20260722020207
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/LICENCE +10 -0
- package/README.md +9 -0
- package/components-style.css +2 -0
- package/components.d.ts +1 -0
- package/dist/api.d.ts +9916 -0
- package/dist/components.d.ts +4504 -0
- package/dist/config.d.ts +295 -0
- package/dist/config.js +3 -0
- package/dist/index.d.ts +779 -0
- package/dist/index.js +2 -0
- package/jsx-runtime.d.ts +50 -0
- package/package.json +83 -0
- package/types.d.ts +179 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
import { Attributes } from 'react';
|
|
2
|
+
import { CElement } from 'react';
|
|
3
|
+
import { CFactory } from 'react';
|
|
4
|
+
import { ChildContextProvider } from 'react';
|
|
5
|
+
import { ClassAttributes } from 'react';
|
|
6
|
+
import { ClassicComponent } from 'react';
|
|
7
|
+
import { ClassicComponentClass } from 'react';
|
|
8
|
+
import { ClassicElement } from 'react';
|
|
9
|
+
import { ClassicFactory } from 'react';
|
|
10
|
+
import { ClassType } from 'react';
|
|
11
|
+
import { cloneElement } from 'react';
|
|
12
|
+
import { Component } from 'react';
|
|
13
|
+
import { ComponentClass } from 'react';
|
|
14
|
+
import { ComponentElement } from 'react';
|
|
15
|
+
import { ComponentFactory } from 'react';
|
|
16
|
+
import { ComponentLifecycle } from 'react';
|
|
17
|
+
import { ComponentProps } from 'react';
|
|
18
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
19
|
+
import { ComponentPropsWithRef } from 'react';
|
|
20
|
+
import { ComponentRef } from 'react';
|
|
21
|
+
import { ComponentSpec } from 'react';
|
|
22
|
+
import { ComponentState } from 'react';
|
|
23
|
+
import { ComponentType } from 'react';
|
|
24
|
+
import { Consumer } from 'react';
|
|
25
|
+
import { ConsumerProps } from 'react';
|
|
26
|
+
import { Context } from 'react';
|
|
27
|
+
import { ContextType } from 'react';
|
|
28
|
+
import { createContext } from 'react';
|
|
29
|
+
import { createElement } from 'react';
|
|
30
|
+
import { createRef } from 'react';
|
|
31
|
+
import { CustomComponentPropsWithRef } from 'react';
|
|
32
|
+
import { DependencyList } from 'react';
|
|
33
|
+
import { DeprecatedLifecycle } from 'react';
|
|
34
|
+
import { Dispatch } from 'react';
|
|
35
|
+
import { DispatchWithoutAction } from 'react';
|
|
36
|
+
import { EffectCallback } from 'react';
|
|
37
|
+
import { ElementRef } from 'react';
|
|
38
|
+
import { ElementType } from 'react';
|
|
39
|
+
import { ExoticComponent } from 'react';
|
|
40
|
+
import { Factory } from 'react';
|
|
41
|
+
import { FC } from 'react';
|
|
42
|
+
import { ForwardedRef } from 'react';
|
|
43
|
+
import { forwardRef } from 'react';
|
|
44
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
45
|
+
import { ForwardRefRenderFunction } from 'react';
|
|
46
|
+
import { Fragment } from 'react';
|
|
47
|
+
import { FunctionComponent } from 'react';
|
|
48
|
+
import { FunctionComponentElement } from 'react';
|
|
49
|
+
import { FunctionComponentFactory } from 'react';
|
|
50
|
+
import { GetDerivedStateFromError } from 'react';
|
|
51
|
+
import { GetDerivedStateFromProps } from 'react';
|
|
52
|
+
import { isValidElement } from 'react';
|
|
53
|
+
import { JSXElementConstructor } from 'react';
|
|
54
|
+
import { Key } from 'react';
|
|
55
|
+
import { lazy } from 'react';
|
|
56
|
+
import { LazyExoticComponent } from 'react';
|
|
57
|
+
import { LegacyRef } from 'react';
|
|
58
|
+
import { memo } from 'react';
|
|
59
|
+
import { MemoExoticComponent } from 'react';
|
|
60
|
+
import { Mixin } from 'react';
|
|
61
|
+
import { MutableRefObject } from 'react';
|
|
62
|
+
import { NamedExoticComponent } from 'react';
|
|
63
|
+
import { NewLifecycle } from 'react';
|
|
64
|
+
import { PropsWithChildren } from 'react';
|
|
65
|
+
import { PropsWithoutRef } from 'react';
|
|
66
|
+
import { PropsWithRef } from 'react';
|
|
67
|
+
import { Provider } from 'react';
|
|
68
|
+
import { ProviderExoticComponent } from 'react';
|
|
69
|
+
import { ProviderProps } from 'react';
|
|
70
|
+
import { PureComponent } from 'react';
|
|
71
|
+
import { ReactComponentElement } from 'react';
|
|
72
|
+
import { ReactElement } from 'react';
|
|
73
|
+
import { ReactInstance } from 'react';
|
|
74
|
+
import { ReactNode } from 'react';
|
|
75
|
+
import { Reducer } from 'react';
|
|
76
|
+
import { ReducerAction } from 'react';
|
|
77
|
+
import { ReducerState } from 'react';
|
|
78
|
+
import { ReducerStateWithoutAction } from 'react';
|
|
79
|
+
import { ReducerWithoutAction } from 'react';
|
|
80
|
+
import { Ref } from 'react';
|
|
81
|
+
import { RefAttributes } from 'react';
|
|
82
|
+
import { RefCallback } from 'react';
|
|
83
|
+
import { RefObject } from 'react';
|
|
84
|
+
import { SetStateAction } from 'react';
|
|
85
|
+
import { SFCFactory } from 'react';
|
|
86
|
+
import { StaticLifecycle } from 'react';
|
|
87
|
+
import { Suspense } from 'react';
|
|
88
|
+
import { SVGFactory } from 'react';
|
|
89
|
+
import { TransitionFunction } from 'react';
|
|
90
|
+
import { TransitionStartFunction } from 'react';
|
|
91
|
+
import { useCallback } from 'react';
|
|
92
|
+
import { useContext } from 'react';
|
|
93
|
+
import { useDebugValue } from 'react';
|
|
94
|
+
import { useEffect } from 'react';
|
|
95
|
+
import { useImperativeHandle } from 'react';
|
|
96
|
+
import { useMemo } from 'react';
|
|
97
|
+
import { useReducer } from 'react';
|
|
98
|
+
import { useRef } from 'react';
|
|
99
|
+
import { useState } from 'react';
|
|
100
|
+
import { useSyncExternalStore } from 'react';
|
|
101
|
+
import { VFC } from 'react';
|
|
102
|
+
import { VoidFunctionComponent } from 'react';
|
|
103
|
+
|
|
104
|
+
declare interface AgreePrivacyResult {
|
|
105
|
+
/** Whether the save was successful */
|
|
106
|
+
result: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare interface AIAppMetadata {
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* 豆包应用 ID
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
appId: string;
|
|
116
|
+
/**
|
|
117
|
+
* 应用名称
|
|
118
|
+
*/
|
|
119
|
+
name?: string;
|
|
120
|
+
/**
|
|
121
|
+
* 应用描述
|
|
122
|
+
*/
|
|
123
|
+
description?: string;
|
|
124
|
+
/**
|
|
125
|
+
* 应用图标
|
|
126
|
+
*
|
|
127
|
+
* 1x, 2x, 3x 分别对应 1x, 2x, 3x 倍的图标
|
|
128
|
+
*/
|
|
129
|
+
icons?: Icons;
|
|
130
|
+
/**
|
|
131
|
+
* 应用关键词
|
|
132
|
+
*/
|
|
133
|
+
keywords?: string[];
|
|
134
|
+
/**
|
|
135
|
+
* 应用版本
|
|
136
|
+
*/
|
|
137
|
+
version?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export declare type AIToolContext = MessageMeta & {
|
|
141
|
+
/**
|
|
142
|
+
* callback Id
|
|
143
|
+
*/
|
|
144
|
+
callbackId: string;
|
|
145
|
+
/**
|
|
146
|
+
* feature map
|
|
147
|
+
*/
|
|
148
|
+
featureMap: Record<string, string> | undefined;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export declare type AIViewContext = MessageMeta & {
|
|
152
|
+
/**
|
|
153
|
+
* View ID
|
|
154
|
+
*/
|
|
155
|
+
viewId: string;
|
|
156
|
+
/**
|
|
157
|
+
* this message is replying for which message
|
|
158
|
+
*/
|
|
159
|
+
replyFor: string;
|
|
160
|
+
/**
|
|
161
|
+
* this page name
|
|
162
|
+
*/
|
|
163
|
+
pageName: string;
|
|
164
|
+
/**
|
|
165
|
+
* The view setting info
|
|
166
|
+
*/
|
|
167
|
+
appSettings: Record<string, any>;
|
|
168
|
+
/**
|
|
169
|
+
* Language type
|
|
170
|
+
*/
|
|
171
|
+
lang: string;
|
|
172
|
+
/**
|
|
173
|
+
* Custom extra message from client
|
|
174
|
+
*/
|
|
175
|
+
extra?: {
|
|
176
|
+
/**
|
|
177
|
+
* Width of widget container
|
|
178
|
+
*/
|
|
179
|
+
width: number;
|
|
180
|
+
/**
|
|
181
|
+
* Height of widget container
|
|
182
|
+
*/
|
|
183
|
+
height: number;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export declare type AnyObject = Record<string, any>;
|
|
188
|
+
|
|
189
|
+
export declare type App<T extends DefineAppOptions = DefineAppOptions> = T & {
|
|
190
|
+
__APP__: boolean;
|
|
191
|
+
__UI__: boolean;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
declare type AppAIMeta = Omit<AIAppMetadata, 'appId'> & {
|
|
195
|
+
appId?: string;
|
|
196
|
+
package?: string;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export { Attributes }
|
|
200
|
+
|
|
201
|
+
export { CElement }
|
|
202
|
+
|
|
203
|
+
export { CFactory }
|
|
204
|
+
|
|
205
|
+
export { ChildContextProvider }
|
|
206
|
+
|
|
207
|
+
export { ClassAttributes }
|
|
208
|
+
|
|
209
|
+
export { ClassicComponent }
|
|
210
|
+
|
|
211
|
+
export { ClassicComponentClass }
|
|
212
|
+
|
|
213
|
+
export { ClassicElement }
|
|
214
|
+
|
|
215
|
+
export { ClassicFactory }
|
|
216
|
+
|
|
217
|
+
export { ClassType }
|
|
218
|
+
|
|
219
|
+
export { cloneElement }
|
|
220
|
+
|
|
221
|
+
export { Component }
|
|
222
|
+
|
|
223
|
+
export { ComponentClass }
|
|
224
|
+
|
|
225
|
+
export { ComponentElement }
|
|
226
|
+
|
|
227
|
+
export { ComponentFactory }
|
|
228
|
+
|
|
229
|
+
export { ComponentLifecycle }
|
|
230
|
+
|
|
231
|
+
export { ComponentProps }
|
|
232
|
+
|
|
233
|
+
export { ComponentPropsWithoutRef }
|
|
234
|
+
|
|
235
|
+
export { ComponentPropsWithRef }
|
|
236
|
+
|
|
237
|
+
export { ComponentRef }
|
|
238
|
+
|
|
239
|
+
export { ComponentSpec }
|
|
240
|
+
|
|
241
|
+
export { ComponentState }
|
|
242
|
+
|
|
243
|
+
export { ComponentType }
|
|
244
|
+
|
|
245
|
+
export { Consumer }
|
|
246
|
+
|
|
247
|
+
export { ConsumerProps }
|
|
248
|
+
|
|
249
|
+
export { Context }
|
|
250
|
+
|
|
251
|
+
export { ContextType }
|
|
252
|
+
|
|
253
|
+
export { createContext }
|
|
254
|
+
|
|
255
|
+
export { createElement }
|
|
256
|
+
|
|
257
|
+
export { createRef }
|
|
258
|
+
|
|
259
|
+
export declare interface CurrentPage {
|
|
260
|
+
route: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export { CustomComponentPropsWithRef }
|
|
264
|
+
|
|
265
|
+
export declare function defineApp<T extends DefineAppOptions>(options: T & ThisType<T & {
|
|
266
|
+
readonly aiMeta: AppAIMeta;
|
|
267
|
+
}>): App<T>;
|
|
268
|
+
|
|
269
|
+
export declare interface DefineAppOptions {
|
|
270
|
+
[key: string]: any;
|
|
271
|
+
/**
|
|
272
|
+
* @deprecated Configure app metadata in src/app.config.ts instead.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* // src/app.config.ts
|
|
277
|
+
* import { defineAppConfig } from '@doubao-dev/framework/config';
|
|
278
|
+
*
|
|
279
|
+
* export default defineAppConfig({
|
|
280
|
+
* appId: 'your-app-id',
|
|
281
|
+
* name: 'Demo App',
|
|
282
|
+
* description: 'Describe what this app can do',
|
|
283
|
+
* icons: 'https://example.com/icon.png',
|
|
284
|
+
* keywords: ['demo', 'doubao']
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
aiMeta?: AppAIMeta;
|
|
289
|
+
/**
|
|
290
|
+
* App launched
|
|
291
|
+
*/
|
|
292
|
+
onLaunch?: () => void;
|
|
293
|
+
/**
|
|
294
|
+
* On page opened
|
|
295
|
+
*/
|
|
296
|
+
onPageOpened?: (params: {
|
|
297
|
+
viewId: string;
|
|
298
|
+
}) => void;
|
|
299
|
+
/**
|
|
300
|
+
* On foreground
|
|
301
|
+
*/
|
|
302
|
+
onForeground?: () => void;
|
|
303
|
+
/**
|
|
304
|
+
* On background
|
|
305
|
+
*/
|
|
306
|
+
onBackground?: () => void;
|
|
307
|
+
/**
|
|
308
|
+
* On destroy
|
|
309
|
+
*/
|
|
310
|
+
onDestroy?: () => void;
|
|
311
|
+
/**
|
|
312
|
+
* Handle errors from other lifecycle hooks in this class or from tools in same Applet
|
|
313
|
+
*/
|
|
314
|
+
onError?: (e: Error) => void;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export declare interface DefineFunctionalToolOptions extends Tool {
|
|
318
|
+
onApply: (input: string, context: AIToolContext) => string | object | Promise<string | object>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export declare function defineLoginApi(api: LoginApi): LoginApi;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* 定义 MCP 登录页面
|
|
325
|
+
* @param options 定义 MCP 登录页面的选项
|
|
326
|
+
* @returns 智能服务 MCP 登录页面
|
|
327
|
+
*/
|
|
328
|
+
export declare function defineLoginPage<Data extends AnyObject>(options: Omit<DefinePageToolOptions<Data>, 'aiMeta'> & ThisType<Readonly<PageInstanceMethods<Data>>>): Page<Data>;
|
|
329
|
+
|
|
330
|
+
export declare function definePage<Data extends AnyObject>(options: DefinePageToolOptions<Data> & ThisType<Readonly<PageInstanceMethods<Data>>>): Page<Data>;
|
|
331
|
+
|
|
332
|
+
export declare interface DefinePageToolOptions<Data extends AnyObject> extends DefineUIToolOptions<Data, PageToolExtraMetadata> {
|
|
333
|
+
/**
|
|
334
|
+
* @deprecated Configure page metadata in src/app.config.ts instead.
|
|
335
|
+
*
|
|
336
|
+
* Use `pages` entries in `src/app.config.ts`. For example,
|
|
337
|
+
* `pages/home/index` maps to `src/pages/home/index.tsx`, and
|
|
338
|
+
* `pages/account/demo/index` maps to `src/pages/account/demo/index.tsx`.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* // src/app.config.ts
|
|
343
|
+
* import { defineAppConfig } from '@doubao-dev/framework/config';
|
|
344
|
+
*
|
|
345
|
+
* export default defineAppConfig({
|
|
346
|
+
* appId: 'your-app-id',
|
|
347
|
+
* pages: ['pages/home/index']
|
|
348
|
+
* });
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
aiMeta?: PageToolMetadata;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export declare function definePrivacyApi(api: PrivacyApi): PrivacyApi;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* 定义 MCP 同意登录和隐私协议卡片组件
|
|
358
|
+
* @param options 定义 MCP 同意登录和隐私协议卡片组件的选项
|
|
359
|
+
* @returns MCP 同意登录和隐私协议卡片组件
|
|
360
|
+
*/
|
|
361
|
+
export declare function definePrivacyLoginWidget<Data extends AnyObject>(options: Omit<DefineWidgetToolOptions<Data>, 'aiMeta'> & ThisType<Readonly<WidgetInstanceMethods<Data>>>): Widget<Data>;
|
|
362
|
+
|
|
363
|
+
export declare function defineTool(options: DefineFunctionalToolOptions & ThisType<Readonly<FunctionalToolInstanceMethods>>): FunctionalTool;
|
|
364
|
+
|
|
365
|
+
export declare interface DefineUIToolOptions<Data extends AnyObject, Extra extends AnyObject = AnyObject> extends Tool<Extra> {
|
|
366
|
+
/**
|
|
367
|
+
* Initial data
|
|
368
|
+
*/
|
|
369
|
+
data?: Data;
|
|
370
|
+
/**
|
|
371
|
+
* Trigger on view created
|
|
372
|
+
* @returns
|
|
373
|
+
*/
|
|
374
|
+
onCreated?: () => void;
|
|
375
|
+
/**
|
|
376
|
+
* It is triggered after the view is rendered and will only be called once in the view's life cycle.
|
|
377
|
+
* @returns
|
|
378
|
+
*/
|
|
379
|
+
onMounted?: () => void;
|
|
380
|
+
/**
|
|
381
|
+
* 1. It is triggered when the view is first displayed.
|
|
382
|
+
* 2. It is triggered when the view is displayed again after being hidden.
|
|
383
|
+
* @returns
|
|
384
|
+
*/
|
|
385
|
+
onShow?: () => void;
|
|
386
|
+
/**
|
|
387
|
+
* It is triggered when the view is hidden.
|
|
388
|
+
* @returns
|
|
389
|
+
*/
|
|
390
|
+
onHide?: () => void;
|
|
391
|
+
/**
|
|
392
|
+
* It is triggered when the view is destroyed.
|
|
393
|
+
* @returns
|
|
394
|
+
*/
|
|
395
|
+
onDestroy?: () => void;
|
|
396
|
+
/**
|
|
397
|
+
* It is triggered when an error occurs.
|
|
398
|
+
* @param e
|
|
399
|
+
* @returns
|
|
400
|
+
*/
|
|
401
|
+
onError?: (e: Error) => void;
|
|
402
|
+
/**
|
|
403
|
+
* Render function
|
|
404
|
+
* Use getViewData() and getViewContext() to access data and context
|
|
405
|
+
* @returns
|
|
406
|
+
*/
|
|
407
|
+
render: () => ReactNode;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export declare function defineWidget<Data extends AnyObject>(options: DefineWidgetToolOptions<Data> & ThisType<Readonly<WidgetInstanceMethods<Data>>>): Widget<Data>;
|
|
411
|
+
|
|
412
|
+
export declare interface DefineWidgetToolOptions<Data extends AnyObject> extends DefineUIToolOptions<Data, WidgetToolExtraMetadata> {
|
|
413
|
+
/**
|
|
414
|
+
* @deprecated Configure widget metadata in src/app.config.ts instead.
|
|
415
|
+
*
|
|
416
|
+
* Use `widgets` entries in `src/app.config.ts`. For example,
|
|
417
|
+
* `widgets/card/index` maps to `src/widgets/card/index.tsx`, and
|
|
418
|
+
* `widgets/api/demo/index` maps to `src/widgets/api/demo/index.tsx`.
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```ts
|
|
422
|
+
* // src/app.config.ts
|
|
423
|
+
* import { defineAppConfig } from '@doubao-dev/framework/config';
|
|
424
|
+
*
|
|
425
|
+
* export default defineAppConfig({
|
|
426
|
+
* appId: 'your-app-id',
|
|
427
|
+
* widgets: [
|
|
428
|
+
* {
|
|
429
|
+
* entry: 'widgets/card/index',
|
|
430
|
+
* id: 'card-widget',
|
|
431
|
+
* name: 'Card Widget',
|
|
432
|
+
* description: 'Show card content',
|
|
433
|
+
* border: true
|
|
434
|
+
* }
|
|
435
|
+
* ]
|
|
436
|
+
* });
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
aiMeta?: WidgetToolMetadata;
|
|
440
|
+
/**
|
|
441
|
+
* 1. It is triggered when the app returns to the foreground from the background.
|
|
442
|
+
* 2. It is triggered when phone is unlocked.
|
|
443
|
+
* @returns
|
|
444
|
+
*/
|
|
445
|
+
onForeground?: () => void;
|
|
446
|
+
/**
|
|
447
|
+
* 1. It is triggered when the app is moved to the background.
|
|
448
|
+
* 2. It is triggered when phone is locked.
|
|
449
|
+
* @returns
|
|
450
|
+
*/
|
|
451
|
+
onBackground?: () => void;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export { DependencyList }
|
|
455
|
+
|
|
456
|
+
export { DeprecatedLifecycle }
|
|
457
|
+
|
|
458
|
+
export { Dispatch }
|
|
459
|
+
|
|
460
|
+
export { DispatchWithoutAction }
|
|
461
|
+
|
|
462
|
+
/** 当前前端库版本。 */
|
|
463
|
+
declare const DoubaoAppsSDKVersion_2: string;
|
|
464
|
+
export { DoubaoAppsSDKVersion_2 as DoubaoAppsSDKVersion }
|
|
465
|
+
|
|
466
|
+
export { EffectCallback }
|
|
467
|
+
|
|
468
|
+
export { ElementRef }
|
|
469
|
+
|
|
470
|
+
export { ElementType }
|
|
471
|
+
|
|
472
|
+
export { ExoticComponent }
|
|
473
|
+
|
|
474
|
+
export { Factory }
|
|
475
|
+
|
|
476
|
+
export { FC }
|
|
477
|
+
|
|
478
|
+
export { ForwardedRef }
|
|
479
|
+
|
|
480
|
+
export { forwardRef }
|
|
481
|
+
|
|
482
|
+
export { ForwardRefExoticComponent }
|
|
483
|
+
|
|
484
|
+
export { ForwardRefRenderFunction }
|
|
485
|
+
|
|
486
|
+
export { Fragment }
|
|
487
|
+
|
|
488
|
+
export declare interface FunctionalTool extends DefineFunctionalToolOptions {
|
|
489
|
+
__FUNCTIONAL__: boolean;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
declare type FunctionalToolInstanceMethods = Tool<ToolMetadata>;
|
|
493
|
+
|
|
494
|
+
export { FunctionComponent }
|
|
495
|
+
|
|
496
|
+
export { FunctionComponentElement }
|
|
497
|
+
|
|
498
|
+
export { FunctionComponentFactory }
|
|
499
|
+
|
|
500
|
+
declare function getApp_2<T extends App = App>(): T;
|
|
501
|
+
export { getApp_2 as getApp }
|
|
502
|
+
|
|
503
|
+
export declare function getCurrentPages(): CurrentPage[];
|
|
504
|
+
|
|
505
|
+
export { GetDerivedStateFromError }
|
|
506
|
+
|
|
507
|
+
export { GetDerivedStateFromProps }
|
|
508
|
+
|
|
509
|
+
declare interface GetPhoneNumberResult {
|
|
510
|
+
code?: string;
|
|
511
|
+
message?: string;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export declare function getViewContext(): any;
|
|
515
|
+
|
|
516
|
+
export declare function getViewData<T extends Record<string, any>>(): T;
|
|
517
|
+
|
|
518
|
+
export declare function getWidgetInstanceId(): string | undefined;
|
|
519
|
+
|
|
520
|
+
declare type Icons = string | Record<'1x' | '2x' | '3x', string>;
|
|
521
|
+
|
|
522
|
+
export { isValidElement }
|
|
523
|
+
|
|
524
|
+
export { JSXElementConstructor }
|
|
525
|
+
|
|
526
|
+
export { Key }
|
|
527
|
+
|
|
528
|
+
export { lazy }
|
|
529
|
+
|
|
530
|
+
export { LazyExoticComponent }
|
|
531
|
+
|
|
532
|
+
export { LegacyRef }
|
|
533
|
+
|
|
534
|
+
declare type LifecycleCallback = () => void;
|
|
535
|
+
|
|
536
|
+
declare type LifecycleErrorCallback = (error: Error) => void;
|
|
537
|
+
|
|
538
|
+
export declare interface LoginApi {
|
|
539
|
+
onLogin: (res: LoginResult) => Promise<void> | void;
|
|
540
|
+
onRefuseLogin: () => Promise<void> | void;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export declare type LoginResult = GetPhoneNumberResult;
|
|
544
|
+
|
|
545
|
+
export { memo }
|
|
546
|
+
|
|
547
|
+
export { MemoExoticComponent }
|
|
548
|
+
|
|
549
|
+
export declare interface MessageMeta {
|
|
550
|
+
/**
|
|
551
|
+
* Bot ID
|
|
552
|
+
*/
|
|
553
|
+
botId: string;
|
|
554
|
+
/**
|
|
555
|
+
* message ID
|
|
556
|
+
*/
|
|
557
|
+
msgId: string;
|
|
558
|
+
/**
|
|
559
|
+
* IM message create time
|
|
560
|
+
*/
|
|
561
|
+
msgCreateTime: number;
|
|
562
|
+
/**
|
|
563
|
+
* IM message received time
|
|
564
|
+
*/
|
|
565
|
+
msgReceivedTime: number;
|
|
566
|
+
/**
|
|
567
|
+
* conversation ID
|
|
568
|
+
*/
|
|
569
|
+
conversationId?: string;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export { Mixin }
|
|
573
|
+
|
|
574
|
+
export { MutableRefObject }
|
|
575
|
+
|
|
576
|
+
export { NamedExoticComponent }
|
|
577
|
+
|
|
578
|
+
export { NewLifecycle }
|
|
579
|
+
|
|
580
|
+
export declare interface Page<Data extends AnyObject = AnyObject> extends DefineUIToolOptions<Data> {
|
|
581
|
+
__UI__: boolean;
|
|
582
|
+
__PAGE__: boolean;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
declare type PageInstanceMethods<Data extends AnyObject> = UIInstanceMethods<Data, PageToolExtraMetadata>;
|
|
586
|
+
|
|
587
|
+
declare type PageToolExtraMetadata = {
|
|
588
|
+
/**
|
|
589
|
+
* The page navbar title
|
|
590
|
+
*/
|
|
591
|
+
title?: string;
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
export declare type PageToolMetadata = ToolMeta & PageToolExtraMetadata;
|
|
595
|
+
|
|
596
|
+
export declare type PrivacyAgreeResult = AgreePrivacyResult;
|
|
597
|
+
|
|
598
|
+
export declare interface PrivacyApi {
|
|
599
|
+
onAgreePrivacy: (res: PrivacyAgreeResult) => Promise<void> | void;
|
|
600
|
+
onRefusePrivacy: () => Promise<void> | void;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export { PropsWithChildren }
|
|
604
|
+
|
|
605
|
+
export { PropsWithoutRef }
|
|
606
|
+
|
|
607
|
+
export { PropsWithRef }
|
|
608
|
+
|
|
609
|
+
export { Provider }
|
|
610
|
+
|
|
611
|
+
export { ProviderExoticComponent }
|
|
612
|
+
|
|
613
|
+
export { ProviderProps }
|
|
614
|
+
|
|
615
|
+
export { PureComponent }
|
|
616
|
+
|
|
617
|
+
export { ReactComponentElement }
|
|
618
|
+
|
|
619
|
+
export { ReactElement }
|
|
620
|
+
|
|
621
|
+
export { ReactInstance }
|
|
622
|
+
|
|
623
|
+
export { ReactNode }
|
|
624
|
+
|
|
625
|
+
export { Reducer }
|
|
626
|
+
|
|
627
|
+
export { ReducerAction }
|
|
628
|
+
|
|
629
|
+
export { ReducerState }
|
|
630
|
+
|
|
631
|
+
export { ReducerStateWithoutAction }
|
|
632
|
+
|
|
633
|
+
export { ReducerWithoutAction }
|
|
634
|
+
|
|
635
|
+
export { Ref }
|
|
636
|
+
|
|
637
|
+
export { RefAttributes }
|
|
638
|
+
|
|
639
|
+
export { RefCallback }
|
|
640
|
+
|
|
641
|
+
export { RefObject }
|
|
642
|
+
|
|
643
|
+
export { SetStateAction }
|
|
644
|
+
|
|
645
|
+
export { SFCFactory }
|
|
646
|
+
|
|
647
|
+
export { StaticLifecycle }
|
|
648
|
+
|
|
649
|
+
export { Suspense }
|
|
650
|
+
|
|
651
|
+
export { SVGFactory }
|
|
652
|
+
|
|
653
|
+
export declare interface Tool<Extra extends AnyObject = AnyObject> {
|
|
654
|
+
aiMeta?: ToolMeta & Extra;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export declare interface ToolMeta {
|
|
658
|
+
/**
|
|
659
|
+
* unique identifier
|
|
660
|
+
*/
|
|
661
|
+
id: string;
|
|
662
|
+
/**
|
|
663
|
+
* name of the tool
|
|
664
|
+
*/
|
|
665
|
+
name?: string;
|
|
666
|
+
/**
|
|
667
|
+
* description of the tool
|
|
668
|
+
*/
|
|
669
|
+
description?: string;
|
|
670
|
+
/**
|
|
671
|
+
* Widget title type
|
|
672
|
+
* - none: 默认,无标题
|
|
673
|
+
* - normal: 常规标题
|
|
674
|
+
* - float: 浮动标题
|
|
675
|
+
*/
|
|
676
|
+
titleType?: 'none' | 'normal' | 'float';
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
export declare type ToolMetadata = {
|
|
680
|
+
/**
|
|
681
|
+
* specifies when a call to a tool will time out, in ms.
|
|
682
|
+
*/
|
|
683
|
+
timeout?: number;
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
export { TransitionFunction }
|
|
687
|
+
|
|
688
|
+
export { TransitionStartFunction }
|
|
689
|
+
|
|
690
|
+
export declare interface UIInstanceMethods<Data extends AnyObject, Extra extends AnyObject = AnyObject> extends Tool<Extra> {
|
|
691
|
+
/**
|
|
692
|
+
* Instance data
|
|
693
|
+
*/
|
|
694
|
+
data: Data;
|
|
695
|
+
/**
|
|
696
|
+
* Set data asynchronously and trigger view re-rendering
|
|
697
|
+
* @param data
|
|
698
|
+
* @param callback
|
|
699
|
+
* @returns
|
|
700
|
+
*/
|
|
701
|
+
setData: (data: Partial<Data> & AnyObject, callback?: () => void) => Promise<void>;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
export declare function useBackground(callback: LifecycleCallback): void;
|
|
705
|
+
|
|
706
|
+
export { useCallback }
|
|
707
|
+
|
|
708
|
+
export { useContext }
|
|
709
|
+
|
|
710
|
+
export declare function useCreated(callback: LifecycleCallback): void;
|
|
711
|
+
|
|
712
|
+
export { useDebugValue }
|
|
713
|
+
|
|
714
|
+
export declare function useDestroy(callback: LifecycleCallback): void;
|
|
715
|
+
|
|
716
|
+
export { useEffect }
|
|
717
|
+
|
|
718
|
+
export declare function useError(callback: LifecycleErrorCallback): void;
|
|
719
|
+
|
|
720
|
+
export declare function useForeground(callback: LifecycleCallback): void;
|
|
721
|
+
|
|
722
|
+
export declare function useHide(callback: LifecycleCallback): void;
|
|
723
|
+
|
|
724
|
+
export { useImperativeHandle }
|
|
725
|
+
|
|
726
|
+
export { useMemo }
|
|
727
|
+
|
|
728
|
+
export declare function useMounted(callback: LifecycleCallback): void;
|
|
729
|
+
|
|
730
|
+
export { useReducer }
|
|
731
|
+
|
|
732
|
+
export { useRef }
|
|
733
|
+
|
|
734
|
+
export declare function useShow(callback: LifecycleCallback): void;
|
|
735
|
+
|
|
736
|
+
export { useState }
|
|
737
|
+
|
|
738
|
+
export { useSyncExternalStore }
|
|
739
|
+
|
|
740
|
+
export declare function useViewData<T extends Record<string, any> = Record<string, any>>(): T;
|
|
741
|
+
|
|
742
|
+
export { VFC }
|
|
743
|
+
|
|
744
|
+
export { VoidFunctionComponent }
|
|
745
|
+
|
|
746
|
+
export declare interface Widget<Data extends AnyObject = AnyObject> extends DefineWidgetToolOptions<Data> {
|
|
747
|
+
__UI__: boolean;
|
|
748
|
+
__WIDGET__: boolean;
|
|
749
|
+
setData: (data: Partial<Data>, callback?: () => void) => void;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
declare type WidgetInstanceMethods<Data extends AnyObject> = UIInstanceMethods<Data, WidgetToolExtraMetadata>;
|
|
753
|
+
|
|
754
|
+
declare type WidgetToolExtraMetadata = {
|
|
755
|
+
/**
|
|
756
|
+
* Widget box type in Chat UI
|
|
757
|
+
*/
|
|
758
|
+
boxType?: 'inbox' | 'full_box';
|
|
759
|
+
/**
|
|
760
|
+
* Whether add widget border
|
|
761
|
+
*/
|
|
762
|
+
border?: boolean;
|
|
763
|
+
/**
|
|
764
|
+
* Keywords of things
|
|
765
|
+
*/
|
|
766
|
+
keywords?: string[];
|
|
767
|
+
/**
|
|
768
|
+
* Icons
|
|
769
|
+
*/
|
|
770
|
+
icons?: Icons;
|
|
771
|
+
/**
|
|
772
|
+
* Set extra widget properties
|
|
773
|
+
*/
|
|
774
|
+
prop?: string;
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
export declare type WidgetToolMetadata = ToolMeta & WidgetToolExtraMetadata;
|
|
778
|
+
|
|
779
|
+
export { }
|