Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 添加openTagList配置 #19

Merged
merged 4 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 24 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ declare module WX {
| 'menuItem:share:email'
| 'menuItem:share:brand'

/**
* config注入的开放标签
* 微信开放标签有最低的微信版本要求、最低的系统版本要求,以及最低的JS接口文件版本要求。
* - 微信版本要求为:7.0.12及以上
* - 系统版本要求为:iOS 10.3及以上、Android 5.0及以上
* - JS接口文件:1.6.0及以上
* @link https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html
*/
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 +143,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 +1556,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
Loading