Skip to content

Commit

Permalink
feat: 添加openTagList配置
Browse files Browse the repository at this point in the history
  • Loading branch information
wtto00 committed Jan 2, 2024
1 parent 91c8543 commit b0c3a15
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
15 changes: 15 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"semanticCommits": "enabled",
"schedule": ["every weekend"],
"packageRules": [
{
"updateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"depTypeList": ["devDependencies"],
"automerge": true
}
],
"extends": ["config:base"]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"typescript.tsdk": "node_modules/typescript/lib"
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ const configData: WX.ConfigOptions = {
timestamp: '',
nonceStr: '',
signature: '',
jsApiList: [] // WX.JsApi[]
jsApiList: [], // WX.JsApi[]
openTagList: [] // WX.OpenTag[]
}
weixin.config(configData)
```
Expand Down
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "nodenext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"checkJs": true,
Expand Down
23 changes: 23 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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端时才会打印。
Expand All @@ -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[]
}

/**
Expand Down Expand Up @@ -1541,3 +1555,12 @@ interface Window {
*/
__wxjs_environment?: 'miniprogram'
}

interface GlobalEventHandlersEventMap {
/**
* 对于符合微信或系统最低版本要求但仍无法使用微信开放标签的场景,
* 将会在下方使用步骤中的wx.config权限验证成功后触发WeixinOpenTagsError事件告知开发者。
* 仅无法使用微信开发标签,JS-SDK其他功能不受影响。
*/
WeixinOpenTagsError: CustomEvent<{ errMsg?: string }>
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit b0c3a15

Please sign in to comment.