npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bnfe/wx-utils

v1.2.6

Published

wx-web

Downloads

10

Readme

@bnfe/wx-utils

这是一个集成wx和企微jssdk

安装

pnpm install @bnfe/wx-utils -S

引入

import wxSDK from "@bnfe/wx-utils";

使用

公众号

参考文档

公众号授权流程

开放平台授权流程

公众号JS-SDK

| 事件名称 | 说明 | 回调参数 | | :------------: | :--------------------------: | :--------: | | wxAuth | 发起公众号授权 | - | | thirdLogin | 开放平台代公众号发起网页授权 | - | | injectWxConfig | 微信注入权限验证配置 | 授权结果 |

/**
 * 发起公众号授权
 * @param {string} env 环境变量,可选值为 'dev' 或 'prod'
 * @param {string} appId 应用的appId
 * @param {string} scope 需要授权的范围,可选值为'snsapi_userinfo'或'snsapi_base',默认snsapi_base
 * @return
 */
wxSDK.wxAuth(env, appId, scope);
/**
 * 开放平台代公众号发起网页授权
 * @param {string} env 环境变量
 * @param {string} appId 应用的appId
 * @param {string} scope 需要授权的范围,可选值为'snsapi_userinfo'或'snsapi_base',默认snsapi_base
 * @return
 */
wxSDK.thirdLogin(env, appId, scope);
/**
 * 微信注入权限验证配置
 * @param {string} env 环境变量,可选值为 'dev' 或 'prod'
 * @param {string} appId 企微应用的appId
 * @param {string[]} jsApiList 需要注入的权限
 */
wxSDK.injectWxConfig(env, appId, jsApiList);

企业微信

参考文档

构造企业微信授权链接

企业微信JS-SDK

| 事件名称 | 说明 | 回调参数 | | :-------------------: | :------------------: | :----------: | | workWxAuth | 发起企业微信授权 | - | | getWorkWxUserId | 获取企业微信用户id | 企微用户id | | getWorkWxAuthLink | 获取企微授权链接 | 授权链接 | | injectWorkWxConfig | 企信注入权限验证配置 | 授权结果 | | getCurExternalContact | 获取外部联系人id | 外部联系人id |

/**
 * 发起企业微信授权
 * @param {string} env 环境变量,可选值为 'dev' 或 'prod'
 * @param {string} appId 企微的corpId
 * @param {string} agentId 企微应用的appId
 */
wxSDK.workWxAuth(env, appId, agentId);
/**
 * 企微授权获取企微用户id
 * @param {string} env 环境变量,可选值为 'dev' 或 'prod'
 * @param {string} appId 企微的corpId
 * @param {string} agentId 企微应用的appId
 */
wxSDK.getWorkWxUserId(env, appId, agentId);
/**
 * 企微授权链接(一般在设置应用主页、配置到聊天工具栏、消息推送时使用,可避免页面重复跳转)
 * @param {string} env 环境变量,可选值为 'dev' 或 'prod'
 * @param {string} appId 企微的corpId
 * @param {string} agentId 企微应用的appId
 */
wxSDK.getWorkWxAuthLink(env, appId, agentId);
/***
 * 企微注入
 * @param {string} env 环境变量,可选值为 'dev' 或 'prod'
 * @param {string} appId 企微corpId
 * @param {string} agentId 企微应用的id 例如:1000144
 * @param {string[]} jsApiList 需要注入的权限
 * @returns
 * */
wxSDK.injectWorkWxConfig(env, appId, agentId, jsApiList);
/**
 * 获取外部联系人id(getContext获取入口环境,getCurExternalContact获取外部联系人id)
 * 从某些入口进入页面时,可调用该接口获取当前客户的userid(也即external_userid),目前支持的入口有联系人详情页、外部单聊工具栏
 * @param {string} env 环境变量
 * @param {string} appId 企微corpId
 * @param {string} agentId 企微应用的id 例如:1000144
 * @returns
 * */
wxSDK.getCurExternalContact(env, appId, agentId);