@hairy/wechat-jssdk 1.46.0 → 1.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -21
- package/README.md +66 -66
- package/dist/index.cjs +235 -269
- package/dist/index.d.cts +117 -0
- package/dist/index.d.mts +117 -0
- package/dist/index.mjs +242 -0
- package/package.json +18 -21
- package/dist/index.d.ts +0 -114
- package/dist/index.global.js +0 -253
- package/dist/index.js +0 -250
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-PRESENT Hairyf <https://github.com/antfu>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-PRESENT Hairyf <https://github.com/antfu>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
# @hairy/wechat-jssdk
|
|
2
|
-
|
|
3
|
-
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
-
[![bundle][bundle-src]][bundle-href]
|
|
6
|
-
[![JSDocs][jsdocs-src]][jsdocs-href]
|
|
7
|
-
[![License][license-src]][license-href]
|
|
8
|
-
|
|
9
|
-
WechatJssdk 构造函数对 [wechat-jssdk](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html) 的 `api` 进行了 `promise` 处理,并且可直接调用,不需要执行 `wx.ready` 等待 `jssdk` 授权完毕。
|
|
10
|
-
|
|
11
|
-
初始化不需要执行 `wx.config`,内部会根据传入的 `config request`,请求签名并自动调用 `wx.config`。
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
ni @hairy/wechat-jssdk
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## CDN
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<script src="https://unpkg.com/@hairy/wechat-jssdk"></script>
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
```ts
|
|
27
|
-
import { WechatJssdk } from '@hairy/wechat-jssdk'
|
|
28
|
-
|
|
29
|
-
export const wxJssdk = new WechatJssdk({
|
|
30
|
-
requestConfig: async () => {
|
|
31
|
-
return {
|
|
32
|
-
appId: '...',
|
|
33
|
-
jsApiList: ['onMenuShareAppMessage'],
|
|
34
|
-
nonceStr: '...',
|
|
35
|
-
signature: '...',
|
|
36
|
-
timestamp: 13_123
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
await wxJssdk.updateAppMessageShareData({
|
|
42
|
-
title: '...',
|
|
43
|
-
desc: '...',
|
|
44
|
-
link: '...',
|
|
45
|
-
imgUrl: '...'
|
|
46
|
-
})
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
> api 与 [wechat-jssdk](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html) 保持一致。
|
|
50
|
-
|
|
51
|
-
## License
|
|
52
|
-
|
|
53
|
-
[MIT](./LICENSE) License © [Hairyf](https://github.com/hairyf)
|
|
54
|
-
|
|
55
|
-
<!-- Badges -->
|
|
56
|
-
|
|
57
|
-
[npm-version-src]: https://img.shields.io/npm/v/@hairy/wechat-jssdk?style=flat&colorA=080f12&colorB=1fa669
|
|
58
|
-
[npm-version-href]: https://npmjs.com/package/@hairy/wechat-jssdk
|
|
59
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/@hairy/wechat-jssdk?style=flat&colorA=080f12&colorB=1fa669
|
|
60
|
-
[npm-downloads-href]: https://npmjs.com/package/@hairy/wechat-jssdk
|
|
61
|
-
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@hairy/wechat-jssdk?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
|
62
|
-
[bundle-href]: https://bundlephobia.com/result?p=@hairy/wechat-jssdk
|
|
63
|
-
[license-src]: https://img.shields.io/github/license/hairyf/hairylib.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
64
|
-
[license-href]: https://github.com/hairyf/hairylib/blob/main/LICENSE
|
|
65
|
-
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
66
|
-
[jsdocs-href]: https://www.jsdocs.io/package/@hairy/wechat-jssdk
|
|
1
|
+
# @hairy/wechat-jssdk
|
|
2
|
+
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![bundle][bundle-src]][bundle-href]
|
|
6
|
+
[![JSDocs][jsdocs-src]][jsdocs-href]
|
|
7
|
+
[![License][license-src]][license-href]
|
|
8
|
+
|
|
9
|
+
WechatJssdk 构造函数对 [wechat-jssdk](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html) 的 `api` 进行了 `promise` 处理,并且可直接调用,不需要执行 `wx.ready` 等待 `jssdk` 授权完毕。
|
|
10
|
+
|
|
11
|
+
初始化不需要执行 `wx.config`,内部会根据传入的 `config request`,请求签名并自动调用 `wx.config`。
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
ni @hairy/wechat-jssdk
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## CDN
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<script src="https://unpkg.com/@hairy/wechat-jssdk"></script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
```ts
|
|
27
|
+
import { WechatJssdk } from '@hairy/wechat-jssdk'
|
|
28
|
+
|
|
29
|
+
export const wxJssdk = new WechatJssdk({
|
|
30
|
+
requestConfig: async () => {
|
|
31
|
+
return {
|
|
32
|
+
appId: '...',
|
|
33
|
+
jsApiList: ['onMenuShareAppMessage'],
|
|
34
|
+
nonceStr: '...',
|
|
35
|
+
signature: '...',
|
|
36
|
+
timestamp: 13_123
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
await wxJssdk.updateAppMessageShareData({
|
|
42
|
+
title: '...',
|
|
43
|
+
desc: '...',
|
|
44
|
+
link: '...',
|
|
45
|
+
imgUrl: '...'
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> api 与 [wechat-jssdk](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html) 保持一致。
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
[MIT](./LICENSE) License © [Hairyf](https://github.com/hairyf)
|
|
54
|
+
|
|
55
|
+
<!-- Badges -->
|
|
56
|
+
|
|
57
|
+
[npm-version-src]: https://img.shields.io/npm/v/@hairy/wechat-jssdk?style=flat&colorA=080f12&colorB=1fa669
|
|
58
|
+
[npm-version-href]: https://npmjs.com/package/@hairy/wechat-jssdk
|
|
59
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@hairy/wechat-jssdk?style=flat&colorA=080f12&colorB=1fa669
|
|
60
|
+
[npm-downloads-href]: https://npmjs.com/package/@hairy/wechat-jssdk
|
|
61
|
+
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@hairy/wechat-jssdk?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
|
62
|
+
[bundle-href]: https://bundlephobia.com/result?p=@hairy/wechat-jssdk
|
|
63
|
+
[license-src]: https://img.shields.io/github/license/hairyf/hairylib.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
64
|
+
[license-href]: https://github.com/hairyf/hairylib/blob/main/LICENSE
|
|
65
|
+
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
66
|
+
[jsdocs-href]: https://www.jsdocs.io/package/@hairy/wechat-jssdk
|