@kbapp/js-bridge 0.4.5-alpha.0 → 0.4.6-alpha.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/README.MD CHANGED
@@ -76,7 +76,7 @@ defineComponents({
76
76
  | 枚举 | 说明 |
77
77
  | ------------- | ---------------- |
78
78
  | JSBridgeCode | kbapp 桥接状态码 |
79
- | AppLoginModel | 登录信息 model |
79
+ | AppBridgedUserInfo | 登录信息 model |
80
80
 
81
81
  ### 登录设计
82
82
 
@@ -101,7 +101,7 @@ const onTapSomeButton = decorateLogin(() => {
101
101
 
102
102
  #### 如果是某个组件/页面加载的时候就得登录才能正常操作
103
103
 
104
- 暂时没想好, 反正也是需要禁止无限制事件类型, 小程序情况下, 某个链接点击打开小程序, 然后关闭, 再重新点链接打开小程序, 页面生命周期是重复触发onMounted
104
+ 暂时没想好, 反正也是需要禁止无限制事件类型, 小程序情况下, 某个链接点击打开小程序, 然后关闭, 再重新点链接打开小程序, 页面生命周期是重复触发 onMounted
105
105
 
106
106
  其中最终的目的就是禁止出现监听登录成功事件无限累加, 曾经在这上面吃了不少的亏
107
107
 
@@ -310,8 +310,8 @@ if (await canIUse('sharePoster')) {
310
310
  | 参数 | 值类型 | 必填? | 说明 |
311
311
  | -------- | ------ | ----- | ---------- |
312
312
  | title | string | 必填 | 标题 |
313
- | content | string | 必填 | 内容 |
314
- | imgUrl | string | 必填 | 图片 |
313
+ | content | string | 选填 | 内容 |
314
+ | imageUrl | string | 必填 | 图片 |
315
315
  | url | string | 必填 | https 链接 |
316
316
  | tmuTrack | any | 选填 | 天目埋点 |
317
317
  | qqUrl | string | 选填 | 未知 |
@@ -333,26 +333,7 @@ if (await canIUse('sharePoster')) {
333
333
  #### 返回值
334
334
 
335
335
  ```js
336
- Promise<{
337
- /** 车牌号:例如浙A999999 */
338
- carNo: string
339
- /** 未知 */
340
- role: number
341
- /** 手机号 */
342
- mobile: string
343
- /** 性别 */
344
- sex: number
345
- /** 电台id */
346
- siteId: string
347
- /** 头像地址 */
348
- avatar: string
349
- /** token */
350
- token: string
351
- /** 用户id */
352
- userId: number
353
- /** 用户名 */
354
- userName: string
355
- } | null>
336
+ Promise<AppBridgedUserInfo | null>
356
337
 
357
338
  ```
358
339
 
@@ -369,26 +350,7 @@ Promise<{
369
350
  #### 返回值
370
351
 
371
352
  ```js
372
- Promise<{
373
- /** 车牌号:例如浙A999999 */
374
- carNo: string
375
- /** 未知 */
376
- role: number
377
- /** 手机号 */
378
- mobile: string
379
- /** 性别 */
380
- sex: number
381
- /** 电台id */
382
- siteId: string
383
- /** 头像地址 */
384
- avatar: string
385
- /** token */
386
- token: string
387
- /** 用户id */
388
- userId: number
389
- /** 用户名 */
390
- userName: string
391
- }>
353
+ Promise<AppBridgedUserInfo>
392
354
 
393
355
  ```
394
356
 
@@ -425,6 +387,36 @@ const handle = watchAppLoginSuccess(() => {
425
387
 
426
388
  ---
427
389
 
390
+ ### AppBridgedUserInfo
391
+
392
+ > 登录信息类型
393
+
394
+ ```js
395
+ Promise<{
396
+ /** 车牌号:例如浙A999999 */
397
+ carNo?: string
398
+ /** 未知 */
399
+ role?: number
400
+ /** 手机号 */
401
+ mobile: string
402
+ /** 性别 */
403
+ sex: number
404
+ /** 电台id */
405
+ siteId: number
406
+ /** 头像地址 */
407
+ avatar: string
408
+ /** token */
409
+ token: string
410
+ /** 用户id */
411
+ userId: number
412
+ /** 用户名 */
413
+ userName: string
414
+ }>
415
+
416
+ ```
417
+
418
+ ---
419
+
428
420
  ### JSBridgeCode
429
421
 
430
422
  > 错误码枚举
@@ -1,16 +1,8 @@
1
1
  /**
2
2
  *
3
- * @description 获取设备信息
4
- *
5
- * **示例代码**
6
- ```js
7
- import { getDeviceInfo } from '@kbapp/js-bridge';
8
-
9
- const deviceInfo = await getDeviceInfo()
10
- deviceInfo.vcode
11
- ```
3
+ * @description app本地设备信息
12
4
  */
13
- export declare const getDeviceInfo: () => Promise<{
5
+ export declare class AppDeviceInfo {
14
6
  /** 例如iOS */
15
7
  do: string;
16
8
  /** 例如iPhone11,2 */
@@ -21,10 +13,25 @@ export declare const getDeviceInfo: () => Promise<{
21
13
  vcode: number;
22
14
  /** 版本号.例如6.90.11 */
23
15
  v: string;
16
+ /** 未知 */
17
+ source: number;
24
18
  /** 电台id */
25
19
  siteId: number;
26
20
  /** 用户id.当登录时返回 */
27
21
  userId?: number;
28
22
  /** 未知 */
29
23
  cid: string;
30
- }>;
24
+ }
25
+ /**
26
+ *
27
+ * @description 获取设备信息
28
+ *
29
+ * **示例代码**
30
+ ```js
31
+ import { getDeviceInfo } from '@kbapp/js-bridge';
32
+
33
+ const deviceInfo = await getDeviceInfo()
34
+ deviceInfo.vcode
35
+ ```
36
+ */
37
+ export declare const getDeviceInfo: () => Promise<AppDeviceInfo>;
@@ -1,8 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDeviceInfo = void 0;
3
+ exports.getDeviceInfo = exports.AppDeviceInfo = void 0;
4
4
  var promise_cache_1 = require("../util/promise-cache");
5
5
  var core_1 = require("../core");
6
+ /**
7
+ *
8
+ * @description app本地设备信息
9
+ */
10
+ var AppDeviceInfo = /** @class */ (function () {
11
+ function AppDeviceInfo() {
12
+ }
13
+ return AppDeviceInfo;
14
+ }());
15
+ exports.AppDeviceInfo = AppDeviceInfo;
6
16
  /**
7
17
  *
8
18
  * @description 获取设备信息
@@ -9,7 +9,7 @@ import { defineShareModel } from '@kbapp/js-bridge';
9
9
  defineShareModel({
10
10
  title: '分享标题',
11
11
  content: '分享内容',
12
- imgUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png', // 分享图片
12
+ imageUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png', // 分享图片
13
13
  url: 'http://www.kaiba315.com.cn/' // 分享网页地址
14
14
  })
15
15
  ```
@@ -63,7 +63,7 @@ export declare function invokeShareModal(data: {
63
63
  /** 分享出去的标题 */
64
64
  title: string;
65
65
  /** 分享出去的正文内容 */
66
- content: string;
66
+ content?: string;
67
67
  /** 分享出去的封面图片 */
68
68
  imageUrl: string;
69
69
  }): void;
@@ -15,7 +15,7 @@ import { defineShareModel } from '@kbapp/js-bridge';
15
15
  defineShareModel({
16
16
  title: '分享标题',
17
17
  content: '分享内容',
18
- imgUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png', // 分享图片
18
+ imageUrl: 'https://static.kaiba315.com.cn/kaiba-logo.png', // 分享图片
19
19
  url: 'http://www.kaiba315.com.cn/' // 分享网页地址
20
20
  })
21
21
  ```
@@ -2,7 +2,7 @@
2
2
  *
3
3
  * @description 登录信息
4
4
  */
5
- export declare class AppLoginModel {
5
+ export declare class AppBridgedUserInfo {
6
6
  /** 车牌号:例如浙A999999 */
7
7
  carNo?: string;
8
8
  /** 未知 */
@@ -12,7 +12,7 @@ export declare class AppLoginModel {
12
12
  /** 性别 */
13
13
  sex: number;
14
14
  /** 电台id */
15
- siteId: string;
15
+ siteId: number;
16
16
  /** 头像地址 */
17
17
  avatar: string;
18
18
  /** token */
@@ -26,17 +26,17 @@ export declare class AppLoginModel {
26
26
  *
27
27
  * @description 获取用户登录信息.如果未登录返回null
28
28
  */
29
- export declare function getAppLoginInfo(): Promise<AppLoginModel | null>;
29
+ export declare function getAppLoginInfo(): Promise<AppBridgedUserInfo | null>;
30
30
  /**
31
31
  *
32
32
  * @description 触发登录
33
33
  * 如果已登录,将直接返回登录信息, 请通过 `watchAppLoginSuccess` 监听登录成功事件
34
34
  */
35
- export declare function triggerAppLogin(): Promise<AppLoginModel>;
35
+ export declare function triggerAppLogin(): Promise<AppBridgedUserInfo>;
36
36
  /**
37
37
  *
38
38
  * @description 注册监听app登录成功, 监听时候立刻执行检测一次, 注意,该函数仅读取登录信息, 不会触发登录
39
- * @param {(loginInfo: AppLoginModel) => void} callback 登录成功回调
39
+ * @param {(loginInfo: AppBridgedUserInfo) => void} callback 登录成功回调
40
40
  * @returns {() => void} 调用该函数取消监听
41
41
  *
42
42
  * **示例代码**
@@ -50,4 +50,4 @@ const handle = watchAppLoginSuccess(() => {
50
50
  // handle() 停止监听
51
51
  ```
52
52
  */
53
- export declare const watchAppLoginSuccess: (callback: (loginInfo: AppLoginModel) => void) => () => void;
53
+ export declare const watchAppLoginSuccess: (callback: (loginInfo: AppBridgedUserInfo) => void) => () => void;
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.watchAppLoginSuccess = exports.AppLoginModel = void 0;
39
+ exports.watchAppLoginSuccess = exports.AppBridgedUserInfo = void 0;
40
40
  exports.getAppLoginInfo = getAppLoginInfo;
41
41
  exports.triggerAppLogin = triggerAppLogin;
42
42
  var js_bridge_code_1 = require("./js-bridge-code");
@@ -45,12 +45,12 @@ var core_1 = require("../core");
45
45
  *
46
46
  * @description 登录信息
47
47
  */
48
- var AppLoginModel = /** @class */ (function () {
49
- function AppLoginModel() {
48
+ var AppBridgedUserInfo = /** @class */ (function () {
49
+ function AppBridgedUserInfo() {
50
50
  }
51
- return AppLoginModel;
51
+ return AppBridgedUserInfo;
52
52
  }());
53
- exports.AppLoginModel = AppLoginModel;
53
+ exports.AppBridgedUserInfo = AppBridgedUserInfo;
54
54
  /**
55
55
  *
56
56
  * @description 获取用户登录信息.如果未登录返回null
@@ -171,7 +171,7 @@ function triggerAppLogin() {
171
171
  /**
172
172
  *
173
173
  * @description 注册监听app登录成功, 监听时候立刻执行检测一次, 注意,该函数仅读取登录信息, 不会触发登录
174
- * @param {(loginInfo: AppLoginModel) => void} callback 登录成功回调
174
+ * @param {(loginInfo: AppBridgedUserInfo) => void} callback 登录成功回调
175
175
  * @returns {() => void} 调用该函数取消监听
176
176
  *
177
177
  * **示例代码**
package/package.json CHANGED
@@ -3,9 +3,9 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.5-alpha.0",
6
+ "version": "0.4.6-alpha.0",
7
7
  "description": "开吧客户端桥接",
8
8
  "main": "./dist/index.js",
9
9
  "author": "along",
10
- "gitHead": "1ae6636e6e5180193f58946cc75766872d786107"
10
+ "gitHead": "f06b59b1abcc7630357f087ee5e8cd31791ddf31"
11
11
  }