{"id":32639338,"url":"https://github.com/valesdev/wechat-webview-bridge","last_synced_at":"2025-10-31T02:10:57.899Z","repository":{"id":57397584,"uuid":"175774098","full_name":"valesdev/wechat-webview-bridge","owner":"valesdev","description":"A substitute for the official WeChat JS-SDK library.","archived":false,"fork":false,"pushed_at":"2023-09-04T07:43:02.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-03T09:39:20.624Z","etag":null,"topics":["webview","wechat"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valesdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-15T07:54:09.000Z","updated_at":"2024-12-07T00:17:09.000Z","dependencies_parsed_at":"2022-08-31T15:11:27.942Z","dependency_job_id":null,"html_url":"https://github.com/valesdev/wechat-webview-bridge","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/valesdev/wechat-webview-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Fwechat-webview-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Fwechat-webview-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Fwechat-webview-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Fwechat-webview-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valesdev","download_url":"https://codeload.github.com/valesdev/wechat-webview-bridge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Fwechat-webview-bridge/sbom","scorecard":{"id":915137,"data":{"date":"2025-08-11","repo":{"name":"github.com/valesdev/wechat-webview-bridge","commit":"9fbe80e236e58c0b2858dcbd50ef35bd68c0f8d4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/5 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T20:41:12.632Z","repository_id":57397584,"created_at":"2025-08-24T20:41:12.635Z","updated_at":"2025-08-24T20:41:12.635Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281914569,"owners_count":26583084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-31T02:00:07.401Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["webview","wechat"],"created_at":"2025-10-31T02:10:55.357Z","updated_at":"2025-10-31T02:10:57.889Z","avatar_url":"https://github.com/valesdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wechat-webview-bridge\n\n[![Version](https://img.shields.io/npm/v/wechat-webview-bridge.svg)](https://www.npmjs.com/package/wechat-webview-bridge)\n[![Downloads](https://img.shields.io/npm/dm/wechat-webview-bridge.svg)](https://npmcharts.com/compare/wechat-webview-bridge?minimal=true)\n[![License](https://img.shields.io/npm/l/wechat-webview-bridge.svg)](https://www.npmjs.com/package/wechat-webview-bridge)\n\nA substitute for the official WeChat JS-SDK library, rewritten from `https://res.wx.qq.com/open/js/jweixin-1.6.0.js`.\n\n## Quick Start\n\n```ts\nimport axios from 'axios'\nimport WeChatWebViewBridge, { type ConfigData } from 'wechat-webview-bridge'\n\n/**\n * Function to request WeChat JS-SDK configuration parameters.\n *\n * @var Function\n */\nconst configHandler = async function ({ url }: { url: string }): ConfigData {\n  return axios.post('/url/to/wechat-jssdk-config', { url })\n    .then(res =\u003e {\n      return {\n        appId: res.appId,\n        timestamp: res.timestamp,\n        nonceStr: res.nonceStr,\n        signature: res.signature\n      }\n    })\n}\n\n/**\n * List of WeChat JS-SDK API you want to grant.\n *\n * @var Array\n */\nconst jsApiList = [\n  'menu:share:timeline',\n  'menu:share:appmessage',\n  'imagePreview',\n  'hideMenuItems',\n  'showMenuItems',\n  'scanQRCode',\n  'getBrandWCPayRequest'\n]\n\n/**\n * List of WeChat Open Tag you want to grant.\n *\n * @var Array\n */\nconst openTagList = [\n  'wx-open-launch-app'\n]\n\n/**\n * The bridge instance.\n *\n * @var WeChatWebViewBridge\n */\nconst bridge = new WeChatWebViewBridge({\n  configHandler,\n  jsApiList,\n  openTagList,\n  debug: true\n})\n\n// wait for WebView bridge initialized\nawait bridge.load()\n  .then(() =\u003e bridge.config())\n  .then(() =\u003e {\n    // example: listen on WeChat Timeline Share event\n    return bridge.on('menu:share:timeline', () =\u003e {\n      // invoke registration of sharing\n      bridge.invoke('shareTimeline', {\n        title: 'The Title Goes Here',\n        desc: 'The description goes here',\n        img_url: 'https://www.example.com/image.jpeg',\n        link: window.location.href,\n        type: 'link',\n        data_url: ''\n      })\n        .then(data =\u003e {\n          // successfully shared\n        })\n        .catch(error =\u003e {\n          if (error.message === 'cancel') {\n            // user cancelled\n            return\n          }\n          // any other reasons\n        })\n    })\n  })\n  .then(() =\u003e {\n    // example: invoke hiding custom menu items\n    return bridge.invoke('hideMenuItems', {\n      menuList: [\n        'menuItem:share:facebook'\n      ]\n    })\n  })\n```\n\n## API\n\n### `new WeChatWebViewBridge(\u003coptions\u003e)`\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `options.configHandler` | ({ url } : { url: string }) =\u003e ConfigData | Function to request WeChat JS-SDK configuration parameters. It should return a Promise and resolves with an object contains WeChat configuration parameters (`appId`, `timestamp`, `nonceStr` and `signature`). | (required) |\n| `options.jsApiList` | Array\u0026lt;string\u0026gt; | List of WeChat JS-SDK API names you want to grant. | `[]` |\n| `options.openTagList` | Array\u0026lt;string\u0026gt; | List of WeChat Open Tag you want to grant. | `[]` |\n| `options.debug` | boolean | Enable console debug output. | `false` |\n\n### `bridge.load()`\n\nAsynchronously wait for WebView bridge initialized. The returned Promise will be resolved once the bridge is ready to config.\n\n- Parameters: (none)\n- Returns: `Promise\u003cvoid\u003e`\n\n### `bridge.config()`\n\nGet configuration parameters from provided `configHandler` function and then pass to `preVerifyJSAPI` handler immediately. The returned Promise will be resolved once the bridge is ready to use.\n\n- Parameters: (none)\n- Returns: `Promise\u003cany\u003e`\n\n### `bridge.invoke(\u003chanderName\u003e, [params])`\n\nInvoke WebView bridge handler. (see below for the complete handler list)\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `handerName` | string | The name of handler to be called. | (required) |\n| `params` | object | Parameters passed to WeChat WebView bridge. | `{}` |\n\n- Returns: `Promise\u003cany\u003e`\n\n### `bridge.on(\u003chandlerName\u003e, \u003clistener\u003e)`\n\nListen on WebView bridge event. (see below for the complete handler list)\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `handlerName` | string | The name of event to be listened on. | (required) |\n| `listener` | function | The callback for WeChat WebView bridge response. | (required) |\n\n- Returns: `Promise\u003cvoid\u003e`\n\n### `bridge.urlToConfig`\n\nGet the trimmed URL at the moment for WeChat WebView to configure.\n\n- Returns: `string`\n\n### `bridge.configData`\n\nGet WeChat WebView bridge configuration data. The data will be fulfilled after a successful `configHandler` call.\n\n- Returns: `object`\n\n### `bridge.ready`\n\nGet whether WeChat WebView bridge was successfully configured before.\n\n- Returns: `boolean`\n\n### `WeChatWebViewBridge.isIOS`\n\nWhether we are in an iOS device.\n\n- Returns: `boolean`\n\n### `WeChatWebViewBridge.isAndroid`\n\nWhether we are in an Android device.\n\n- Returns: `boolean`\n\n### `WeChatWebViewBridge.isWeChat`\n\nWhether we are in a WeChat WebView.\n\n- Returns: `boolean`\n\n### `WeChatWebViewBridge.isWeChatBrowser`\n\nWhether we are in a WeChat Browser.\n\n- Returns: `boolean`\n\n### `WeChatWebViewBridge.isWeChatMiniProgram`\n\nWhether we are in a WeChat Mini Program.\n\n- Returns: `boolean`\n\n### `WeChatWebViewBridge.isWeChatDevTools`\n\nWhether we are in a WeChat Dev Tools.\n\n- Returns: `boolean`\n\n## Handlers for JS calling WebView Bridge\n\n| Handler Name                  | Parameters | Official Description |\n| ----------------------------- | --- | --- |\n| `preVerifyJSAPI`              | `verifyJsApiList`, `verifyOpenTagList` | 注入权限验证配置 |\n| `checkJsApi`                  | `jsApiList` | 判断当前客户端版本是否支持指定 JS 接口 |\n| `shareTimeline`               | `title`, `desc`, `img_url`, `link`, `type`, `data_url` | (unknown) |\n| `sendAppMessage`              | `title`, `desc`, `link`, `img_url`, `type`, `data_url` | (unknown) |\n| `shareQQ`                     | `title`, `desc`, `img_url`, `link` | (unknown) |\n| `shareWeiboApp`               | `title`, `desc`, `img_url`, `link` | (unknown) |\n| `shareQZone`                  | `title`, `desc`, `img_url`, `link` | (unknown) |\n| `updateTimelineShareData`     | `title`, `link`, `imgUrl` | 自定义“分享到朋友圈”及“分享到QQ空间”按钮的分享内容 |\n| `updateAppMessageShareData`   | `title`, `desc`, `link`, `imgUrl` | 自定义“分享给朋友”及“分享到QQ”按钮的分享内容 |\n| `startRecord`                 | (none) | 开始录音接口 |\n| `stopRecord`                  | (none) | 停止录音接口 |\n| `playVoice`                   | `localId` | 播放语音接口 |\n| `pauseVoice`                  | `localId` | 暂停播放接口 |\n| `stopVoice`                   | `localId` | 停止播放接口 |\n| `uploadVoice`                 | `localId`, `isShowProgressTips` | 上传语音接口 |\n| `downloadVoice`               | `serverId`, `isShowProgressTips` | 下载语音接口 |\n| `translateVoice`              | `localId`, `isShowProgressTips` | 识别音频并返回识别结果接口 |\n| `chooseImage`                 | `count`, `sizeType`, `sourceType` | 拍照或从手机相册中选图接口 |\n| `imagePreview`                | `current`, `urls` | 预览图片接口 |\n| `uploadImage`                 | `localId`, `isShowProgressTips` | 上传图片接口 |\n| `downloadImage`               | `serverId`, `isShowProgressTips` | 下载图片接口 |\n| `getLocalImgData`             | `localId` | 获取本地图片接口 |\n| `getNetworkType`              | (none) | 获取网络状态接口 |\n| `openLocation`                | `latitude`, `longitude`, `name`, `address`, `scale`, `infoUrl` | 使用微信内置地图查看位置接口 |\n| `geoLocation`                 | (none) | 获取地理位置接口 |\n| `hideOptionMenu`              | (none) | (unknown) |\n| `showOptionMenu`              | (none) | (unknown) |\n| `closeWindow`                 | (none) | 关闭当前网页窗口接口 |\n| `hideMenuItems`               | `menuList` | 批量隐藏功能按钮接口 |\n| `showMenuItems`               | `menuList` | 批量显示功能按钮接口 |\n| `hideAllNonBaseMenuItem`      | (none) | 隐藏所有非基础按钮接口 |\n| `showAllNonBaseMenuItem`      | (none) | 显示所有功能按钮接口 |\n| `scanQRCode`                  | `needResult`, `scanType` | 调起微信扫一扫接口 |\n| `editAddress`                 | (none) | 共享收货地址接口 |\n| `openProductViewWithPid`      | `pid`, `view_type`, `ext_info` | 跳转微信商品页接口 |\n| `batchAddCard`                | `card_list` | 批量添加卡券接口 |\n| `chooseCard`                  | `app_id`, `location_id`, `sign_type`, `card_id`, `card_type`, `card_sign`, `time_stamp`, `nonce_str` | 拉取适用卡券列表并获取用户选择信息 |\n| `batchViewCard`               | `card_list` | 查看微信卡包中的卡券接口 |\n| `consumedShareCard`           | `consumedCardId`, `consumedCode` | (unknown) |\n| `getBrandWCPayRequest`        | `timestamp`, `nonceStr`, `package`, `paySign`, `signType` | 发起一个微信支付请求 |\n| `getRecevieBizHongBaoRequest` | `timestamp`, `nonceStr`, `package`, `paySign`, `signType` | (unknown) |\n| `startMonitoringBeacons`      | `ticket` | 开启查找周边 ibeacon 设备接口 |\n| `stopMonitoringBeacons`       | (none) | 关闭查找周边 ibeacon 设备接口 |\n| `openEnterpriseChat`          | `useridlist`, `chatname` | (unknown) |\n| `launchMiniProgram`           | `targetAppId`, `path`, `envVersion` | 打开小程序 |\n| `openBusinessView`            | `businessType`, `queryString`, `envVersion` | (unknown) |\n| `invokeMiniProgramAPI`        | `name`, `arg` | (unknown) |\n\n## Handlers for JS listening on WebView Bridge\n\n| Handler Name            | Official Description |\n| ----------------------- | --- |\n| `menu:share:timeline`   | 监听“分享到朋友圈”按钮点击 |\n| `menu:share:appmessage` | 监听“分享给朋友”按钮点击 |\n| `menu:share:qq`         | 监听“分享到 QQ”按钮点击 |\n| `menu:share:weiboApp`   | 监听“分享到腾讯微博”按钮点击 |\n| `menu:share:QZone`      | 监听“分享到 QQ 空间”按钮点击 |\n| `onVoiceRecordEnd`      | 监听录音自动停止接口 |\n| `onVoicePlayEnd`        | 监听语音播放完毕接口 |\n| `onBeaconsInRange`      | 监听周边 ibeacon 设备接口 |\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalesdev%2Fwechat-webview-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalesdev%2Fwechat-webview-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalesdev%2Fwechat-webview-bridge/lists"}