commit c6557a6b4dfe156ded9123255b0058695e677167 Author: lipenggao Date: Mon May 20 09:36:39 2024 +0800 初次提交 diff --git a/app.json b/app.json new file mode 100644 index 0000000..e2ea4bd --- /dev/null +++ b/app.json @@ -0,0 +1,51 @@ +{ + "pages": [ + "pages/home/home", + "pages/my/my", + "pages/theater/theater", + "pages/recommend/recommend", + "pages/search/search", + "pages/leaderboard/leaderboard", + "pages/subscribe/subscribe", + "pages/consumption/consumption", + "pages/rechargeRecord/rechargeRecord", + "pages/videoDetail/videoDetail" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#080B16", + "navigationBarTitleText": "初晴剧场", + "navigationBarTextStyle": "white" + }, + "tabBar": { + "color": "#999999", + "selectedColor": "#5BBE04", + "backgroundColor": "#000000", + "list": [ + { + "pagePath": "pages/home/home", + "iconPath": "/static/tab/home.png", + "selectedIconPath": "/static/tab/home_selected.png", + "text": "首页" + }, + { + "pagePath": "pages/recommend/recommend", + "iconPath": "/static/tab/recommend.png", + "selectedIconPath": "/static/tab/recommend_selected.png", + "text": "推荐" + }, + { + "pagePath": "pages/theater/theater", + "iconPath": "/static/tab/theater.png", + "selectedIconPath": "/static/tab/theater_selected.png", + "text": "剧场" + }, + { + "pagePath": "pages/my/my", + "iconPath": "/static/tab/my.png", + "selectedIconPath": "/static/tab/my_selected.png", + "text": "我的" + } + ] + } +} \ No newline at end of file diff --git a/app.ts b/app.ts new file mode 100644 index 0000000..4778f28 --- /dev/null +++ b/app.ts @@ -0,0 +1,10 @@ +import { httpRequest } from "./utils/httpReques" + +App({ + data: { + httpRequest + }, + onLaunch: function () { + + } +}) diff --git a/app.ttss b/app.ttss new file mode 100644 index 0000000..a35232e --- /dev/null +++ b/app.ttss @@ -0,0 +1,32 @@ +view { + box-sizing: border-box; +} + +.__wa_img_no_radius { + display: block; + width: 100%; + height: 100%; +} + +page { + background-color: #080B16; +} + +.pb_80 { + padding-bottom: 80rpx; +} + +/* ._m_modal_html { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: 100%; + height: 100%; + z-index: 99; +} */ + +.mt_36 { + margin-top: 36rpx; +} \ No newline at end of file diff --git a/components/myModal/myModal.json b/components/myModal/myModal.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/myModal/myModal.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/myModal/myModal.ts b/components/myModal/myModal.ts new file mode 100644 index 0000000..b7dcae6 --- /dev/null +++ b/components/myModal/myModal.ts @@ -0,0 +1,40 @@ +// e:\project\dy_video_all\初晴剧场\components\myModal\myModal.ts +Component({ + data: { + maskFlag: false + }, + properties: { + cancelText: { + type: String, + value: '取消' + }, + confirmText: { + type: String, + value: '确定' + }, + contentText: { + type: String, + value: '' + }, + }, + methods: { + show() { + this.setData({ + maskFlag: true + }) + }, + hide() { + this.setData({ + maskFlag: false + }) + }, + handelCancel() { + this.triggerEvent('handelCancel', { cancel: true, confirm: false }); + this.hide(); + }, + handelConfirm() { + this.triggerEvent('handelConfirm', { cancel: false, confirm: true }); + this.hide(); + } + } +}) \ No newline at end of file diff --git a/components/myModal/myModal.ttml b/components/myModal/myModal.ttml new file mode 100644 index 0000000..1791cc0 --- /dev/null +++ b/components/myModal/myModal.ttml @@ -0,0 +1,21 @@ + + + + + + + {{contentText}} + + + + + {{cancelText}} + + + {{confirmText}} + + + + + + \ No newline at end of file diff --git a/components/myModal/myModal.ttss b/components/myModal/myModal.ttss new file mode 100644 index 0000000..d1bb5bb --- /dev/null +++ b/components/myModal/myModal.ttss @@ -0,0 +1,92 @@ +/* e:\project\dy_video_all\初晴剧场\components\myModal\myModal.ttss */ + +._m_modal_html { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: 100%; + height: 100%; + z-index: 99; +} + +._m_m_mask { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + /* display: flex; + justify-content: center; + align-items: center; */ + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.6); + +} + +._m_m_m_content { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + padding: 0 72rpx; + transform: translate(-50%, -50%); +} + +._m_m_m_co_warp { + width: 100%; + padding: 40rpx 52rpx; + background-color: #272A30; + border-radius: 16rpx; +} + +._m_m_m_c_header { + display: flex; + justify-content: center; + width: 100%; + margin-bottom: 40rpx; +} + +._m_m_m_c_h_tips { + line-height: 1.5; +} + +._m_m_m_c_h_ti_text { + font-size: 28rpx; + color: #fff; +} + +._m_m_m_c_foo_cancel { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 68rpx; + background-color: #5BBE04; + border-radius: 12rpx; +} + +._m_m_m_c_foo_can_text { + font-size: 24rpx; + color: #fff; + line-height: 1; +} + +._m_m_m_c_foo_confirm { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 68rpx; + background-color: rgba(255, 255, 255, 0.1); + border-radius: 12rpx; + margin-top: 24rpx; +} + +._m_m_m_c_foo_confirm_text { + font-size: 24rpx; + color: #fff; + line-height: 1; +} \ No newline at end of file diff --git a/node_modules/@douyin-microapp/typings/LICENCE b/node_modules/@douyin-microapp/typings/LICENCE new file mode 100644 index 0000000..4d20996 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@douyin-microapp/typings/README.md b/node_modules/@douyin-microapp/typings/README.md new file mode 100644 index 0000000..e728151 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/README.md @@ -0,0 +1,23 @@ +# 字节小程序类型定义文件 + +字节跳动小程序 API 的 TypeScript 类型定义文件。 + +## 安装 + +```shell +npm install @douyin-microapp/typings +``` + +## 使用 + +安装后手动进行导入。 + +- `import '@douyin-microapp/typings';` + +也可以直接在项目的 `tsconfig.json` 配置文件中指定。 + +- `types: ["@douyin-microapp/typings"]`。 + +或者通过 [三斜杠指令](https://www.tslang.cn/docs/handbook/triple-slash-directives.html) 引用。 + +- `/// ` diff --git a/node_modules/@douyin-microapp/typings/api/accelerometer.d.ts b/node_modules/@douyin-microapp/typings/api/accelerometer.d.ts new file mode 100644 index 0000000..9d54961 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/accelerometer.d.ts @@ -0,0 +1,48 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI, SyncAPI } from "./types"; + +/** + * ### 开始监听加速度数据 + * 具体加速度数据通过注册tt.onAccelerometerChange的回调方法来获取 + */ +export const startAccelerometer: AsyncAPI; + +/** + * ### 停止监听加速度数据 + */ +export const stopAccelerometer: AsyncAPI; + +/** + * ### 监听加速度数据。 + * 回调的频率为 5 次 / 秒,暂不支持设置。接口调用后会开始监听,可通过tt.onStopAccelerometer停止监听。 + */ +export const onAccelerometerChange: SyncAPI< + [ + callback: (res: { + /** X 轴数据 */ + x: number; + /** Y 轴数据 */ + y: number; + /** Z 轴数据 */ + z: number; + }) => void + ] +>; diff --git a/node_modules/@douyin-microapp/typings/api/action-sheet.d.ts b/node_modules/@douyin-microapp/typings/api/action-sheet.d.ts new file mode 100644 index 0000000..8032f31 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/action-sheet.d.ts @@ -0,0 +1,35 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 显示操作菜单 + * + * 设计文档详见操作菜单 + */ +export const showActionSheet: AsyncAPI< + { + itemList: string[]; + }, + { + /** */ + tapIndex: number; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/app-lifecycle.d.ts b/node_modules/@douyin-microapp/typings/api/app-lifecycle.d.ts new file mode 100644 index 0000000..16928b7 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/app-lifecycle.d.ts @@ -0,0 +1,75 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * 监听小程序切前台事件。该事件与 App.onShow 的回调参数一致。 + */ +export const onAppShow: SyncAPI< + [ + (res: { + /** 小程序切前台的路径 (代码包路径) */ + path: string; + /** 小程序切前台的场景值 */ + scene: number; + /** 小程序切前台的 query 参数 */ + query: object; + /** 来源信息,从另一个小程序或 App 进入小程序时返回,否则返回 {}。 */ + referrerInfo: { + /** 来源小程序的 appId */ + appId: string; + /** 来源小程序传过来的数据 */ + extraData: object; + }; + }) => void + ] +>; + +/** + * 取消监听小程序进前台事件。 + */ +export const offAppShow: SyncAPI<[CallableFunction]>; + +/** + * 监听小程序切后台事件。该事件与 App.onHide 的回调时机一致。 + */ +export const onAppHide: SyncAPI<[CallableFunction]>; + +/** + * 取消监听小程序切后台事件。 + */ +export const offAppHide: SyncAPI<[CallableFunction]>; + +/** + * 监听小程序错误事件,如脚本错误或 API 调用报错等。该事件与 App.onError 的回调时机与参数一致。 + */ +export const onError: SyncAPI< + [ + ( + /** 错误信息 */ + error: string + ) => void + ] +>; + +/** + * 取消监听小程序错误事件。 + */ +export const offError: SyncAPI<[callback?: CallableFunction]>; diff --git a/node_modules/@douyin-microapp/typings/api/apply-ec-coupon.d.ts b/node_modules/@douyin-microapp/typings/api/apply-ec-coupon.d.ts new file mode 100644 index 0000000..a8eeafa --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/apply-ec-coupon.d.ts @@ -0,0 +1,36 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; +/** + * 白名单 API,小程序绑定的抖音小店的发放抖店优惠券能力 + */ +export const applyEcCoupon: AsyncAPI< + { + shopId: string; + couponMetaId: string; + couponCount?: number; + }, + { + /** "applyEcCoupon:ok" */ + errMsg: string; + /** 发券的券码列表 */ + couponIdList: [string]; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/apply-refund.d.ts b/node_modules/@douyin-microapp/typings/api/apply-refund.d.ts new file mode 100644 index 0000000..d843e4b --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/apply-refund.d.ts @@ -0,0 +1,48 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; +/** + * 开放API-申请退款 + */ + +interface refundGoods { + goodsId: string; + goodsType: number; + quantity: number; +} + +export const applyRefund: AsyncAPI< + { + refundInfo: { + reason: string[]; + note?: string; + }; + outOrderNo: string; + goodsList?: refundGoods[]; + refundTotalAmount?: number; + type?: number; + callbackData?: { [key: string]: unknown }; + }, + { + refundId: string; + outRefundNo: string; + orderId: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/array-buffer-to-base64.d.ts b/node_modules/@douyin-microapp/typings/api/array-buffer-to-base64.d.ts new file mode 100644 index 0000000..c0002aa --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/array-buffer-to-base64.d.ts @@ -0,0 +1,36 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 将 [ArrayBuffer](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) 对象转成 Base64 字符串 + */ +export const arrayBufferToBase64: SyncAPI< + [ + { + /** 要转化成 Base64 字符串的 ArrayBuffer 对象 */ + obj: ArrayBuffer; + } + ], + { + /** 参数对应生成的 Base64 编码的字符串 */ + base64: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/authorize.d.ts b/node_modules/@douyin-microapp/typings/api/authorize.d.ts new file mode 100644 index 0000000..31e5f47 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/authorize.d.ts @@ -0,0 +1,29 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 提前向用户发出授权请求 + * 该方法不会调用对应接口,只会弹框咨询用户是否授权或者获取用户信息。如果用户之前有授权,该接口直接返回成功,不会跟用户产生交互。 + */ +export const authorize: AsyncAPI<{ + /** 需要预授权的 scope,详见 用户授权 scope 说明 */ + scope: string; +}>; diff --git a/node_modules/@douyin-microapp/typings/api/background-audio.d.ts b/node_modules/@douyin-microapp/typings/api/background-audio.d.ts new file mode 100644 index 0000000..6f2d9ac --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/background-audio.d.ts @@ -0,0 +1,82 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * 获取全局唯一的背景音频管理器 BackgroundAudioManager。该 api 多次调用时返回的是同一个实例,在多页面使用时,会操作到同一个上下文对象。 + */ +export const getBackgroundAudioManager: SyncAPI<[], BackgroundAudioManager>; + +interface BackgroundAudioManager { + /** 音频源地址, 默认为空字符串,当设置了新的 src 时,会自动开始播放,仅支持临时路径(如通过下载到本地的音频地址)、网络地址(需在小程序开发者平台配置域名白名单),所支持的格式同系统音频播放器 */ + src: string; + /** 开始播放的位置(单位:s) */ + startTime: number; + /** 音频标题, 用于原生音频播放器音频标题 */ + title: string; + /** 专辑名 */ + epname: string; + /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值 */ + singer: string; + /** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图 */ + coverImgUrl: string; + /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值 */ + webUrl: string; + /** 音频协议。默认值为 http,设置 hls 可以支持播放 HLS 协议的直播音频 */ + protocol: string; + /** 设置点击悬浮控件/通知栏跳转当前小程序指定页面,数据格式为 {path:"(音乐播放路径)",query:{name:''}} */ + audioPage: { + path: string; + query: object; + }; + /** 当前音频总时长(单位 s),只读 */ + duration: number; + /** 当前音频进度(单位 s),只读 */ + currentTime: number; + /** 当前音频是否处于暂停状态,只读 */ + paused: boolean; + /** 当前音频已缓冲部分(单位 s),只读 */ + buffered: number; + /** 播放 */ + play: CallableFunction; + /** 暂停 */ + pause: CallableFunction; + /** 停止播放。停止后再次播放时从头开始播放 */ + stop: CallableFunction; + /** 当前音频跳转到指定位置(单位:s),并开始播放 */ + seek: ( + /** 跳转的时间(单位:s) */ + options: number + ) => void; + /** 监听音频进入可以播放状态,但不保证后面可以流畅播放 */ + onCanplay: (callback: () => void) => void; + /** 监听自然播放结束事件 */ + onEnded: (callback: () => void) => void; + /** 监听音频进度更新事件 */ + onTimeUpdate: (callback: () => void) => void; + /** 监听音频播放错误事件 */ + onError: (callback: () => void) => void; + /** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发 */ + onWaiting: (callback: () => void) => void; + /** 监听音频开始进行 seek 操作的事件 */ + onSeeking: (callback: () => void) => void; + /** 监听音频完成 seek 操作的事件 */ + onSeeked: (callback: () => void) => void; +} diff --git a/node_modules/@douyin-microapp/typings/api/base64-to-array-buffer.d.ts b/node_modules/@douyin-microapp/typings/api/base64-to-array-buffer.d.ts new file mode 100644 index 0000000..6a54931 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/base64-to-array-buffer.d.ts @@ -0,0 +1,36 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 将 Base64 字符串转成 【ArrayBuffer](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) 对象。 + */ +export const base64ToArrayBuffer: SyncAPI< + [ + /** 要转化成 ArrayBuffer 对象的 Base64 字符串 */ + str: string + ], + arrayBuffer +>; + +interface arrayBuffer { + /** 参数对应生成的 ArrayBuffer 对象 */ + obj: ArrayBuffer; +} diff --git a/node_modules/@douyin-microapp/typings/api/bytenn-manager.d.ts b/node_modules/@douyin-microapp/typings/api/bytenn-manager.d.ts new file mode 100644 index 0000000..afd6080 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/bytenn-manager.d.ts @@ -0,0 +1,156 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +type InferSync = SyncAPI< + [ + { + /** + * 输入数据的格式 + */ + dataConfig: { + /** + * 输入的图像数据 + */ + data: ArrayBuffer; + /** + * 输入数据的宽度 + */ + width: number; + /** + * 输入数据的高度 + */ + height: number; + /** + * 输入数据的通道数 + */ + channel: number; + /** + * 输入数据的 batch 数,默认为 1 + */ + batch?: number; + /** + * 输入数据的类型 + */ + dataType: string; + /** + * 输入数据的格式,NCHW 或 NHWC + */ + dataFormat: string; + }; + /** + * 数据转换的格式 + */ + convertConfig: { + /** + * 数据对应的输出通道 + */ + outputChannel: number; + /** + * 归一化参数 + */ + normalizeFactor: number; + /** + * 归一化后的偏置,默认为 0 + */ + offset?: number; + /** + * 输入通道的配置格式 + */ + inputConfig: { + /** + * 输入通道的通道名 + */ + inputChannel: number; + /** + * 当前通道对应的权重 + */ + weight: number; + }[]; + }[]; + } + ], + {} +>; + +interface BytennEngine { + inferSync: InferSync; +} + +type Load = SyncAPI<[], {}>; + +type OnLoad = SyncAPI< + [ + /** + * res 为返回的 BytennEngine + */ + (res: BytennEngine) => void + ], + {} +>; + +type OnError = SyncAPI< + [ + /** + * err 为返回的错误原因 + */ + (err: Error) => void + ], + {} +>; + +/** ### 进行网络加载 */ +export const load: Load; + +/** ### 设置加载完成回调,会返回加载好的神经网络 */ +export const onLoad: OnLoad; + +/** ### 设置加载失败回调,会返回加载失败的原因 */ +export const onError: OnError; + +/** ### 使用神经网络进行同步推理,会直接返回推理结果 */ +export const inferSync: InferSync; + +/** + * ### 创建一个 BytennEngineContext + * + * 非 IDE 预览环境使用前请申请使用白名单 + */ +export const createBytennEngineContext: SyncAPI< + [ + /** + * 请求的模型名称 + */ + modelName: string, + /** + * 需要初始化的模型配置,numThread 为后台工作线程数,backend 为推理后端类型 + */ + config?: { + numThread?: number; + backend?: string; + } + ], + { + /** 创建好的 bytennEngineContext */ + load: Load; + onError: OnError; + onLoad: OnLoad; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/can-i-put-stuff-over-component.d.ts b/node_modules/@douyin-microapp/typings/api/can-i-put-stuff-over-component.d.ts new file mode 100644 index 0000000..35a0c42 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/can-i-put-stuff-over-component.d.ts @@ -0,0 +1,36 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 小程序中的一些组件是由客户端实现的,如 video、live-player、ad 等。 + * 如果开发者希望通过 css 等手段往这些组件的上方放置一些其他组件,是需要依赖小程序所在 App 具备一定能力才可以实现的。 + * 因此开发者可以使用本方法在小程序运行时判断某组件上方是否支持放置其他组件,并根据返回结果动态的决定小程序页面的实现方式。 + */ +export const canIPutStuffOverComponent: SyncAPI< + [ + /** 小程序组件标签名称,如"video"、"live-player"等, 对 canvas 组件的同层判断请见 [canvas 组件](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/api/foundation/tt-can-i-put-stuff-over-component/#canvas%E7%BB%84%E4%BB%B6) */ + componentName: string + ], + { + /** 返回值是一个布尔值,表示是否支持在该类型组件上放置其他组件 */ + res: boolean; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/can-i-use.d.ts b/node_modules/@douyin-microapp/typings/api/can-i-use.d.ts new file mode 100644 index 0000000..9612e97 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/can-i-use.d.ts @@ -0,0 +1,43 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 判断小程序的 API,回调,参数,组件等是否在当前版本可用。 + * ``` + * // 对象的属性或方法 + * tt.canIUse("UpdateManager"); + * tt.canIUse("Stats.isDirectory"); + * + * // 接口参数、回调或者返回值 + * tt.canIUse("exitMiniProgram"); + * tt.canIUse("getLaunchOptionsSync.return.path"); + * tt.canIUse("getSystemInfo.success.screenWidth"); + * tt.canIUse("showToast.object.title"); + * tt.canIUse("onCompassChange.callback.direction"); + * tt.canIUse("request.object.method.GET"); + * + * // 组件的属性 + * tt.canIUse("swiper"); + * tt.canIUse("text.selectable"); + * tt.canIUse("button.open-type.contact"); + * ``` + */ +export const canIUse: SyncAPI<[schema: string], boolean>; diff --git a/node_modules/@douyin-microapp/typings/api/capture-screen.d.ts b/node_modules/@douyin-microapp/typings/api/capture-screen.d.ts new file mode 100644 index 0000000..4d7284e --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/capture-screen.d.ts @@ -0,0 +1,32 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 监听用户主动截屏事件 + * 用户使用系统截屏按键截屏时触发此事件,只能添加一个监听器。 + */ +export const onUserCaptureScreen: SyncAPI<[() => void]>; + +/** + * ### 取消监听用户主动截屏事件 + * 卸载通过 tt.onUserCaptureScreen 注册的截屏事件监听函数。 + */ +export const offUserCaptureScreen: SyncAPI<[() => void]>; diff --git a/node_modules/@douyin-microapp/typings/api/check-follow-state.d.ts b/node_modules/@douyin-microapp/typings/api/check-follow-state.d.ts new file mode 100644 index 0000000..a683cd7 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/check-follow-state.d.ts @@ -0,0 +1,31 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 查看用户是否已关注小程序绑定的头条号。 + */ +export const checkFollowState: AsyncAPI< + {}, + { + /** 是否已关注头条号 */ + result: boolean; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/check-session.d.ts b/node_modules/@douyin-microapp/typings/api/check-session.d.ts new file mode 100644 index 0000000..a197583 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/check-session.d.ts @@ -0,0 +1,40 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 用户的登录态具有时效性检查 + * + * 随着用户未使用小程序的时间增加,用户的登录态越容易失效;反之,则用户登录态可持续保持有效。 + * + * 使用该 API 可检查用户当前的 session 状态是否有效,登录态过期后开发者可以再调用 tt.login 获取新的用户登录态。 + * + * ```js + * tt.checkSession({ + * success() { + * console.log(`session 未过期`); + * }, + * fail() { + * console.log(`session 已过期,需要重新登录`); + * }, + * }); + * ``` + */ +export const checkSession: AsyncAPI; diff --git a/node_modules/@douyin-microapp/typings/api/choose-address.d.ts b/node_modules/@douyin-microapp/typings/api/choose-address.d.ts new file mode 100644 index 0000000..3516770 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/choose-address.d.ts @@ -0,0 +1,43 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址,同时,用户在小程序中新增的地址会同步至开发者地址库中共存。 + */ +export const chooseAddress: AsyncAPI< + {}, + { + /** "chooseAddress:ok" */ + errMsg: string; + /** 收货人姓名 */ + userName: string; + /** 国际收货地址第一级地址 */ + provinceName: string; + /** 国际收货地址第二级地址 */ + cityName: string; + /** 国际收货地址第三级地址 */ + countyName: string; + /** 详细收货地址信息 */ + detailInfo: string; + /** 收货人手机号码 */ + telNumber: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/clipboard.d.ts b/node_modules/@douyin-microapp/typings/api/clipboard.d.ts new file mode 100644 index 0000000..1b701d9 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/clipboard.d.ts @@ -0,0 +1,40 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 设置系统剪贴板内容 + * 可以和tt.getClipboardData配套使用。 + */ +export const setClipboardData: AsyncAPI<{ + /** 剪贴板的内容 */ + data: string; +}>; + +/** + * ### 获取系统剪贴板内容 + */ +export const getClipboardData: AsyncAPI< + {}, + { + /** 剪贴板的内容 */ + data: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/compass.d.ts b/node_modules/@douyin-microapp/typings/api/compass.d.ts new file mode 100644 index 0000000..b25df21 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/compass.d.ts @@ -0,0 +1,61 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI, SyncAPI } from "./types"; + +/** + * ### 监听罗盘数据变化事件 + * + * 接口调用后会自动开始监听,可使用 tt.stopCompass 停止监听 + * + * 罗盘数据会在用户手机如下操作发生改变(频率 5 次/秒) + * - 朝向变化 + * - 加速前进 + * - 加速后退 + * - 摇一摇 + */ +export const onCompassChange: SyncAPI< + [ + (res: { + /** 方向 */ + direction?: number; + }) => void + ] +>; + +/** + * ### 取消监听罗盘数据变化事件 + */ +export const offCompassChange: SyncAPI<[(...args: any[]) => void]>; + +/** + * ### 开始监听罗盘数据 + * + * 罗盘数据会在用户手机如下操作发生改变(频率 5 次/秒) + * - 朝向变化 + * - 加速前进 + * - 加速后退 + * - 摇一摇 + */ +export const startCompass: AsyncAPI; + +/** + * ### 停止监听罗盘数据 + */ +export const stopCompass: AsyncAPI; diff --git a/node_modules/@douyin-microapp/typings/api/complete-pay-sync.d.ts b/node_modules/@douyin-microapp/typings/api/complete-pay-sync.d.ts new file mode 100644 index 0000000..fc083a9 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/complete-pay-sync.d.ts @@ -0,0 +1,37 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; +/** + * 支付 + */ +export const completePaySync: SyncAPI< + [ + { + orderId?: string; + result: { + status: "success" | "fail"; + orderId: string; + outOrderNo: string; + result: { code: number; orderId: string } | { errMsg: string }; + }; + } + ], + {} +>; diff --git a/node_modules/@douyin-microapp/typings/api/complete-refund-sync.d.ts b/node_modules/@douyin-microapp/typings/api/complete-refund-sync.d.ts new file mode 100644 index 0000000..d618a4c --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/complete-refund-sync.d.ts @@ -0,0 +1,38 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; +/** + * 申请退款 + */ +export const completeRefundSync: SyncAPI< + [ + { + orderId?: string; + result: { + status: "success" | "fail"; + outOrderNo: string; + result: + | { refundId: string; outRefundNo: string; orderId: string } + | { errMsg: string }; + }; + } + ], + {} +>; diff --git a/node_modules/@douyin-microapp/typings/api/compress-image.d.ts b/node_modules/@douyin-microapp/typings/api/compress-image.d.ts new file mode 100644 index 0000000..5d6ea7b --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/compress-image.d.ts @@ -0,0 +1,45 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 压缩图片接口 + * + * 该 API 仅对 `jpg` 有效 + */ +export const compressImage: AsyncAPI< + { + /** + * 图片路径,不支持网络图片,可以本地路径、代码包相对路径 + */ + src: string | string[]; + + /** + * 压缩质量,范围 0 ~ 100,数值越小,质量越低,压缩率越高 + * + * 默认值 80 + */ + quality?: number; + }, + { + /** 压缩完成后的文件的临时路径 */ + tempFilePath: string | string[]; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/connect-socket.d.ts b/node_modules/@douyin-microapp/typings/api/connect-socket.d.ts new file mode 100644 index 0000000..aa13eb6 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/connect-socket.d.ts @@ -0,0 +1,126 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI, AsyncAPIWithHandler } from "./types"; + +interface SocketTask { + /** + * 表示 Socket 连接状态 code + * 若由于参数错误导致未创建连接, 则为 undefined + */ + readonly readyState?: 0 | 1 | 2 | 3; + /** 表示 Socket 正在连接的常量 */ + readonly CONNECTING: 0; + /** 表示 Socket 连接已经打开的常量 */ + readonly OPEN: 1; + /** 表示 Socket 连接关闭中的常量 */ + readonly CLOSING: 2; + /** 表示 Socket 连接已关闭的常量 */ + readonly CLOSED: 3; + + /** + * ### WebSocket 发送给服务端数据的方法 + */ + send: AsyncAPI<{ + /** 发送的数据内容 */ + data: string | ArrayBuffer; + }>; + + /** ### 关闭 WebSocket 连接的方法。 */ + close: AsyncAPI<{ + /** 关闭连接状态码 */ + code?: number; + /** 连接被关闭的原因 */ + reason?: string; + }>; + + /** + * ### 监听 WebSocket 连接服务器成功的事件 + * 表示 WebSocket 的状态变成 open,可以发送数据给服务器。 + */ + onOpen: ( + callback: (res: { + /** 连接服务器返回的 Response Header */ + header: Record; + /** 使用的网络传输层协议 */ + protocolType: string; + /** websocket 类型 */ + socketType: "ttnet" | "tradition"; + }) => void + ) => void; + + /** 监听 WebSocket 与服务器的连接断开的事件 */ + onClose: ( + callback: (res: { + /** 使用的网络传输层协议 */ + protocolType: string; + /** websocket 类型 */ + socketType: string; + /** 错误信息 */ + errMsg: string; + /** 关闭原因 */ + reason: string; + /** 关闭 code */ + code: string | number; + }) => void + ) => void; + + /** ### 监听 WebSocket 接收到服务器发送信息的事件。 */ + onMessage: ( + callback: (res: { + /** 接收到的服务器消息 */ + data: string | ArrayBuffer; + /** websocket 使用的协议 */ + protocolType: string; + /** websocket 类型 */ + socketType: "ttnet" | "tradition"; + }) => void + ) => void; + + /** ### 监听 WebSocket 发生错误的事件 */ + onError: ( + callback: (res: { + /** 错误信息 */ + errMsg: string; + }) => void + ) => void; +} + +/** + * ### 创建一个 WebSocket 连接实例 + * + * 并通过返回的socketTask操作该连接 + * + * 网络相关的 API 在使用前需要配置域名白名单 + * + * 请参考[网络请求使用说明](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/api/other/network-request-reference/) + */ +export const connectSocket: AsyncAPIWithHandler< + { + /** Socket 连接地址 */ + url: string; + header?: Record; + protocols?: string[]; + }, + { + /** 当前创建的 sockTask 的序号 */ + socketTaskId: number; + }, + SocketTask +>; diff --git a/node_modules/@douyin-microapp/typings/api/continue-to-pay.d.ts b/node_modules/@douyin-microapp/typings/api/continue-to-pay.d.ts new file mode 100644 index 0000000..ca5f773 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/continue-to-pay.d.ts @@ -0,0 +1,34 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; +/** + * 开放API-继续支付 + */ + +export const continueToPay: AsyncAPI< + { + orderId?: string; + outOrderNo?: string; + }, + { + orderId: string; + outOrderNo: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/create-animation.d.ts b/node_modules/@douyin-microapp/typings/api/create-animation.d.ts new file mode 100644 index 0000000..eb4282b --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-animation.d.ts @@ -0,0 +1,158 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +export const createAnimation: SyncAPI< + [ + | { + /** + * 指定一个动画周期的时长, 单位 ms + * + * 默认值 400 + */ + duration?: number; + /** + * 定义动画在每一动画周期中执行的节奏, [参考文档](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function) + * + * 默认值 "linear" + */ + timingFunction?: string; + /** + * 定义动画于何时开始 + * + * 默认值 0 + */ + delay?: number; + /** + * 指定元素变形的原点 + * + * 默认值 "50% 50% 0" + */ + transformOrigin?: string; + } + | undefined + ], + Animation +>; + +interface Animation { + /** 透明度 */ + opacity: (value: number) => Animation; + /** 背景色 */ + backgroundColor: (value: string) => Animation; + /** 宽度 */ + width: (value: number) => Animation; + /** 高度 */ + height: (value: number) => Animation; + /** 顶部距离 */ + top: (value: number) => Animation; + /** 底部距离 */ + bottom: (value: number) => Animation; + /** 左侧距离 */ + left: (value: number) => Animation; + /** 右侧距离 */ + right: (value: number) => Animation; + + /** 旋转, 等效 rotateZ */ + rotate: (value: number) => Animation; + /** X 轴旋转 */ + rotateX: (x: number) => Animation; + /** Y 轴旋转 */ + rotateY: (y: number) => Animation; + /** Z 轴旋转 */ + rotateZ: (z: number) => Animation; + /** + * 从 固定轴 顺时针旋转一个角度 + * + * @param x 描述旋转轴向量的x坐标 + * @param y 描述旋转轴向量的y坐标 + * @param z 描述旋转轴向量的z坐标 + * @param a 代表旋转的角度. 正角度表示顺时针旋转, 负角度表示逆时针旋转 + */ + rotate3d: (x: number, y: number, z: number, a: number) => Animation; + + /** XY 缩放 */ + scale: (s: number) => Animation; + /** X 轴缩放 */ + scaleX: (x: number) => Animation; + /** Y 轴缩放 */ + scaleY: (y: number) => Animation; + /** Z 轴缩放 */ + scaleZ: (z: number) => Animation; + /** XYZ 轴缩放 */ + scale3d: (x: number, y: number, z: number) => Animation; + + /** XY 轴平移 */ + translate: (x: number, y: number) => Animation; + /** X 轴平移 */ + translateX: (x: number) => Animation; + /** Y 轴平移 */ + translateY: (y: number) => Animation; + /** Z 轴平移 */ + translateZ: (z: number) => Animation; + /** XYZ 轴平移 */ + translate3d: (x: number, y: number, z: number) => Animation; + + /** XY 轴倾斜 */ + skew: (x: number, y: number) => Animation; + /** X 轴倾斜 */ + skewX: (x: number) => Animation; + /** Y 轴倾斜 */ + skewY: (y: number) => Animation; + + /** + * CSS 函数 matrix() 指定了一个由指定的 6 个值组成的 2D 变换矩阵 + * + * 这种矩阵的常量值是隐含的,而不是由参数传递的, 其他的参数是以列优先的顺序描述的 + * + * `matrix(a, b, c, d, tx, ty)` 是 `matrix3d(a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1)` 的简写 + */ + matrix: ( + a: number, + b: number, + c: number, + d: number, + tx: number, + ty: number + ) => Animation; + + /** + * CSS 函数 matrix3d() 以 4x4 齐次矩阵的形式定义一个3D转换 + * 其结果是一个 [transform-function](https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-function) 数据类型。 + */ + matrix3d: ( + a1: number, + b1: number, + c1: number, + d1: number, + a2: number, + b2: number, + c2: number, + d2: number, + a3: number, + b3: number, + c3: number, + d3: number, + a4: number, + b4: number, + c4: number, + d4: number + ) => Animation; +} diff --git a/node_modules/@douyin-microapp/typings/api/create-cloud.d.ts b/node_modules/@douyin-microapp/typings/api/create-cloud.d.ts new file mode 100644 index 0000000..13c1ffd --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-cloud.d.ts @@ -0,0 +1,264 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI, AsyncAPI, AsyncAPIWithHandler } from "./types"; + +export interface CloudID { + cloudID: string; +} + +export interface DeleteFile { + fileName: string; + status: number; + message: string; +} + +export interface CloudUploadTask { + onProgressUpdate: ( + callback: (data: { + /** 上传进度 */ + progress: number; + /** 已经上传的数据长度,单位byte */ + totalBytesSent: number; + /** 预期需要上传的数据总长度,单位byte */ + totalBytesExpectedToSend: number; + }) => void + ) => void; + offProgressUpdate: ( + // eslint-disable-next-line + callback: (...args: any[]) => void + ) => void; +} + +export interface CloudDownloadTask { + onProgressUpdate: ( + callback: (data: { + /** 上传进度 */ + progress: number; + /** 已经上传的数据长度,单位byte */ + totalBytesWritten: number; + /** 预期需要上传的数据总长度,单位byte */ + totalBytesExpectedToWrite: number; + }) => void + ) => void; + offProgressUpdate: ( + // eslint-disable-next-line + callback: (...args: any[]) => void + ) => void; +} + +export interface CloudExtensionManager { + joinGroup: AsyncAPI< + { + groupInfoArray: { groupName: string; groupValue: string }[]; + }, + { + result: { groupName: string; groupValue: string; status: number }[]; + } + >; + exitGroup: AsyncAPI< + { + groupInfoArray: { groupName: string; groupValue: string }[]; + }, + { + result: { groupName: string; groupValue: string; status: number }[]; + } + >; +} + +export interface CloudSocketTask { + /** + * 表示 Socket 连接状态 code + * 若由于参数错误导致未创建连接, 则为 undefined + */ + readonly readyState?: 0 | 1 | 2 | 3; + /** 表示 Socket 正在连接的常量 */ + readonly CONNECTING: 0; + /** 表示 Socket 连接已经打开的常量 */ + readonly OPEN: 1; + /** 表示 Socket 连接关闭中的常量 */ + readonly CLOSING: 2; + /** 表示 Socket 连接已关闭的常量 */ + readonly CLOSED: 3; + + /** + * ### WebSocket 发送给服务端数据的方法 + */ + send: AsyncAPI<{ + /** 发送的数据内容 */ + data: string | ArrayBuffer; + }>; + + /** ### 关闭 WebSocket 连接的方法。 */ + close: AsyncAPI<{ + /** 关闭连接状态码 */ + code?: number; + /** 连接被关闭的原因 */ + reason?: string; + }>; + + getCloudExtensionManager: SyncAPI<[], CloudExtensionManager>; + + /** + * ### 监听 WebSocket 连接服务器成功的事件 + * 表示 WebSocket 的状态变成 open,可以发送数据给服务器。 + */ + onOpen: ( + callback: (res: { + /** 连接服务器返回的 Response Header */ + header: Record; + }) => void + ) => void; + + /** 监听 WebSocket 与服务器的连接断开的事件 */ + onClose: ( + callback: (res: { + /** 错误信息 */ + errMsg?: string; + /** 关闭原因 */ + reason?: string; + /** 关闭 code */ + code?: string | number; + }) => void + ) => void; + + /** ### 监听 WebSocket 接收到服务器发送信息的事件。 */ + onMessage: ( + callback: (res: { + /** 接收到的服务器消息 */ + data: string | ArrayBuffer; + }) => void + ) => void; + + /** ### 监听 WebSocket 发生错误的事件 */ + onError: ( + callback: (res: { + /** 错误信息 */ + errMsg: string; + }) => void + ) => void; +} + +export interface TempFileURL { + fileName: string; + url: string; + maxAge: number; + status: number; + message: string; +} + +export interface Cloud { + envID: string; + serviceID?: string; + callContainer: AsyncAPI< + { + path: string; + serviceID?: string; + init?: { + method?: + | "get" + | "GET" + | "options" + | "OPTIONS" + | "post" + | "POST" + | "put" + | "PUT" + | "delete" + | "DELETE" + | "trace" + | "TRACE" + | "patch" + | "PATCH"; + header?: Record; + body?: object | string | ArrayBuffer; + timeout?: number; + }; + }, + { + statusCode: number; + header: object; + data: string; + } + >; + CloudID: SyncAPI<[string], CloudID>; + uploadFile: AsyncAPIWithHandler< + { + cloudPath: string; + filePath: string; + timeout?: number; + }, + {}, + CloudUploadTask + >; + downloadFile: AsyncAPIWithHandler< + { + cloudPath: string; + filePath?: string; + timeout?: number; + }, + { + tempFilePath?: string; + filePath?: string; + }, + CloudDownloadTask + >; + deleteFile: AsyncAPI< + { + cloudPaths: string[]; + timeout?: number; + }, + { + fileLists: DeleteFile[]; + } + >; + getTempFileURL: AsyncAPI< + { + cloudPaths: string[]; + timeout?: number; + maxAge?: number; + }, + { + fileLists: TempFileURL[]; + } + >; + connectContainer: AsyncAPIWithHandler< + { + path: string; + serviceID?: string; + header?: Record; + }, + { + socketTaskId: number; + }, + CloudSocketTask + >; +} +/** + * ### 创建托管云实例 + */ +export const createCloud: SyncAPI< + [ + { + envID: string; + serviceID?: string; + } + ], + Cloud +>; diff --git a/node_modules/@douyin-microapp/typings/api/create-interstitial-ad.d.ts b/node_modules/@douyin-microapp/typings/api/create-interstitial-ad.d.ts new file mode 100644 index 0000000..fdb097a --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-interstitial-ad.d.ts @@ -0,0 +1,53 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 创建插屏广告组件 + * + * 开发者可以在小程序中使用插屏广告获得收入。具体接入方式可参考 [抖音端插屏广告-接入指南](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/functional-plug-in/advertising-component-access-guide/chaping/) + */ +export const createInterstitialAd: SyncAPI< + [{ adUnitId: string }], + InterstitialAd +>; + +type Callback = (...args: any[]) => any; + +interface InterstitialAd { + /** 显示插屏广告 */ + show: () => Promise; + /** 加载插屏广告 */ + load: () => Promise; + /** 销毁插屏广告实例 */ + destroy: () => Promise; + /** 监听插屏广告加载事件 */ + onLoad: (fn: Callback) => void; + /** 取消监听插屏广告加载事件 */ + offLoad: (fn: Callback) => void; + /** 监听插屏错误事件 */ + onError: (fn: (data: { errMsg: string; errCode: number }) => void) => void; + /** 取消监听插屏错误事件 */ + offError: (fn: Callback) => void; + /** 监听插屏广告关闭事件 */ + onClose: (fn: (data: any) => void) => void; + /** 取消监听插屏广告关闭事件 */ + offClose: (fn: Callback) => void; +} diff --git a/node_modules/@douyin-microapp/typings/api/create-live-player-context.d.ts b/node_modules/@douyin-microapp/typings/api/create-live-player-context.d.ts new file mode 100644 index 0000000..1efd4ad --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-live-player-context.d.ts @@ -0,0 +1,54 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 根据 组件 id 创建可以控制组件的上下文 LivePlayerContext 对象 + */ +export const createLivePlayerContext: SyncAPI< + | [ + /** 组件的 id */ + id: string, + /** 在自定义组件下,当前组件实例的 this,以操作组件内 组件 */ + component: object + ] + | [ + /** 组件的 id */ + id: string + ], + LivePlayerContext +>; + +interface LivePlayerContext { + /** 用来控制进入全屏时画面朝向 0代表默认值,正常竖向 90代表屏幕逆时针90度 -90代表屏幕顺时针90度 */ + direction: number; + /** 播放 */ + play: CallableFunction; + /** 停止 */ + stop: CallableFunction; + /** 静音 */ + mute: CallableFunction; + /** 取消静音 */ + unmute: CallableFunction; + /** 进入全屏 */ + requestFullScreen: CallableFunction; + /** 退出全屏 */ + exitFullScreen: CallableFunction; +} diff --git a/node_modules/@douyin-microapp/typings/api/create-media-recorder.d.ts b/node_modules/@douyin-microapp/typings/api/create-media-recorder.d.ts new file mode 100644 index 0000000..f70e579 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-media-recorder.d.ts @@ -0,0 +1,101 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +type Start = SyncAPI<[], {}>; +type Pause = SyncAPI<[], {}>; +type Resume = SyncAPI<[], {}>; +type Stop = SyncAPI<[], {}>; +type Destroy = SyncAPI<[], {}>; +type RequestFrame = SyncAPI<[], {}>; +type OnError = SyncAPI< + [ + /** + * err 为返回的错误原因 + */ + (err: Error) => void + ], + {} +>; +type OnStart = SyncAPI<[() => void], {}>; +type onStop = SyncAPI< + [ + (info: { + /** + * The file path of the output video. + */ + filePath: string; + /** + * The duration of the output video, in seconds. + */ + duration: number; + /** + * The file size of the output video, in kb. + */ + fileSize: number; + }) => void + ], + {} +>; + +export const createMediaRecorder: SyncAPI< + [ + canvas: unknown, + config?: { + /** + * The width of the output video. + * @default 480 + */ + width?: number; + /** + * The height of the output video. + * @default 640 + */ + height?: number; + /** + * The bit rate of the output video, in kbps. + * @default 3000 + */ + videoBitsPerSecond?: number; + /** + * The gop(group of pictures) of the output video. + * @default 12 + */ + gop?: number; + /** + * The fps(frame per second) of the outpu video. + * This value corresponds to the intended frame rate. + * If you set this to 0, media recorder will enter manual mode. + * In manual mode, you need to call `requestFrame` to trigger the recording of the canvas. + * @default 60 + */ + fps?: number; + } + ], + { + start: Start; + pause: Pause; + resume: Resume; + stop: Stop; + destroy: Destroy; + onError: OnError; + requestFrame: RequestFrame; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/create-merchant-order.d.ts b/node_modules/@douyin-microapp/typings/api/create-merchant-order.d.ts new file mode 100644 index 0000000..58635bc --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-merchant-order.d.ts @@ -0,0 +1,79 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; +/** + * 申请退款 + */ + +interface GoodsInfo { + quantity: number; + price: number; + goodsTitle?: string; + goodsPhoto?: string; + goodsSubTitle?: string; + goodsLabels?: string; + goodsId: string; + goodsIdType: number; + discountAmount: number; + dateRule?: string; + goodsPage: { + path?: string; + params?: string; + }; +} + +interface ReservationInfo { + useReservation: boolean; + relationType: number; + itemReservations: ReservationItem[]; +} + +interface ReservationItem { + userReserveIds: string[]; +} + +export const createMerchantOrder: AsyncAPI< + { + goodsList: GoodsInfo[]; + totalDiscountAmount: number; + totalAmount: number; + appId?: string; + appType: number; + scene: string; + launchFrom: string; + location: string; + phoneNum?: string; + contactName?: string; + extra?: string; + poiId?: string; + merchantId?: string; + storeName?: string; + storeIcon?: string; + videoId?: string; + callbackData?: string; + reservationData?: ReservationInfo[]; + }, + { + orderId: string; + outOrderNo: string; + payOrderId: string; + orderToken: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/create-offscreen-canvas.d.ts b/node_modules/@douyin-microapp/typings/api/create-offscreen-canvas.d.ts new file mode 100644 index 0000000..72ecf4f --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-offscreen-canvas.d.ts @@ -0,0 +1,37 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 创建离屏 canvas 实例 + */ +export const createOffscreenCanvas: SyncAPI< + [], + /** 离屏 canvas 实例,可通过 tt.createOffscreenCanvas 创建 */ + OffscreenCanvas +>; + +interface OffscreenCanvas { + /** 该方法返回 OffscreenCanvas 的绘图上下文 */ + getContext: ( + /** canvas 类型,可取值 2d 或 webgl */ + type: "2d" | "webgl" + ) => any; +} diff --git a/node_modules/@douyin-microapp/typings/api/create-order.d.ts b/node_modules/@douyin-microapp/typings/api/create-order.d.ts new file mode 100644 index 0000000..0841bee --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-order.d.ts @@ -0,0 +1,76 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; +/** + * 开放API-创建订单 + */ + +interface GoodsInfo { + quantity: number; + price: number; + + discountAmount?: number; //商品折扣 + + goodsName: string; // 商品名 + goodsPhoto: string; // 商品照片 + goodsId: string; // 商品 ID + goodsType: number; // 商品类型 1 或 2 + + goodsSubTitle?: string; // 商品副标题,暂时无需填入 + goodsLabels?: string[]; // 商品标签 + dateRule?: string; // 使用规则 + + goodsPage?: { + path?: string; // 商品详情页路径 + params?: string; // 详情页路径参数 + }; +} +export const createOrder: AsyncAPI< + { + goodsList: GoodsInfo[]; + + payment: { + totalDiscountAmount?: number; + totalAmount: number; + }; + + appType?: number; + + contactInfo?: { + phoneNumber?: string; + contactName?: string; + }; + note?: string; + merchantInfo?: { + merchantId?: string; + }; + + storeInfo?: { + storeName?: string; + storeIcon?: string; + }; + + callbackData?: { [key: string]: unknown }; + }, + { + orderId: string; + outOrderNo: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/create-refund-order.d.ts b/node_modules/@douyin-microapp/typings/api/create-refund-order.d.ts new file mode 100644 index 0000000..88c3df7 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-refund-order.d.ts @@ -0,0 +1,43 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; +/** + * 申请退款 + */ + +interface RefundGoods { + goods_id: string; + goods_id_type: number; + refund_quantity: number; +} + +export const createRefundOrder: AsyncAPI< + { + appId: string; + reason: string[]; + type: number; + outOrderNo: string; + description: string; + extra?: string; + refundGoods: RefundGoods[]; + refundTotalAmount?: number; + }, + { refundId: string; outRefundNo: string; orderId: string } +>; diff --git a/node_modules/@douyin-microapp/typings/api/create-rewarded-video-ad.d.ts b/node_modules/@douyin-microapp/typings/api/create-rewarded-video-ad.d.ts new file mode 100644 index 0000000..33ca28d --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-rewarded-video-ad.d.ts @@ -0,0 +1,53 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 开发者可以在小程序中使用激励视频广告获得收入。 + * 具体接入方式可参考[抖音端激励视频广告接入说明](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/functional-plug-in/advertising-component-access-guide/vibrato-end-video-advertising-incentives/) + */ +export const createRewardedVideoAd: SyncAPI< + [ + { + /** 广告位 id */ + adUnitId: string; + } + ], + RewardedVideoAd +>; + +type Callback = (...args: any[]) => any; + +interface RewardedVideoAd { + /** 广告创建后默认是隐藏的,可以通过该方法显示广告 */ + show: () => Promise; + /** 当广告素材加载出现错误时,可以通过 load 方法手动加载 */ + load: () => Promise; + /** 绑定广告 load 事件的监听器 */ + onLoad: (fn: Callback) => void; + /** 解除绑定 load 事件的监听器 */ + offLoad: (fn: Callback) => void; + /** 绑定 error 事件的监听器 */ + onError: (fn: (data: { errMsg: string; errCode: number }) => void) => void; + /** 解除绑定 error 事件的监听器 */ + onClose: (fn: (data: { isEnded: boolean }) => void) => void; + /** 绑定 close 事件的监听器 */ + offClose: (fn: Callback) => void; +} diff --git a/node_modules/@douyin-microapp/typings/api/create-worker.d.ts b/node_modules/@douyin-microapp/typings/api/create-worker.d.ts new file mode 100644 index 0000000..95a3cd0 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/create-worker.d.ts @@ -0,0 +1,40 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** 通信消息类型 */ +type message = string | boolean | number | object | [] | ArrayBuffer; + +export const createWorker: SyncAPI< + [ + /** worker 线程的绝对路径 */ + scriptPath: string + ], + workerContext +>; + +interface workerContext { + /** 监听 worker 线程的消息 */ + onMessage: SyncAPI<[callback: (msg: message) => void]>; + /** 发送消息给 worker 线程 */ + postMessage: SyncAPI<[message: message]>; + /** 销毁 worker 线程 */ + terminate: SyncAPI<[]>; +} diff --git a/node_modules/@douyin-microapp/typings/api/download-file.d.ts b/node_modules/@douyin-microapp/typings/api/download-file.d.ts new file mode 100644 index 0000000..4f862ce --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/download-file.d.ts @@ -0,0 +1,60 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPIWithHandler } from "./types"; + +/** + * ### 客户端直接发起一个 HTTPS GET 请求, 下载网络文件到本地临时目录 + * + * 单次下载允许的最大文件为 50MB + * + * 网络相关的 API 在使用前需要配置域名白名单。请参考网络请求使用说明 + */ +export const downloadFile: AsyncAPIWithHandler< + { + /** 文件地址 */ + url: string; + /** 请求 Header */ + header?: Record; + }, + { + /** 文件本地路径 */ + tempFilePath: string; + /** 返回 HTTP 状态码 */ + statusCode: number; + }, + DownloadTask +>; + +interface DownloadTask { + /** 中断下载任务 */ + abort: () => void; + + /** 监听下载任务 */ + onProgressUpdate: ( + callback: (res: { + /** 下载进度 */ + progress: number; + /** 已经下载的数据长度,单位byte */ + totalBytesWritten: number; + /** 预期需要下载的数据总长度,单位byte */ + totalBytesExpectedToWrite: number; + }) => void + ) => void; +} diff --git a/node_modules/@douyin-microapp/typings/api/env.d.ts b/node_modules/@douyin-microapp/typings/api/env.d.ts new file mode 100644 index 0000000..a6c483e --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/env.d.ts @@ -0,0 +1,26 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +/** ### 环境变量 */ +export const env: { + /** 用户数据存储的路径 */ + readonly USER_DATA_PATH: string; + /** 开发环境 */ + readonly VERSION: string; +}; diff --git a/node_modules/@douyin-microapp/typings/api/exit-mini-program.d.ts b/node_modules/@douyin-microapp/typings/api/exit-mini-program.d.ts new file mode 100644 index 0000000..b1d0239 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/exit-mini-program.d.ts @@ -0,0 +1,25 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 退出当前小程序到后台。 + */ +export const exitMiniProgram: AsyncAPI; diff --git a/node_modules/@douyin-microapp/typings/api/favorite.d.ts b/node_modules/@douyin-microapp/typings/api/favorite.d.ts new file mode 100644 index 0000000..74ac84c --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/favorite.d.ts @@ -0,0 +1,32 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * 在小程序内调起关注小程序的引导组件,用于引导用户关注小程序。 + */ +export const showFavoriteGuide: AsyncAPI<{ + /** 引导组件类型,可以是 bar(底部弹窗)、tip(顶部气泡)*/ + type?: string; + /** 弹窗文案,最多显示 12 个字符 */ + content?: string; + /** 弹窗类型为 bar 时的位置参数,可以是 bottom(贴近底部)、overtab(悬于页面 tab 区域上方) */ + position?: string; +}>; diff --git a/node_modules/@douyin-microapp/typings/api/follow-aweme-user.d.ts b/node_modules/@douyin-microapp/typings/api/follow-aweme-user.d.ts new file mode 100644 index 0000000..7c3898f --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/follow-aweme-user.d.ts @@ -0,0 +1,33 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * 一键关注抖音号 + * + * 可以通过 tt.followAwemeUser 接口一键关注 + */ +export const followAwemeUser: AsyncAPI< + {}, + { + /** 如果为 true 表示已经关注,为 false 表示未关注 */ + followed: boolean; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/follow-official-account.d.ts b/node_modules/@douyin-microapp/typings/api/follow-official-account.d.ts new file mode 100644 index 0000000..cd825cf --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/follow-official-account.d.ts @@ -0,0 +1,33 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * 关注小程序绑定的头条号 + * + * 可以通过 tt.checkFollowState 接口获取当前关注状态 + */ +export const followOfficialAccount: AsyncAPI< + {}, + { + /** 如果为 0 表示关注成功 */ + errCode: 0 | 1; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/fs.d.ts b/node_modules/@douyin-microapp/typings/api/fs.d.ts new file mode 100644 index 0000000..431bd7c --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/fs.d.ts @@ -0,0 +1,364 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI, SyncAPI } from "./types"; + +/** + * ### 保存临时文件到用户目录 + * 用户目录以 ttfile://user 开头 + */ +export const saveFile: SaveFile; + +/** ### 获取 临时目录(ttfile://tmep) 或 用户目录(ttfile://user) 下的文件信息 */ +export const getFileInfo: GetFileInfo; + +/** ### 获取该小程序下用户目录文件列表, 用户目录以 ttfile://user 开头 */ +export const getSavedFileList: GetSavedFileList; + +/** ### 删除该小程序下用户目录内的文件, 用户目录以 ttfile://user 开头 */ +export const removeSavedFile: RemoveSavedFile; + +type ReadFile = AsyncAPI< + { + /** 要读取的文件的路径 */ + filePath: string; + /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 */ + encoding?: string; + /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */ + position?: number; + /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */ + length?: number; + }, + { + /** 返回数据 */ + data: string; + } +>; + +type RemoveSavedFile = AsyncAPI<{ + /** 要删除的文件路径, 必须以 ttfile://user 开头 */ + filePath: string; +}>; + +type GetSavedFileList = AsyncAPI< + {}, + { + /** 文件数组,每一项是一个 FileItem */ + fileList: { + /** 文件路径 */ + filePath: string; + /** 本地文件大小,以字节为单位 */ + size: number; + /** 文件保存时的时间戳,从 1970/01/01 08:00:00 到当前时间的秒数 */ + createTime: number; + }[]; + } +>; + +type GetFileInfo = AsyncAPI< + { + /** 要读取的文件路径 */ + filePath: string; + /** 计算文件指纹的算法 */ + digestAlgorithm?: string; + }, + { + /** 文件大小,以字节为单位 */ + size: number; + /** 按照传入的 digestAlgorithm 计算得出的文件指纹 */ + digest?: string; + } +>; + +type SaveFile = AsyncAPI< + { + /** 文件临时路径 */ + tempFilePath: string; + /** 要存储的路径, 必须以 ttfile://user 开头 */ + filePath?: string; + }, + { + /** 保存后文件路径 */ + savedFilePath: string; + } +>; + +interface Stat { + /** 文件的类型和存取的权限,对应 POSIX stat.st_mode */ + mode: string; + /** 文件大小,单位:B,对应 POSIX stat.st_size */ + size: number; + /** 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime */ + lastAccessedTime: number; + /** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */ + lastModifiedTime: number; + /** 判断当前文件是否一个目录 */ + isDirectory: () => {}; + /** 判断当前文件是否一个普通文件 */ + isFile: () => {}; +} + +type encoding = + | "ascii" + | "base64" + | "binary" + | "hex" + | "ucs2" + | "ucs-2" + | "utf16le" + | "utf-16le" + | "utf-8" + | "utf8" + | "latin1"; + +/** + * ### 获取全局唯一的文件管理器 + */ +export const getFileSystemManager: SyncAPI< + [], + { + /** 读取本地文件内容 */ + readFile: ReadFile; + /** 同步读取本地文件内容 */ + readFileSync: SyncAPI< + [ + /** 要读取的文件的路径 */ + filePath: string, + /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 */ + encoding?: string, + /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */ + position?: number, + /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */ + length?: number + ], + string + >; + /** 写文件,只能写入用户目录(ttfile://user) */ + writeFile: AsyncAPI< + { + /** 要写入的文件路径, 必须以 ttfile://user 开头 */ + filePath: string; + /** 要写入的文本或二进制数据 */ + data: string; + /** 指定写入文件的字符编码 */ + encoding: encoding; + }, + {} + >; + /** 同步写文件 */ + writeFileSync: SyncAPI< + [ + /** 要写入的文件路径, 必须以 ttfile://user 开头 */ + filePath: string, + /** 要写入的文本或二进制数据 */ + data: string, + /** 指定写入文件的字符编码 */ + encoding: encoding + ] + >; + /** 在 用户目录 下创建目录 */ + mkdir: AsyncAPI<{ + /** 创建的目录路径, 必须以 ttfile://user 开头 */ + dirPath: string; + /** 是否在递归创建该目录的上级目录后再创建该目录 */ + recursive?: boolean; + }>; + /** 同步方法,在 用户目录 下创建目录 */ + mkdirSync: SyncAPI< + [ + /** 创建的目录路径, 必须以 ttfile://user 开头 */ + dirPath: string, + /** 是否在递归创建该目录的上级目录后再创建该目录 */ + recursive?: boolean + ] + >; + /** 读取目录内文件列表 */ + readdir: AsyncAPI< + { + /** 要读取的目录路径 */ + dirPath: string; + }, + { + /** 指定目录下的文件名数组 */ + files: string[]; + } + >; + /** 同步方法,读取目录内文件列表 */ + readdirSync: SyncAPI< + [ + /** 要读取的目录路径 */ + dirPath: string + ], + string[] + >; + /** 删除目录, 只能是 ttfile://user 下的目录 */ + rmdir: AsyncAPI<{ + /** 要删除的目录路径,必须以 ttfile://user 开头 */ + dirPath: string; + /** 目录不为空时,是否递归删除 */ + recursive?: boolean; + }>; + /** 同步方法,删除目录, 只能是 ttfile://user 下的目录 */ + rmdirSync: SyncAPI< + [ + /** 要删除的目录路径,必须以 ttfile://user 开头 */ + dirPath: string, + /** 目录不为空时,是否递归删除 */ + recursive?: boolean + ] + >; + /** 判断文件/目录是否存在 */ + access: AsyncAPI<{ + /** 要判断是否存在的文件/目录路径 */ + path: string; + }>; + /** 同步方法,判断文件/目录是否存在 */ + accessSync: SyncAPI< + [ + /** 待检测的文件或者目录地址 */ + path: string + ] + >; + /** 删除文件,只能在 ttfile://user 开头的用户目录下操作 */ + unlink: AsyncAPI<{ + /** 要删除的文件路径, 必须以 ttfile://user 开头 */ + filePath: string; + }>; + /** 同步方法,删除文件,只能删除 用户目录(ttfile://user)下的文件 */ + unlinkSync: SyncAPI< + [ + /** 要删除的文件路径, 必须以 ttfile://user 开头 */ + filePath: string + ] + >; + /** 获取文件 Stats 对象 */ + stat: AsyncAPI< + { + /** 文件/目录路径 */ + path: string; + /** 是否递归获取目录下的每个文件的 Stat 信息 */ + recursive?: boolean; + }, + { + /** Stats 对象 */ + stat: Stat; + stats: Stat | { path: string; stat: Stat }[]; + } + >; + /** 同步获取文件 Stats 对象 */ + statSync: SyncAPI< + [ + /** 文件/目录路径 */ + path: string, + /** 是否递归获取目录下的每个文件的 Stat 信息 */ + recursive?: boolean + ], + Stat | { path: string; stat: Stat }[] + >; + /** 重命名文件,可以把文件从 oldPath 移动到 newPath */ + rename: AsyncAPI<{ + /** 源文件路径,可以是普通文件或目录,必须以 ttfile://user 开头 */ + oldPath: string; + /** 新文件路径,必须以 ttfile://user 开头 */ + newPath: string; + }>; + /** 同步方法,重命名文件,可以把文件从 oldPath 移动到 newPath */ + renameSync: SyncAPI< + [ + /** 源文件路径,可以是普通文件或目录,必须以 ttfile://user 开头 */ + oldPath: string, + /** 新文件路径,必须以 ttfile://user 开头 */ + newPath: string + ] + >; + /** 复制文件 */ + copyFile: AsyncAPI<{ + /** 源文件路径,只可以是普通文件 */ + srcPath: string; + /** 目标文件路径, 必须以 ttfile://user 开头 */ + destPath: string; + }>; + /** 同步方法,复制文件 */ + copyFileSync: SyncAPI< + [ + /** 源文件路径,只可以是普通文件 */ + srcPath: string, + /** 目标文件路径, 必须以 ttfile://user 开头 */ + destPath: string + ] + >; + /** 解压文件 */ + unzip: AsyncAPI<{ + /** 源文件路径,只可以是 zip 压缩文件 */ + zipFilePath: string; + /** 目标目录路径, 必须以 ttfile://user 开头 */ + targetPath: string; + }>; + /** 保存临时文件到用户目录, 用户目录以 ttfile://user 开头 */ + saveFileSync: SyncAPI< + [ + /** 文件临时路径 */ + tempFilePath: string, + /** 要存储的路径, 必须以 ttfile://user 开头 */ + filePath?: string + ], + string + >; + /** 保存临时文件到用户目录, 用户目录以 ttfile://user 开头 */ + saveFile: SaveFile; + /** 获取 临时目录(ttfile://tmep) 或 用户目录(ttfile://user) 下的文件信息 */ + getFileInfo: GetFileInfo; + /** 获取该小程序下用户目录文件列表, 用户目录以 ttfile://user 开头 */ + getSavedFileList: GetSavedFileList; + /** 删除该小程序下用户目录内的文件, 用户目录以 ttfile://user 开头 */ + removeSavedFile: RemoveSavedFile; + appendFile: AsyncAPI<{ + /** 目标文件位置 */ + filePath: string; + /** 追加内容数据 */ + data: string | ArrayBuffer; + /** 数据的编码格式 */ + encoding: encoding; + }>; + appendFileSync: SyncAPI< + [ + /** 目标文件位置 */ + filePath: string, + /** 追加内容数据 */ + data: string | ArrayBuffer, + /** 数据的编码格式 */ + encoding: encoding + ] + >; + truncate: AsyncAPI<{ + /** 目标文件路径 */ + filePath: string; + /** 截断位置 */ + length: number; + }>; + truncateSync: SyncAPI< + [ + /** 目标文件路径 */ + filePath: string, + /** 截断位置 */ + length: number + ] + >; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-connected-wifi.d.ts b/node_modules/@douyin-microapp/typings/api/get-connected-wifi.d.ts new file mode 100644 index 0000000..5a15286 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-connected-wifi.d.ts @@ -0,0 +1,37 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 获取设备当前所连的 WiFi 信息 + */ +export const getConnectedWifi: AsyncAPI< + {}, + { + /** Wi-Fi 的 SSID */ + SSID: string; + /** Wi-Fi 的 BSSID */ + BSSID: string; + /** Wi-Fi 是否安全(iOS 由于系统原因暂不支持) */ + secure: boolean; + /** Wi-Fi 信号强度(iOS 由于系统原因暂不支持) */ + signalStrength: number; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-custom-button-bounding-client-rect.d.ts b/node_modules/@douyin-microapp/typings/api/get-custom-button-bounding-client-rect.d.ts new file mode 100644 index 0000000..ad54235 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-custom-button-bounding-client-rect.d.ts @@ -0,0 +1,57 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * 获取左上角logo/返回位置+ 右上角反馈+more+close布局位置信息。坐标信息以屏幕左上角为原点。 + */ +export const getCustomButtonBoundingClientRect: SyncAPI< + [], + { + leftIcon: { + /** 宽度 */ + width: number; // Integer + /** 高度 */ + height: number; // Integer + /** 顶部位置 */ + top: number; // Integer + /** 底部位置 */ + bottom: number; // Integer + /** 右侧位置 */ + right: number; // Integer + /** 左侧位置 */ + left: number; // Integer + }; + capsule: { + /** 宽度 */ + width: number; // Integer + /** 高度 */ + height: number; // Integer + /** 顶部位置 */ + top: number; // Integer + /** 底部位置 */ + bottom: number; // Integer + /** 右侧位置 */ + right: number; // Integer + /** 左侧位置 */ + left: number; // Integer + }; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-ext-config.d.ts b/node_modules/@douyin-microapp/typings/api/get-ext-config.d.ts new file mode 100644 index 0000000..8281044 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-ext-config.d.ts @@ -0,0 +1,35 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI, SyncAPI } from "./types"; + +/** + * ### 获取第三方平台自定义的数据字段 + */ +export const getExtConfig: AsyncAPI< + {}, + { + extConfig: Record; + } +>; + +/** + * ### 获取第三方平台自定义的数据字段 + */ +export const getExtConfigSync: SyncAPI<[], Record>; diff --git a/node_modules/@douyin-microapp/typings/api/get-image-info.d.ts b/node_modules/@douyin-microapp/typings/api/get-image-info.d.ts new file mode 100644 index 0000000..ebaf82f --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-image-info.d.ts @@ -0,0 +1,44 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 获取图片信息。 + * + * 如果要获取网络图片的信息,详见获取[网络图片](https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/api/media/picture/tt-get-image-info/#%E8%8E%B7%E5%8F%96%E7%BD%91%E7%BB%9C%E5%9B%BE%E7%89%87%E4%BF%A1%E6%81%AF)信息说明。 + */ +export const getImageInfo: AsyncAPI< + { + /** 图片地址 */ + src: string; + }, + { + /** 图片宽度(单位: px) */ + width: number; + /** 图片高度(单位: px) */ + height: number; + /** 图片格式 */ + type: string; + /** 返回图片的本地路径,若为网络图片则该 API 首先会下载图片再返回下载到本地后的临时路径 */ + path: string; + /** 拍照时设备方向 */ + orientation: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-launch-options-sync.d.ts b/node_modules/@douyin-microapp/typings/api/get-launch-options-sync.d.ts new file mode 100644 index 0000000..b68336a --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-launch-options-sync.d.ts @@ -0,0 +1,48 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * ### 获取小程序启动时的参数 + * + * 其值与 App.onLaunch 方法传入的参数一致,并且不会随着小程序使用而发生变化 + */ +export const getLaunchOptionsSync: SyncAPI< + [], + { + /** 小程序启动页面路径 */ + path: string; + /** 小程序启动场景值 */ + scene: string; + /** 小程序启动参数 */ + query: Record; + /** + * 来源信息 + * 从另一个小程序进入小程序时返回。否则返回 {} + */ + referrerInfo: Record; + /** + * 唤起小程序页面的来源方式 + * - 10 表示用户点击小程序入口 schema + * - 0 表示其它方式,比如前后台切换 + */ + showFrom?: 0 | 10; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-menu-button-layout.d.ts b/node_modules/@douyin-microapp/typings/api/get-menu-button-layout.d.ts new file mode 100644 index 0000000..32abcab --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-menu-button-layout.d.ts @@ -0,0 +1,62 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。 + */ +export const getMenuButtonBoundingClientRect: SyncAPI< + [], + { + /** 宽度,单位:px */ + width: number; + /** 高度,单位:px */ + height: number; + /** 上边界坐标,单位:px */ + top: number; + /** 右边界坐标,单位:px */ + right: number; + /** 左边界坐标,单位:px */ + left: number; + /** 下边界坐标,单位:px */ + bottom: number; + } +>; + +/** + * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。 + */ +export const getMenuButtonLayout: SyncAPI< + [], + { + /** 宽度,单位:px */ + width: number; + /** 高度,单位:px */ + height: number; + /** 上边界坐标,单位:px */ + top: number; + /** 右边界坐标,单位:px */ + right: number; + /** 左边界坐标,单位:px */ + left: number; + /** 下边界坐标,单位:px */ + bottom: number; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-microapp-info.d.ts b/node_modules/@douyin-microapp/typings/api/get-microapp-info.d.ts new file mode 100644 index 0000000..96eabb2 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-microapp-info.d.ts @@ -0,0 +1,32 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; +/** + * 申请退款 + */ +export const getMicroappInfo: AsyncAPI< + { + appId?: string; + }, + { + name: string; + corporateName: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-recorder-manager.d.ts b/node_modules/@douyin-microapp/typings/api/get-recorder-manager.d.ts new file mode 100644 index 0000000..de718d2 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-recorder-manager.d.ts @@ -0,0 +1,105 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * 获取全局唯一的录音管理器 + */ +export const getRecorderManager: SyncAPI<[], RecordManager>; + +interface RecordManager { + /** + * 开始录音 + */ + start: (params?: { + /** 录音自动完成时长,单位 ms, 默认值 60000 */ + duration?: number; + /** 采样率 默认值 8000 */ + sampleRate?: 8000 | 16000 | 44100; + /** 录音通道数,有效值可以是 1 或 2 */ + numberOfChannels?: 1 | 2; + /** 码率, 默认值 48000 */ + encodeBitRate?: number; + /** 帧大小,单位 KB。如果设置了值,那么每当录音内容达到帧大小时会通过 onFrameRecorded 返回内容 */ + frameSize?: number; + }) => void; + + /** + * 暂停录音 + */ + pause: () => void; + + /** + * 继续录音 + */ + resume: () => void; + + /** + * 停止录音 + */ + stop: () => void; + + /** + * 注册录音开始回调事件 + */ + onStart: (callback: () => void) => void; + + /** + * 注册录音暂停回调事件 + */ + onPause: (callback: () => void) => void; + + /** + * 注册录音继续回调事件 + */ + onResume: (callback: () => void) => void; + + /** + * 注册录音停止回调事件 + */ + onStop: ( + callback: (res: { + /** 录音文件的地址 */ + tempFilePath: string; + }) => void + ) => void; + + /** + * 注册监听已录制完指定帧大小的文件事件 + * + * 如果设置了 frameSize,则会回调此事件 + */ + onFrameRecorded: ( + callback: (res: { + /** 录音分片数据 */ + frameBuffer: ArrayBuffer; + /** 当前帧是否正常录音结束前的最后一帧 */ + isLastFrame: boolean; + }) => void + ) => void; + + /** 注册录音错误事件回调 */ + onError: ( + callback: (res: { + /** 错误消息 */ + errMsg: string; + }) => void + ) => void; +} diff --git a/node_modules/@douyin-microapp/typings/api/get-refund-order.d.ts b/node_modules/@douyin-microapp/typings/api/get-refund-order.d.ts new file mode 100644 index 0000000..f349a2d --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-refund-order.d.ts @@ -0,0 +1,51 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI, RefundStatus, StepStatus } from "./types"; + +export interface RefundItemInfo { + itemOrderId: string; + refundAmount: number; + userReservations: ReservationItem[]; +} + +interface ReservationItem { + userReserveIds: string[]; +} +/** + * 申请退款 + */ +export const getRefundOrder: AsyncAPI< + { + refundId: string; + outRefundNo: string; + }, + { + refundWay: string; + refundQuantity: number; + refundId: string; + refundReason: string; + refundTips: string; + refundAmount: number; + refundStatus: RefundStatus; + refundSteps: StepStatus[]; + itemOrderList: RefundItemInfo[]; + secretKey: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-shop-record-token.d.ts b/node_modules/@douyin-microapp/typings/api/get-shop-record-token.d.ts new file mode 100644 index 0000000..c24aca4 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-shop-record-token.d.ts @@ -0,0 +1,35 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI, RecordTokenType } from "./types"; +/** + * 白名单 API,小程序绑定的抖音小店的幂等 token + */ +export const getShopRecordToken: AsyncAPI< + { + shopId: string; + type: RecordTokenType; + }, + { + /** "getShopRecordToken:ok" */ + errMsg: string; + /** 幂等 token */ + recordToken: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-user-info.d.ts b/node_modules/@douyin-microapp/typings/api/get-user-info.d.ts new file mode 100644 index 0000000..943cc3a --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-user-info.d.ts @@ -0,0 +1,63 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +interface UserInfo { + /** 用户头像 */ + avatarUrl: string; + /** 用户名 */ + nickName: string; + /** 用户性别,0: 未知;1:男性;2:女性 */ + gender: number; + /** 用户城市 */ + city: string; + /** 用户省份 */ + province: string; + /** 用户国家 */ + country: string; + /** 用户语言,目前为空 */ + language: string; +} + +/** + * ### 获取已登录用户的基本信息或特殊信息 + * + * 首次使用的用户会弹出授权提示窗,若用户同意,则会返回用户的真实数据。 + */ +export const getUserInfo: AsyncAPI< + { + /** 是否需要返回敏感数据 */ + withCredentials?: boolean; + }, + { + /** "getUserInfo:ok" */ + errMsg: string; + /** userInfo 的 JSON 字符串形式 */ + rawData: string; + /** 用户信息 */ + userInfo: UserInfo; + /** 用于校验用户信息是否被篡改,请参考文档 */ + signature?: string; + /** 包括敏感信息(如 openId)在内的已加密用户数据,如需解密数据请参考文档 */ + encryptedData?: string; + /** 加密算法参数 */ + iv?: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/get-user-profile.d.ts b/node_modules/@douyin-microapp/typings/api/get-user-profile.d.ts new file mode 100644 index 0000000..3ab3b77 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/get-user-profile.d.ts @@ -0,0 +1,60 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +interface UserInfo { + /** 用户头像 */ + avatarUrl: string; + /** 用户名 */ + nickName: string; + /** 用户性别,0: 未知;1:男性;2:女性 */ + gender: number; + /** 用户城市 */ + city: string; + /** 用户省份 */ + province: string; + /** 用户国家 */ + country: string; + /** 用户语言,目前为空 */ + language: string; +} + +/** + * ### 获取已登录用户的基本信息 + * + * 页面产生点击事件后才可调用,每次调用都会弹出授权提示窗,若用户同意,则会返回用户的真实数据。 + */ +export const getUserProfile: AsyncAPI< + {}, + { + /** "getUserProfile:ok" */ + errMsg: string; + /** userInfo 的 JSON 字符串形式 */ + rawData: string; + /** 用户信息 */ + userInfo: UserInfo; + /** 用于校验用户信息是否被篡改,请参考文档 */ + signature: string; + /** 已加密用户数据,不包含 openId、unionId,如需解密数据请参考文档 */ + encryptedData: string; + /** 加密算法参数 */ + iv: string; + } +>; diff --git a/node_modules/@douyin-microapp/typings/api/inner-audio.d.ts b/node_modules/@douyin-microapp/typings/api/inner-audio.d.ts new file mode 100644 index 0000000..98d5792 --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/inner-audio.d.ts @@ -0,0 +1,99 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { SyncAPI } from "./types"; + +/** + * 创建并返回内部 audio 上下文 innerAudioContext 实例,通过它能够操作音频播放。 + */ +export const createInnerAudioContext: SyncAPI<[], InnerAudioContext>; + +interface InnerAudioContext { + /** 音频资源地址 */ + src: string; + /** 是否自动播放 */ + autoplay: boolean; + /** 是否自动循环 */ + loop: boolean; + /** 是否遵循系统静音开关,当此参数为 false 时,即使用户打开了静音开关,也能继续发出声音 */ + obeyMuteSwitch: boolean; + /** 当前音频总时长(单位 s),只有在当前有合法的 src 时返回,只读 */ + duration: number; + /** 当前音频进度(单位 s),只有在当前有合法的 src 时返回,只读 */ + currentTime: number; + /** 当前音频是否处于暂停状态,只读 */ + paused: boolean; + /** 当前音频已缓冲部分,单位百分比,仅保证当前播放时间点到此时间点内容已缓冲,只读 */ + buffered: number; + /** 当前音量,范围 0 ~ 1,只读 */ + volume: number; + /** 播放 */ + play: CallableFunction; + /** 暂停 */ + pause: CallableFunction; + /** 停止播放。停止后再次播放时从头开始播放 */ + stop: CallableFunction; + /** 销毁当前实例。销毁后该实例将不存在,如需播放需要再次创建 */ + destroy: CallableFunction; + /** 跳转到指定位置播放 */ + seek: ( + /** 跳转的时间(单位:s) */ + options: number + ) => void; + /** 监听音频进入可以播放状态,但不保证后面可以流畅播放 */ + onCanplay: (callback: () => void) => void; + /** 监听音频播放事件 */ + onPlay: (callback: () => void) => void; + /** 监听音频暂停事件 */ + onPause: (callback: () => void) => void; + /** 监听音频停止事件 */ + onStop: (callback: () => void) => void; + /** 监听自然播放结束事件 */ + onEnded: (callback: () => void) => void; + /** 监听音频进度更新事件 */ + onTimeUpdate: (callback: () => void) => void; + /** 监听音频播放错误事件 */ + onError: (callback: () => void) => void; + /** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发 */ + onWaiting: (callback: () => void) => void; + /** 监听音频开始进行 seek 操作的事件 */ + onSeeking: (callback: () => void) => void; + /** 监听音频完成 seek 操作的事件 */ + onSeeked: (callback: () => void) => void; + /** 取消监听音频进入可以播放状态 */ + offCanplay: (callback: () => void) => void; + /** 取消监听音频播放事件 */ + offPlay: (callback: () => void) => void; + /** 取消监听音频暂停事件 */ + offPause: (callback: () => void) => void; + /** 取消监听音频停止事件 */ + offStop: (callback: () => void) => void; + /** 取消监听自然播放结束事件 */ + offEnded: (callback: () => void) => void; + /** 取消监听音频进度更新事件 */ + offTimeUpdate: (callback: () => void) => void; + /** 取消监听音频播放错误事件 */ + offError: (callback: () => void) => void; + /** 取消监听等待事件 */ + offWaiting: (callback: () => void) => void; + /** 取消监听音频开始进行 seek 操作的事件 */ + offSeeking: (callback: () => void) => void; + /** 取消监听音频完成 seek 操作的事件 */ + offSeeked: (callback: () => void) => void; +} diff --git a/node_modules/@douyin-microapp/typings/api/interaction-bar.d.ts b/node_modules/@douyin-microapp/typings/api/interaction-bar.d.ts new file mode 100644 index 0000000..de71b2b --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/interaction-bar.d.ts @@ -0,0 +1,30 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * 隐藏互动组件 + */ +export const hideInteractionBar: AsyncAPI; + +/** + * 显示互动组件 + */ +export const showInteractionBar: AsyncAPI; diff --git a/node_modules/@douyin-microapp/typings/api/keyboard.d.ts b/node_modules/@douyin-microapp/typings/api/keyboard.d.ts new file mode 100644 index 0000000..f86451e --- /dev/null +++ b/node_modules/@douyin-microapp/typings/api/keyboard.d.ts @@ -0,0 +1,27 @@ +/*! ***************************************************************************** +Copyright (c) 2022 Bytedance, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*******************************************************************************/ + +import { AsyncAPI } from "./types"; + +/** + * ### 收起软键盘 + * + * 在``、`