@spcsn/taro 0.1.0

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 (140) hide show
  1. package/README.md +12 -0
  2. package/dist/index.js +147 -0
  3. package/dist/index.js.map +1 -0
  4. package/index.js +9 -0
  5. package/package.json +86 -0
  6. package/types/api/ad/index.d.ts +197 -0
  7. package/types/api/ai/face.d.ts +133 -0
  8. package/types/api/ai/inference.d.ts +129 -0
  9. package/types/api/ai/visionkit.d.ts +874 -0
  10. package/types/api/alipay/index.d.ts +69 -0
  11. package/types/api/base/crypto.d.ts +104 -0
  12. package/types/api/base/debug.d.ts +329 -0
  13. package/types/api/base/env.d.ts +19 -0
  14. package/types/api/base/index.d.ts +102 -0
  15. package/types/api/base/performance.d.ts +258 -0
  16. package/types/api/base/system.d.ts +742 -0
  17. package/types/api/base/update.d.ts +130 -0
  18. package/types/api/base/weapp/app-event.d.ts +265 -0
  19. package/types/api/base/weapp/life-cycle.d.ts +155 -0
  20. package/types/api/canvas/index.d.ts +2162 -0
  21. package/types/api/cloud/index.d.ts +2622 -0
  22. package/types/api/data-analysis/index.d.ts +122 -0
  23. package/types/api/device/accelerometer.d.ts +102 -0
  24. package/types/api/device/accessibility.d.ts +26 -0
  25. package/types/api/device/battery.d.ts +46 -0
  26. package/types/api/device/bluetooth-ble.d.ts +601 -0
  27. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  28. package/types/api/device/bluetooth.d.ts +463 -0
  29. package/types/api/device/calendar.d.ts +98 -0
  30. package/types/api/device/clipboard.d.ts +81 -0
  31. package/types/api/device/compass.d.ts +105 -0
  32. package/types/api/device/contact.d.ts +110 -0
  33. package/types/api/device/gyroscope.d.ts +85 -0
  34. package/types/api/device/iBeacon.d.ts +168 -0
  35. package/types/api/device/keyboard.d.ts +97 -0
  36. package/types/api/device/memory.d.ts +52 -0
  37. package/types/api/device/motion.d.ts +88 -0
  38. package/types/api/device/network.d.ts +172 -0
  39. package/types/api/device/nfc.d.ts +1238 -0
  40. package/types/api/device/phone.d.ts +30 -0
  41. package/types/api/device/scan.d.ts +111 -0
  42. package/types/api/device/screen.d.ts +217 -0
  43. package/types/api/device/sms.d.ts +26 -0
  44. package/types/api/device/vibrate.d.ts +51 -0
  45. package/types/api/device/wifi.d.ts +301 -0
  46. package/types/api/ext/index.d.ts +64 -0
  47. package/types/api/files/index.d.ts +1472 -0
  48. package/types/api/framework/index.d.ts +51 -0
  49. package/types/api/location/index.d.ts +517 -0
  50. package/types/api/media/audio.d.ts +1013 -0
  51. package/types/api/media/background-audio.d.ts +291 -0
  52. package/types/api/media/camera.d.ts +207 -0
  53. package/types/api/media/editor.d.ts +239 -0
  54. package/types/api/media/image.d.ts +469 -0
  55. package/types/api/media/live.d.ts +461 -0
  56. package/types/api/media/map.d.ts +638 -0
  57. package/types/api/media/media-recorder.d.ts +117 -0
  58. package/types/api/media/recorder.d.ts +317 -0
  59. package/types/api/media/video-decoder.d.ts +117 -0
  60. package/types/api/media/video-processing.d.ts +84 -0
  61. package/types/api/media/video.d.ts +527 -0
  62. package/types/api/media/voip.d.ts +393 -0
  63. package/types/api/navigate/index.d.ts +327 -0
  64. package/types/api/network/download.d.ts +173 -0
  65. package/types/api/network/mdns.d.ts +191 -0
  66. package/types/api/network/request.d.ts +480 -0
  67. package/types/api/network/tcp.d.ts +181 -0
  68. package/types/api/network/udp.d.ts +218 -0
  69. package/types/api/network/upload.d.ts +201 -0
  70. package/types/api/network/websocket.d.ts +383 -0
  71. package/types/api/open-api/account.d.ts +51 -0
  72. package/types/api/open-api/address.d.ts +68 -0
  73. package/types/api/open-api/authorize.d.ts +80 -0
  74. package/types/api/open-api/card.d.ts +110 -0
  75. package/types/api/open-api/channels.d.ts +225 -0
  76. package/types/api/open-api/customer-service.d.ts +45 -0
  77. package/types/api/open-api/device-voip.d.ts +103 -0
  78. package/types/api/open-api/facial.d.ts +98 -0
  79. package/types/api/open-api/favorites.d.ts +101 -0
  80. package/types/api/open-api/group.d.ts +59 -0
  81. package/types/api/open-api/invoice.d.ts +87 -0
  82. package/types/api/open-api/license-plate.d.ts +27 -0
  83. package/types/api/open-api/login.d.ts +115 -0
  84. package/types/api/open-api/my-miniprogram.d.ts +28 -0
  85. package/types/api/open-api/privacy.d.ts +107 -0
  86. package/types/api/open-api/redpackage.d.ts +24 -0
  87. package/types/api/open-api/settings.d.ts +174 -0
  88. package/types/api/open-api/soter.d.ts +184 -0
  89. package/types/api/open-api/sticker.d.ts +83 -0
  90. package/types/api/open-api/subscribe-message.d.ts +305 -0
  91. package/types/api/open-api/user-info.d.ts +182 -0
  92. package/types/api/open-api/werun.d.ts +101 -0
  93. package/types/api/payment/index.d.ts +119 -0
  94. package/types/api/qq/index.d.ts +354 -0
  95. package/types/api/route/index.d.ts +324 -0
  96. package/types/api/share/index.d.ts +354 -0
  97. package/types/api/skyline/index.d.ts +345 -0
  98. package/types/api/storage/background-fetch.d.ts +131 -0
  99. package/types/api/storage/cache-manager.d.ts +249 -0
  100. package/types/api/storage/index.d.ts +405 -0
  101. package/types/api/swan/bookshelf.d.ts +307 -0
  102. package/types/api/swan/download-package.d.ts +80 -0
  103. package/types/api/swan/index.d.ts +251 -0
  104. package/types/api/swan/pay.d.ts +139 -0
  105. package/types/api/taro.extend.d.ts +233 -0
  106. package/types/api/taro.hooks.d.ts +148 -0
  107. package/types/api/ui/animation.d.ts +427 -0
  108. package/types/api/ui/background.d.ts +69 -0
  109. package/types/api/ui/custom-component.d.ts +23 -0
  110. package/types/api/ui/fonts.d.ts +77 -0
  111. package/types/api/ui/interaction.d.ts +281 -0
  112. package/types/api/ui/menu.d.ts +29 -0
  113. package/types/api/ui/navigation-bar.d.ts +130 -0
  114. package/types/api/ui/pull-down-refresh.d.ts +50 -0
  115. package/types/api/ui/scroll.d.ts +114 -0
  116. package/types/api/ui/sticky.d.ts +32 -0
  117. package/types/api/ui/tab-bar.d.ts +196 -0
  118. package/types/api/ui/window.d.ts +71 -0
  119. package/types/api/worker/index.d.ts +83 -0
  120. package/types/api/wxml/index.d.ts +540 -0
  121. package/types/compile/compiler.d.ts +32 -0
  122. package/types/compile/config/h5.d.ts +134 -0
  123. package/types/compile/config/harmony.d.ts +118 -0
  124. package/types/compile/config/index.d.ts +8 -0
  125. package/types/compile/config/manifest.d.ts +155 -0
  126. package/types/compile/config/mini.d.ts +118 -0
  127. package/types/compile/config/plugin.d.ts +34 -0
  128. package/types/compile/config/project.d.ts +338 -0
  129. package/types/compile/config/rn.d.ts +85 -0
  130. package/types/compile/config/util.d.ts +179 -0
  131. package/types/compile/hooks.d.ts +13 -0
  132. package/types/compile/index.d.ts +11 -0
  133. package/types/compile/viteCompilerContext.d.ts +167 -0
  134. package/types/global.d.ts +428 -0
  135. package/types/index.d.ts +190 -0
  136. package/types/taro.api.d.ts +130 -0
  137. package/types/taro.component.d.ts +168 -0
  138. package/types/taro.config.d.ts +712 -0
  139. package/types/taro.lifecycle.d.ts +220 -0
  140. package/types/taro.runtime.d.ts +9 -0
@@ -0,0 +1,307 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace insertBookshelf {
5
+ interface Option {
6
+ /** 添加的内容分类 */
7
+ category: keyof Category | string
8
+ /** 要添加到书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
9
+ contentIds: string[]
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: SuccessCallbackResult) => void
16
+ }
17
+ interface Category {
18
+ /** 专栏模板 */
19
+ article
20
+ /** 文档模板 */
21
+ doc
22
+ /** 动漫模板 */
23
+ cartoon
24
+ /** 影音模板 */
25
+ av
26
+ }
27
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
28
+ /** 添加到书架的结果列表 */
29
+ list: IListItem[]
30
+ }
31
+ interface IListItem {
32
+ /** 内容的唯一标识 */
33
+ contentId: string
34
+ /** 添加状态:值为 0 时是失败,为 1 时是成功 */
35
+ status: keyof Status
36
+ /** 添加信息 */
37
+ msg: string
38
+ }
39
+ interface Status {
40
+ /** 失败 */
41
+ 0
42
+ /** 成功 */
43
+ 1
44
+ }
45
+ }
46
+
47
+ namespace deleteBookshelf {
48
+ interface Option {
49
+ /** 要删除的内容分类 */
50
+ category: keyof Category | string
51
+ /** 要删除书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符)。支持批量删除的同一个 category 下的多个 id,不同 category 下的 id 请分别调用该接口删除 */
52
+ contentIds: string[]
53
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
54
+ complete?: (res: TaroGeneral.CallbackResult) => void
55
+ /** 接口调用失败的回调函数 */
56
+ fail?: (res: TaroGeneral.CallbackResult) => void
57
+ /** 接口调用成功的回调函数 */
58
+ success?: (res: SuccessCallbackResult) => void
59
+ }
60
+ interface Category {
61
+ /** 专栏模板 */
62
+ article
63
+ /** 文档模板 */
64
+ doc
65
+ /** 动漫模板 */
66
+ cartoon
67
+ /** 影音模板 */
68
+ av
69
+ }
70
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
71
+ /** 添加到书架的结果列表 */
72
+ list: IListItem[]
73
+ }
74
+ interface IListItem {
75
+ /** 内容的唯一标识 */
76
+ contentId: string
77
+ /** 删除状态:值为 0 时是失败,为 1 时是成功 */
78
+ status: keyof Status
79
+ /** 删除信息 */
80
+ msg: string
81
+ }
82
+ interface Status {
83
+ /** 失败 */
84
+ 0
85
+ /** 成功 */
86
+ 1
87
+ }
88
+ }
89
+
90
+ namespace queryBookshelf {
91
+ interface Option {
92
+ /** 要查询内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
93
+ contentIds: string[]
94
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
95
+ complete?: (res: TaroGeneral.CallbackResult) => void
96
+ /** 接口调用失败的回调函数 */
97
+ fail?: (res: TaroGeneral.CallbackResult) => void
98
+ /** 接口调用成功的回调函数 */
99
+ success?: (res: TaroGeneral.CallbackResult) => void
100
+ }
101
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
102
+ /** 查询的内容结果列表 */
103
+ list: IListItem[]
104
+ }
105
+ interface IListItem {
106
+ /** 内容的唯一标识 */
107
+ contentId: string
108
+ /** 状态 */
109
+ status: keyof Status
110
+ }
111
+ interface Status {
112
+ /** 不存在 */
113
+ 0
114
+ /** 存在 */
115
+ 1
116
+ }
117
+ }
118
+
119
+ namespace updateBookshelfReadTime {
120
+ interface Option {
121
+ /** 添加的内容分类 */
122
+ category: keyof Category | string
123
+ /** 要更新内容的 id;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
124
+ contentIds: string[]
125
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
126
+ complete?: (res: TaroGeneral.CallbackResult) => void
127
+ /** 接口调用失败的回调函数 */
128
+ fail?: (res: TaroGeneral.CallbackResult) => void
129
+ /** 接口调用成功的回调函数 */
130
+ success?: (res: SuccessCallbackResult) => void
131
+ }
132
+ interface Category {
133
+ /** 专栏模板 */
134
+ article
135
+ /** 文档模板 */
136
+ doc
137
+ /** 动漫模板 */
138
+ cartoon
139
+ /** 影音模板 */
140
+ av
141
+ }
142
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
143
+ /** 更新状态 */
144
+ status: keyof Status
145
+ /** 更新的结果信息 */
146
+ msg: string
147
+ }
148
+ interface Status {
149
+ /** 失败 */
150
+ 0
151
+ /** 成功 */
152
+ 1
153
+ }
154
+ }
155
+
156
+ namespace navigateToBookshelf {
157
+ interface Option {
158
+ /** 跳转到指定的内容分类
159
+ * @supported swan
160
+ */
161
+ category: keyof Category | string
162
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
163
+ complete?: (res: TaroGeneral.CallbackResult) => void
164
+ /** 接口调用失败的回调函数 */
165
+ fail?: (res: TaroGeneral.CallbackResult) => void
166
+ /** 接口调用成功的回调函数 */
167
+ success?: (res: TaroGeneral.CallbackResult) => void
168
+ }
169
+ interface Category {
170
+ /** 专栏模板 */
171
+ article
172
+ /** 文档模板 */
173
+ doc
174
+ /** 动漫模板 */
175
+ cartoon
176
+ /** 影音模板 */
177
+ av
178
+ }
179
+ }
180
+
181
+ interface TaroStatic {
182
+ /** 添加内容到宿主书架
183
+ * @supported swan, qq
184
+ * @swan (需宿主支持书架入口)
185
+ * @example
186
+ * ```tsx
187
+ * Taro.insertBookshelf({
188
+ * category: 'doc',
189
+ * contentIds: ['test1', 'test2'],
190
+ * success(res) {
191
+ * Taro.showModal({
192
+ * title: 'success',
193
+ * content: JSON.stringify(res)
194
+ * })
195
+ * },
196
+ * fail(err) {
197
+ * Taro.showModal({
198
+ * title: 'fail',
199
+ * content: JSON.stringify(err)
200
+ * })
201
+ * }
202
+ * })
203
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-insertBookshelf/
204
+ */
205
+ insertBookshelf(option: insertBookshelf.Option): void
206
+
207
+ /** 删除书架中的内容(需宿主支持书架入口)
208
+ * @supported swan
209
+ * @example
210
+ * ```tsx
211
+ * Taro.deleteBookshelf({
212
+ * category: 'doc',
213
+ * contentIds: ['test1', 'test2'],
214
+ * success(res) {
215
+ * Taro.showModal({
216
+ * title: 'success',
217
+ * content: JSON.stringify(res)
218
+ * })
219
+ * },
220
+ * fail(err) {
221
+ * Taro.showModal({
222
+ * title: 'fail',
223
+ * content: JSON.stringify(err)
224
+ * })
225
+ * }
226
+ * })
227
+ * ```
228
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-deleteBookshelf/
229
+ */
230
+ deleteBookshelf(option: deleteBookshelf.Option): void
231
+
232
+ /** 查询宿主书架的相关内容
233
+ * @supported swan, qq
234
+ * @swan (需宿主支持书架入口)
235
+ * @example
236
+ * ```tsx
237
+ * Taro.queryBookshelf({
238
+ * contentIds: ['test1', 'test2'],
239
+ * success(res) {
240
+ * Taro.showModal({
241
+ * title: 'success',
242
+ * content: JSON.stringify(res)
243
+ * })
244
+ * },
245
+ * fail(err) {
246
+ * Taro.showModal({
247
+ * title: 'fail',
248
+ * content: JSON.stringify(err)
249
+ * })
250
+ * }
251
+ * })
252
+ * ```
253
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
254
+ */
255
+ queryBookshelf(option: queryBookshelf.Option): void
256
+
257
+ /** 更新已加入宿主书架的内容的阅读时间
258
+ * @supported swan, qq
259
+ * @swan (需宿主支持书架入口)
260
+ * @example
261
+ * ```tsx
262
+ * Taro.updateBookshelfReadTime({
263
+ * category: 'doc',
264
+ * contentIds: 'test1',
265
+ * success(res) {
266
+ * Taro.showModal({
267
+ * title: 'success',
268
+ * content: JSON.stringify(res)
269
+ * })
270
+ * },
271
+ * fail(err) {
272
+ * Taro.showModal({
273
+ * title: 'fail',
274
+ * content: JSON.stringify(err)
275
+ * })
276
+ * }
277
+ * })
278
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
279
+ */
280
+ updateBookshelfReadTime(option: updateBookshelfReadTime.Option): void
281
+
282
+ /** 跳转到宿主书架
283
+ * @supported swan
284
+ * @swan (需宿主支持书架入口)
285
+ * @example
286
+ * ```tsx
287
+ * Taro.navigateToBookshelf({
288
+ * category: 'article',
289
+ * contentIds: 'test1',
290
+ * success(res) {
291
+ * Taro.showModal({
292
+ * title: 'navigateToBookshelf',
293
+ * content: 'success'
294
+ * })
295
+ * },
296
+ * fail(err) {
297
+ * Taro.showModal({
298
+ * title: 'fail',
299
+ * content: JSON.stringify(err)
300
+ * })
301
+ * }
302
+ * })
303
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-navigateToBookshelf/
304
+ */
305
+ navigateToBookshelf(option: navigateToBookshelf.Option): void
306
+ }
307
+ }
@@ -0,0 +1,80 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace downloadPackage {
5
+ interface Option {
6
+ /** 预下载的小程序的 appKey */
7
+ appKey: string
8
+ /** 预下载的小程序的 pageUrl ,默认值为小程序的首页页面 */
9
+ pageUrl?: string
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (res: TaroGeneral.CallbackResult) => any
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (err: TaroGeneral.CallbackResult) => any
14
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
15
+ complete?: (res: TaroGeneral.CallbackResult) => any
16
+ }
17
+ }
18
+
19
+ namespace downloadPackages {
20
+ interface Option {
21
+ /** 预下载的小程序的列表。 */
22
+ pageList: IPageItem[]
23
+ /** 接口调用成功的回调函数 */
24
+ success?: (res: SuccessCallbackResult) => any
25
+ /** 接口调用失败的回调函数 */
26
+ fail?: (err: TaroGeneral.CallbackResult) => any
27
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
28
+ complete?: (res: TaroGeneral.CallbackResult) => any
29
+ }
30
+ interface IPageItem {
31
+ /** 预下载的小程序的 appKey */
32
+ appKey: string
33
+ /** 页面路径 */
34
+ pages: string[]
35
+ }
36
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
37
+ /** 小程序包预下载结果回调 */
38
+ [key: string]: IAppKeyResult[]
39
+ }
40
+ interface IAppKeyResult {
41
+ /** 页面路径 */
42
+ pageUrl: string
43
+ /** 预下载能力调用结果。值为 "0" 时是成功,非 "0" 时是失败 */
44
+ status: string
45
+ /** 预下载结果信息 */
46
+ message: string
47
+ }
48
+ }
49
+
50
+ namespace loadSubPackage {
51
+ interface Option {
52
+ /** 接口调用成功的回调函数 */
53
+ success?: (res: TaroGeneral.CallbackResult) => any
54
+ /** 接口调用失败的回调函数 */
55
+ fail?: (err: TaroGeneral.CallbackResult) => any
56
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
57
+ complete?: (res: TaroGeneral.CallbackResult) => any
58
+ }
59
+ }
60
+
61
+ interface TaroStatic {
62
+ /** 针对在小程序中调用其他小程序的场景,预下载其他小程序的包内容。
63
+ * Web 态说明:Web 态不支持预下载的能力。
64
+ * @supported swan
65
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-downloadPackage/
66
+ */
67
+ downloadPackage(option: downloadPackage.Option): void
68
+ /** 针对在小程序中调用其他小程序的场景,预下载其他小程序的包内容。
69
+ * Web 态说明:Web 态不支持预下载的能力。
70
+ * @supported swan
71
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-downloadPackages/
72
+ */
73
+ downloadPackages(option: downloadPackages.Option): void
74
+ /** 提前下载好子包的资源,目录结构配置参考[分包加载](https://smartprogram.baidu.com/docs/develop/framework/subpackages/)。
75
+ * @supported swan
76
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-loadSubPackage/
77
+ */
78
+ loadSubPackage(option: loadSubPackage.Option): void
79
+ }
80
+ }
@@ -0,0 +1,251 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace setPageInfo {
5
+ interface Option {
6
+ /** 页面标题 */
7
+ title: string
8
+ /** 页面关键字 */
9
+ keywords: string
10
+ /** 页面描述信息 */
11
+ description: string
12
+ /** 原始发布时间(年-月-日 时:分:秒 带有前导零) */
13
+ releaseDate?: string
14
+ /** 文章(内容)标题(适用于当前页面是图文、视频类的展示形式,文章标题需要准确标识当前文章的主要信息点;至少6个字,不可以全英文。) */
15
+ articleTitle?: string
16
+ /** 图片线上地址,用于信息流投放后的封面显示,最多3张,单图片最大2M;封面图建议尺寸:高>=210px & 宽>=375px;最小尺寸:高>=146px & 宽>=218px。多张图时,用数组表示 */
17
+ image?: string | Array<string>
18
+ /** 视频信息,多个视频时,用数组表示 */
19
+ video?: Video
20
+ /** 浏览信息 */
21
+ visit?: Visit
22
+ /** 点赞量,若页面未统计可为空 */
23
+ likes?: string
24
+ /** 评论量,若页面未统计可为空 */
25
+ comments?: string
26
+ /** 收藏量,若页面未统计可为空 */
27
+ collects?: string
28
+ /** 分享量,若页面未统计可为空 */
29
+ shares?: string
30
+ /** 关注量,若页面未统计可为空 */
31
+ followers?: string
32
+ /** 接口调用成功的回调函数 */
33
+ success?: () => any
34
+ /** 接口调用失败的回调函数 */
35
+ fail?: (err: any) => any
36
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
37
+ complete?: () => any
38
+ }
39
+ type Video = {
40
+ /** 视频地址 */
41
+ url: string
42
+ /** 视频时长(单位为秒) */
43
+ duration: string
44
+ /** 视频封面图 */
45
+ image: string
46
+ }
47
+ type Visit = {
48
+ /** 页面的浏览量(不去重用户) */
49
+ pv?: string
50
+ /** 页面的点击量(去重用户) */
51
+ uv?: string
52
+ /** 页面的用户人均停留时长,以秒为单位。 */
53
+ sessionDuration?: string
54
+ }
55
+ }
56
+
57
+ namespace setMetaDescription {
58
+ interface Option {
59
+ /** 需要设置的 description 内容 */
60
+ content: string
61
+ /** 接口调用成功的回调函数 */
62
+ success?: (res: any) => any
63
+ /** 接口调用失败的回调函数 */
64
+ fail?: (err: any) => any
65
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
66
+ complete?: (res: any) => any
67
+ }
68
+ }
69
+
70
+ namespace setMetaKeywords {
71
+ interface Option {
72
+ /** 需要设置的 keywords 内容 */
73
+ content: string
74
+ /** 接口调用成功的回调函数 */
75
+ success?: (res: any) => any
76
+ /** 接口调用失败的回调函数 */
77
+ fail?: (err: any) => any
78
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
79
+ complete?: (res: any) => any
80
+ }
81
+ }
82
+
83
+ namespace setDocumentTitle {
84
+ interface Option {
85
+ /** 页面中 title 标签中的内容 */
86
+ title: string
87
+ /** 接口调用成功的回调函数 */
88
+ success?: (res: any) => any
89
+ /** 接口调用失败的回调函数 */
90
+ fail?: (err: any) => any
91
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
92
+ complete?: (res: any) => any
93
+ }
94
+ }
95
+
96
+ namespace getSystemRiskInfo {
97
+ interface Option {
98
+ /** 接口调用成功的回调函数 */
99
+ success?: (res: SuccessCallbackResult) => any
100
+ /** 接口调用失败的回调函数 */
101
+ fail?: (err: any) => any
102
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
103
+ complete?: (res: any) => any
104
+ }
105
+ interface SuccessCallbackResult {
106
+ /** 用于获取风控信息的加密信息对象。
107
+ * 要获取风控信息,需要和[风控检测](https://smartprogram.baidu.com/docs/develop/serverapi/open_risk_power/#detectrisk/)接口联合使用,并作为风控检测接口的 xtoken 参数传入。
108
+ */
109
+ content: Object
110
+ }
111
+ interface IContent {
112
+ key: string
113
+ value: string
114
+ }
115
+ }
116
+
117
+ namespace getFavorStatus {
118
+ interface Option {
119
+ /** 接口调用成功的回调函数 */
120
+ success?: (res: SuccessCallbackResult) => any
121
+ /** 接口调用失败的回调函数 */
122
+ fail?: (err: any) => any
123
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
124
+ complete?: (res: any) => any
125
+ }
126
+ interface SuccessCallbackResult {
127
+ /** 用户关注关注状态,1表示已关注,0表示未关注 */
128
+ isFavor: string
129
+ }
130
+ }
131
+
132
+ namespace getTopStatus {
133
+ interface Option {
134
+ /** 接口调用成功的回调函数 */
135
+ success?: (res: SuccessCallbackResult) => any
136
+ /** 接口调用失败的回调函数 */
137
+ fail?: (err: any) => any
138
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
139
+ complete?: (res: any) => any
140
+ }
141
+ interface SuccessCallbackResult {
142
+ /** 置顶状态 */
143
+ isTop: boolean
144
+ }
145
+ }
146
+
147
+ namespace openBdboxWebview {
148
+ interface Option {
149
+ /** 跳转百度 App 特定页面的 scheme 的 module */
150
+ module?: string
151
+ /** 跳转百度 App 特定页面的 scheme 的 action */
152
+ action?: string
153
+ /** 跳转百度 App 特定页面的 scheme 的 path */
154
+ path?: string
155
+ /** 跳转百度 App 特定页面的 scheme 的 authority */
156
+ authority?: string
157
+ /** 跳转百度 App 特定页面的 scheme 的参数 */
158
+ parameters?: Object
159
+ /** 接口调用成功的回调函数 */
160
+ success?: (res: any) => any
161
+ /** 接口调用失败的回调函数 */
162
+ fail?: (err: any) => any
163
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
164
+ complete?: (res: any) => any
165
+ }
166
+ }
167
+ interface TaroStatic {
168
+ /**
169
+ * 百度智能小程序可接入百度搜索和百度 App,setPageInfo 负责为小程序设置各类页面基础信息,包括标题、关键字、页面描述以及图片信息、视频信息等。开发者为智能小程序设置完备的页面基础信息,有助于智能小程序在搜索引擎和信息流中得到更加有效的展示和分发。
170
+ * @supported swan
171
+ * @example
172
+ * ```tsx
173
+ * Taro.setPageInfo({
174
+ * title: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!-百度贴吧',
175
+ * keywords: '百度,百度贴吧,好运中国年,60,晒元,宵节',
176
+ * description: '晒元宵节活动红包,爱..昨天的百度APP元宵节活动中,共发出2亿现金红包、含151万个手气现金大奖和240辆红旗轿车,谁是好运锦鲤,快来分享!马上惊喜升级~摇中红包的锦鲤们即刻晒出红包金额截图,我们将会抽取660位好运锦鲤',
177
+ * articleTitle: '晒元宵节活动红包,爱奇艺60张年卡、600张季卡等你拿!',
178
+ * releaseDate: '2019-01-02 12:01:30',
179
+ * image: [
180
+ * 'https://c.hiphotos.baidu.com/forum/w%3D480/sign=73c62dda83b1cb133e693d1bed5456da/f33725109313b07e8dee163d02d7912396dd8cfe.jpg',
181
+ * 'https://hiphotos.baidu.com/fex/%70%69%63/item/43a7d933c895d143e7b745607ef082025baf07ab.jpg'
182
+ * ],
183
+ * video: [{
184
+ * url: 'https://www.baidu.com/mx/v12.mp4',
185
+ * duration: '100',
186
+ * image: 'https://smartprogram.baidu.com/docs/img/image-scaleToFill.png'
187
+ * }],
188
+ * visit: {
189
+ * pv: '1000',
190
+ * uv: '100',
191
+ * sessionDuration: '130'
192
+ * },
193
+ * likes: '75',
194
+ * comments: '13',
195
+ * collects: '23',
196
+ * shares: '8',
197
+ * followers: '35',
198
+ * success: res => {
199
+ * console.log('setPageInfo success');
200
+ * },
201
+ * fail: err => {
202
+ * console.log('setPageInfo fail', err);
203
+ * }
204
+ * })
205
+ * ```
206
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setPageInfo/
207
+ */
208
+ setPageInfo(option: setPageInfo.Option): void
209
+ /** 设置 web 版小程序 description meta 信息。此方法为 web 版小程序专用方法,使用前需判断方法是否存在。
210
+ * @supported swan
211
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setMetaDescription/
212
+ */
213
+ setMetaDescription(option: setMetaDescription.Option): void
214
+ /** 设置 web 版小程序 keywords meta 信息。此方法为 web 版小程序专用方法,使用前需判断方法是否存在。
215
+ * @supported swan
216
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setMetaKeywords/
217
+ */
218
+ setMetaKeywords(option: setMetaKeywords.Option): void
219
+ /** 动态设置当前页面的标题。此方法为 web 版小程序专用方法,使用前需判断方法是否存在。
220
+ * @supported swan
221
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-setDocumentTitle/
222
+ */
223
+ setDocumentTitle(option: setDocumentTitle.Option): void
224
+ /** 获取用于得到风控信息的加密信息对象。更多小程序风控能力参见[风控服务](https://smartprogram.baidu.com/docs/develop/serverapi/open_risk_power/)。
225
+ * Web 态说明:Web 态小程序暂不支持获取用于得到风控信息的加密信息对象。
226
+ * @supported swan
227
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-getSystemRiskInfo/
228
+ */
229
+ getSystemRiskInfo(option: getSystemRiskInfo.Option): void
230
+ /** 获取小程序用户关注状态。
231
+ * Web 态说明:Web 态小程序暂不支持关注小程序。
232
+ * @supported swan
233
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-getFavorStatus/
234
+ */
235
+ getFavorStatus(option: getFavorStatus.Option): void
236
+ /** 获取小程序用户置顶状态。
237
+ * Web 态说明:Web 态小程序暂不支持获取置顶状态,降级调起百度 App。
238
+ * @supported swan
239
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-getTopStatus/
240
+ */
241
+ getTopStatus(option: getTopStatus.Option): void
242
+ /** 小程序跳转百度 App 内特定页面。接入本 API 的开发者,需要了解跳转页面的 scheme,并根据文档调用 API 完成跳转。可在百度 App 中,通过将跳转页面 scheme 生成对应二维码,并使用百度 APP 相机扫描二维码调起的方式,来确保 scheme 是否正确。
243
+ * Web 态说明:
244
+ * 1.由于浏览器的限制,Web 态暂时无法准确获取跳转百度 App 成功 / 失败状态,会执行失败回调;
245
+ * 2.在用户未安装手百、部分第三方浏览器封禁百度 App 的情况下,Web 态会尝试降级调起应用商店。
246
+ * @supported swan
247
+ * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-openBdboxWebview/
248
+ */
249
+ openBdboxWebview(option: openBdboxWebview.Option): void
250
+ }
251
+ }