@seayoo-web/gamer-api 2.0.10 → 2.0.12

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/README.md CHANGED
@@ -78,7 +78,7 @@ export function login() {
78
78
  if(!idToken) {
79
79
  return
80
80
  }
81
- // 获取 weixinToken,成功时返回 { weixin_token, openid, unionid }
81
+ // 获取 weixinToken,成功时返回 { weixin_token, open_id, union_id }
82
82
  const result = await weixinApi.login();
83
83
  if(!("weixin_token" in result)) {
84
84
  return
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ async function we() {
18
18
  const { promise: i, resolve: t } = pe();
19
19
  return wx.login({
20
20
  success(n) {
21
- t(n);
21
+ t(n.code);
22
22
  },
23
23
  fail() {
24
24
  t("");
@@ -1870,7 +1870,7 @@ const pr = o({
1870
1870
  });
1871
1871
  var _r = /* @__PURE__ */ ((i) => (i.RedirectUriDisMatch = "10003", i.AppidError = "10016", i.AuthorizationError = "10015", i.NoRightForScope = "10005", i.Frequently = "10009", i.AppBanded = "10004", i.ShouldFollow = "10006", i.ScopeNull = "10010", i.RedirectUriNull = "10011", i.AppidNull = "10012", i.StateNull = "10013", i))(_r || {});
1872
1872
  function S(i) {
1873
- return v(i, "openid", "unionid", "weixin_token");
1873
+ return v(i, "open_id", "union_id", "weixin_token");
1874
1874
  }
1875
1875
  const H = "wx_login_cache";
1876
1876
  class Pr {
@@ -1908,7 +1908,7 @@ class Pr {
1908
1908
  return S(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
1909
1909
  }
1910
1910
  /**
1911
- * 小程序页面微信静默登录,获取 weixinToken / openid / unionid
1911
+ * 小程序页面微信静默登录,获取 weixinToken / open_id / union_id
1912
1912
  *
1913
1913
  * 使用场景:
1914
1914
  *
@@ -1951,8 +1951,8 @@ class Pr {
1951
1951
  * - [微信网页开发 / 网页授权](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html)
1952
1952
  *
1953
1953
  * @param scope - 网页授权作用域
1954
- * - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 unionid 则需要 snsapi_userinfo
1955
- * - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、unionid、昵称、头像等信息,但用户也可能会拒绝授权
1954
+ * - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 union_id 则需要 snsapi_userinfo
1955
+ * - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
1956
1956
  */
1957
1957
  async webLogin(t = "snsapi_userinfo") {
1958
1958
  const n = L("code"), r = Date.now(), s = +L("state");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seayoo-web/gamer-api",
3
3
  "description": "agent for gamer api",
4
- "version": "2.0.10",
4
+ "version": "2.0.12",
5
5
  "type": "module",
6
6
  "source": "index.ts",
7
7
  "main": "./dist/index.js",
@@ -25,8 +25,8 @@
25
25
  "vitest": "^3.0.5",
26
26
  "@seayoo-web/combo-webview": "^2.5.3",
27
27
  "@seayoo-web/request": "^3.0.3",
28
- "@seayoo-web/scripts": "^2.0.1",
29
28
  "@seayoo-web/tsconfig": "^1.0.3",
29
+ "@seayoo-web/scripts": "^2.0.1",
30
30
  "@seayoo-web/utils": "^3.4.4"
31
31
  },
32
32
  "peerDependencies": {
@@ -29,7 +29,7 @@ export declare class WeixinApi {
29
29
  */
30
30
  getLoginCache(): Promise<import("./weixin.define").WeixinLoginResponse | null>;
31
31
  /**
32
- * 小程序页面微信静默登录,获取 weixinToken / openid / unionid
32
+ * 小程序页面微信静默登录,获取 weixinToken / open_id / union_id
33
33
  *
34
34
  * 使用场景:
35
35
  *
@@ -61,8 +61,8 @@ export declare class WeixinApi {
61
61
  * - [微信网页开发 / 网页授权](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html)
62
62
  *
63
63
  * @param scope - 网页授权作用域
64
- * - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 unionid 则需要 snsapi_userinfo
65
- * - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、unionid、昵称、头像等信息,但用户也可能会拒绝授权
64
+ * - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 union_id 则需要 snsapi_userinfo
65
+ * - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
66
66
  */
67
67
  webLogin(scope?: "snsapi_base" | "snsapi_userinfo"): Promise<import("./weixin.define").WeixinLoginResponse | {
68
68
  error: WeixinWebLoginErrorCode;
@@ -1,8 +1,8 @@
1
1
  export interface WeixinLoginResponse {
2
- /** 微信小程序下,用户的 openid */
3
- openid: string;
4
- /** 微信小程序所在的微信开放平台账号下,用户的 unionid */
5
- unionid: string;
2
+ /** 微信小程序下,用户的 open_id */
3
+ open_id: string;
4
+ /** 微信小程序所在的微信开放平台账号下,用户的 union_id */
5
+ union_id: string;
6
6
  /**
7
7
  * Gamer 为这个微信小程序用户签发的 Weixin Token。长期有效
8
8
  *