@yuntower/yuntower-account-web-sdk 0.0.15 → 0.0.16

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/dist/index.d.ts CHANGED
@@ -32,11 +32,11 @@ declare class YunTowerAccountSDK {
32
32
  private setupMessageListener;
33
33
  /**
34
34
  * 弹窗授权模式
35
- * @param optionsOrCallback 配置(可选)或回调;传 { autoCloseOnFinish: false } 可关闭「成功/失败时自动关窗」
36
- * @param callback 授权回调(当第一个参数为 options 时必传)
35
+ * @param options 可选配置,如 { autoCloseOnFinish: false } 关闭成功/失败时自动关窗
36
+ * @param callback 授权回调
37
37
  * @returns 返回 { close },由接入方在需要时调用 close() 关闭授权窗口
38
38
  */
39
- window(optionsOrCallback?: WindowOptions | ((response: CallbackResponse) => void), callback?: (response: CallbackResponse) => void): WindowController;
39
+ window(options?: WindowOptions, callback?: (response: CallbackResponse) => void): WindowController;
40
40
  /**
41
41
  * 重定向授权模式
42
42
  * @param redirectUrl 授权完成后的重定向URL
package/dist/index.js CHANGED
@@ -108,18 +108,14 @@ class YunTowerAccountSDK {
108
108
  }
109
109
  /**
110
110
  * 弹窗授权模式
111
- * @param optionsOrCallback 配置(可选)或回调;传 { autoCloseOnFinish: false } 可关闭「成功/失败时自动关窗」
112
- * @param callback 授权回调(当第一个参数为 options 时必传)
111
+ * @param options 可选配置,如 { autoCloseOnFinish: false } 关闭成功/失败时自动关窗
112
+ * @param callback 授权回调
113
113
  * @returns 返回 { close },由接入方在需要时调用 close() 关闭授权窗口
114
114
  */
115
- window(optionsOrCallback, callback) {
116
- const options = optionsOrCallback && typeof optionsOrCallback === "object"
117
- ? optionsOrCallback
118
- : {};
119
- const userCallback = typeof optionsOrCallback === "function"
120
- ? optionsOrCallback
121
- : callback ?? (() => { });
122
- const autoCloseOnFinish = options.autoCloseOnFinish !== false;
115
+ window(options, callback) {
116
+ const opts = options ?? {};
117
+ const userCallback = callback ?? (() => { });
118
+ const autoCloseOnFinish = opts?.autoCloseOnFinish !== false;
123
119
  const authUrl = this.buildAuthUrl("window");
124
120
  const authWindow = window.open(authUrl, "_blank", "width=500,height=600");
125
121
  if (!authWindow) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yuntower/yuntower-account-web-sdk",
3
3
  "description": "YunTower Account Web SDK",
4
- "version": "0.0.15",
4
+ "version": "0.0.16",
5
5
  "private": false,
6
6
  "author": "yuntower",
7
7
  "license": "Apache-2.0",