From b0c3a157ac1b5b91113023073a237b3e581a8594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= Date: Tue, 2 Jan 2024 17:05:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0openTagList=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/renovate.json | 15 +++++++++++++++ .vscode/settings.json | 3 ++- README.md | 3 ++- jsconfig.json | 2 +- lib/index.d.ts | 23 +++++++++++++++++++++++ package.json | 2 +- 6 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 .github/renovate.json diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..6738b5b --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,15 @@ +{ + "semanticCommits": "enabled", + "schedule": ["every weekend"], + "packageRules": [ + { + "updateTypes": ["minor", "patch", "pin", "digest"], + "automerge": true + }, + { + "depTypeList": ["devDependencies"], + "automerge": true + } + ], + "extends": ["config:base"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 8ce4949..8c5c2b4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" - } + }, + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/README.md b/README.md index 1efdbaf..ca39500 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ const configData: WX.ConfigOptions = { timestamp: '', nonceStr: '', signature: '', - jsApiList: [] // WX.JsApi[] + jsApiList: [], // WX.JsApi[] + openTagList: [] // WX.OpenTag[] } weixin.config(configData) ``` diff --git a/jsconfig.json b/jsconfig.json index 61cba29..7da90e4 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "esnext", "module": "esnext", - "moduleResolution": "nodenext", + "moduleResolution": "node", "allowSyntheticDefaultImports": true, "jsx": "preserve", "checkJs": true, diff --git a/lib/index.d.ts b/lib/index.d.ts index bd27e21..1f8af11 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -107,6 +107,15 @@ declare module WX { | 'menuItem:share:email' | 'menuItem:share:brand' + /** + * config注入的开放标签 + * 微信开放标签有最低的微信版本要求、最低的系统版本要求,以及最低的JS接口文件版本要求。 + * - 微信版本要求为:7.0.12及以上 + * - 系统版本要求为:iOS 10.3及以上、Android 5.0及以上 + * - JS接口文件:1.6.0及以上 + */ + type OpenTag = 'wx-open-launch-weapp' | 'wx-open-launch-app' | 'wx-open-subscribe' | 'wx-open-audio' + interface ConfigOptions { /** * 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 @@ -133,6 +142,11 @@ declare module WX { * 详情见[附录2](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#63) */ jsApiList: JsApi[] + /** + * 需要使用的开放标签列表 + * @example ['wx-open-launch-app'] + */ + openTagList?: OpenTag[] } /** @@ -1541,3 +1555,12 @@ interface Window { */ __wxjs_environment?: 'miniprogram' } + +interface GlobalEventHandlersEventMap { + /** + * 对于符合微信或系统最低版本要求但仍无法使用微信开放标签的场景, + * 将会在下方使用步骤中的wx.config权限验证成功后触发WeixinOpenTagsError事件告知开发者。 + * 仅无法使用微信开发标签,JS-SDK其他功能不受影响。 + */ + WeixinOpenTagsError: CustomEvent<{ errMsg?: string }> +} diff --git a/package.json b/package.json index 4bc795b..3707a12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wtto00/jweixin-esm", - "version": "1.6.0-4", + "version": "1.6.0-5", "description": "微信JSSDK ESM模块 附带TS类型以及详细注释", "type": "module", "module": "./lib/jweixin-1.6.0.esm.js",