@kbapp/js-bridge 1.0.5-alpha.0 → 1.0.7-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.
Files changed (59) hide show
  1. package/{README.MD → README.md} +1 -1
  2. package/dist/es/core/index.js +73 -0
  3. package/dist/es/core/lib/flutter-ds-bridge.js +93 -0
  4. package/dist/es/index.js +59 -0
  5. package/dist/es/lib/app-version-support.js +18 -0
  6. package/dist/es/lib/bridge-code.js +22 -0
  7. package/dist/es/lib/check-for-new-version.js +14 -0
  8. package/dist/es/lib/close-webview.js +14 -0
  9. package/dist/es/lib/define-permission-usage.js +15 -0
  10. package/dist/es/lib/env.js +4 -0
  11. package/dist/es/lib/generate-kb-sign.js +16 -0
  12. package/dist/es/lib/get-app-base-info.js +19 -0
  13. package/dist/es/lib/open-post-editor.js +46 -0
  14. package/dist/es/lib/report-da-event.js +23 -0
  15. package/dist/es/lib/run-action.js +14 -0
  16. package/dist/es/lib/save-image-to-local.js +16 -0
  17. package/dist/es/lib/save-video-to-local.js +16 -0
  18. package/dist/es/lib/scan-qr-code.js +12 -0
  19. package/dist/es/lib/screen-orientation.js +16 -0
  20. package/dist/es/lib/set-webview-title.js +16 -0
  21. package/dist/es/lib/share-image.js +16 -0
  22. package/dist/es/lib/share-model.js +45 -0
  23. package/dist/es/lib/subscribe-notify.js +19 -0
  24. package/dist/es/lib/trigger-login.js +60 -0
  25. package/dist/es/utils/filter-undefined-properties.js +12 -0
  26. package/dist/es/utils/promise-cache.js +11 -0
  27. package/dist/es/utils/wrap-async.js +21 -0
  28. package/dist/{core → types/core}/index.d.ts +1 -1
  29. package/dist/umd/index.js +1 -0
  30. package/examples/index.html +2 -2
  31. package/package.json +13 -5
  32. package/dist/core/lib/flutter-ds-bridge.d.ts +0 -7
  33. package/dist/index.es.js +0 -519
  34. package/dist/index.umd.js +0 -1
  35. package/vite.config.ts +0 -32
  36. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  37. /package/dist/{lib → types/lib}/app-version-support.d.ts +0 -0
  38. /package/dist/{lib → types/lib}/bridge-code.d.ts +0 -0
  39. /package/dist/{lib → types/lib}/check-for-new-version.d.ts +0 -0
  40. /package/dist/{lib → types/lib}/close-webview.d.ts +0 -0
  41. /package/dist/{lib → types/lib}/define-permission-usage.d.ts +0 -0
  42. /package/dist/{lib → types/lib}/env.d.ts +0 -0
  43. /package/dist/{lib → types/lib}/generate-kb-sign.d.ts +0 -0
  44. /package/dist/{lib → types/lib}/get-app-base-info.d.ts +0 -0
  45. /package/dist/{lib → types/lib}/open-post-editor.d.ts +0 -0
  46. /package/dist/{lib → types/lib}/report-da-event.d.ts +0 -0
  47. /package/dist/{lib → types/lib}/run-action.d.ts +0 -0
  48. /package/dist/{lib → types/lib}/save-image-to-local.d.ts +0 -0
  49. /package/dist/{lib → types/lib}/save-video-to-local.d.ts +0 -0
  50. /package/dist/{lib → types/lib}/scan-qr-code.d.ts +0 -0
  51. /package/dist/{lib → types/lib}/screen-orientation.d.ts +0 -0
  52. /package/dist/{lib → types/lib}/set-webview-title.d.ts +0 -0
  53. /package/dist/{lib → types/lib}/share-image.d.ts +0 -0
  54. /package/dist/{lib → types/lib}/share-model.d.ts +0 -0
  55. /package/dist/{lib → types/lib}/subscribe-notify.d.ts +0 -0
  56. /package/dist/{lib → types/lib}/trigger-login.d.ts +0 -0
  57. /package/dist/{utils → types/utils}/filter-undefined-properties.d.ts +0 -0
  58. /package/dist/{utils → types/utils}/promise-cache.d.ts +0 -0
  59. /package/dist/{utils → types/utils}/wrap-async.d.ts +0 -0
@@ -546,7 +546,7 @@ Promise<{
546
546
 
547
547
  #### 示例代码
548
548
 
549
- 推荐使用 `createPostEditorParamsByThreadPostRule` 构造参数
549
+ 推荐使用 `generatePostEditorParamsByThreadPostRule` 构造参数
550
550
 
551
551
  ```js
552
552
  import { generatePostEditorParamsByThreadPostRule, openPostEditor, KbRequirement } from '@kbapp/js-bridge'
@@ -0,0 +1,73 @@
1
+ import { filterUndefinedAndNullProperties as r } from "../utils/filter-undefined-properties.js";
2
+ import { BridgeCode as d } from "../lib/bridge-code.js";
3
+ import b from "./lib/flutter-ds-bridge.js";
4
+ var g;
5
+ const f = ((e) => /(kb)/i.test(e) ? b() : {
6
+ registerHandler(u, n) {
7
+ throw d.UNSUPPORTED_BRIDGE_ENV;
8
+ },
9
+ callHandler(u, n, i) {
10
+ throw d.UNSUPPORTED_BRIDGE_ENV;
11
+ }
12
+ })((g = window == null ? void 0 : window.navigator) == null ? void 0 : g.userAgent), w = (e) => new Promise((u, n) => {
13
+ var i, o, c;
14
+ try {
15
+ f.registerHandler(e.name, e.handler), (i = e.success) == null || i.call(e), u();
16
+ } catch (t) {
17
+ (o = e.fail) == null || o.call(e, t), n(t);
18
+ } finally {
19
+ (c = e.complete) == null || c.call(e);
20
+ }
21
+ });
22
+ function B(e) {
23
+ const u = (n) => {
24
+ let i;
25
+ const o = (t) => {
26
+ var l;
27
+ (!i || i === "success") && (i = "success", (l = n.success) == null || l.call(n, t));
28
+ }, c = (t) => {
29
+ var l;
30
+ i || (i = "error", (l = n.fail) == null || l.call(n, t));
31
+ };
32
+ n.timeout && setTimeout(() => {
33
+ c(d.TIMEOUT);
34
+ }, n.timeout);
35
+ try {
36
+ f.callHandler(n.name, n.params, (t) => {
37
+ let l;
38
+ try {
39
+ typeof t == "string" && /^\s*(\{|\[).*(\}|\])\s*$/.test(t) ? l = JSON.parse(t.replace(/\n/g, "\\n").replace(/\r/g, "\\r")) : l = t;
40
+ } catch {
41
+ l = t;
42
+ }
43
+ o(l);
44
+ });
45
+ } catch (t) {
46
+ c(t);
47
+ }
48
+ };
49
+ return new Promise((n, i) => {
50
+ u({
51
+ name: e.name,
52
+ params: r(e.params),
53
+ timeout: e.timeout,
54
+ success: (o) => {
55
+ var c, t;
56
+ (c = e.success) == null || c.call(e, o), (t = e.complete) == null || t.call(e), n(o);
57
+ },
58
+ fail: (o) => {
59
+ var c, t;
60
+ (c = e.fail) == null || c.call(e, o), (t = e.complete) == null || t.call(e), i(o);
61
+ }
62
+ });
63
+ });
64
+ }
65
+ function N(e) {
66
+ f.callHandler(e.name, e.params, (u) => {
67
+ });
68
+ }
69
+ export {
70
+ w as defineBridgeCallback,
71
+ N as runBridgeApi,
72
+ B as runBridgeApiResponse
73
+ };
@@ -0,0 +1,93 @@
1
+ const S = () => {
2
+ const p = (t, e, r) => {
3
+ var n = "";
4
+ typeof e == "function" && (r = e, e = {});
5
+ var i = { data: e === void 0 ? null : e };
6
+ if (typeof r == "function") {
7
+ var s = "dscb" + window.dscb++;
8
+ window[s] = r, i._dscbstub = s;
9
+ }
10
+ if (i = JSON.stringify(i), window.flutter_inappwebview ? window.flutter_inappwebview.callHandler && (n = window.flutter_inappwebview.callHandler("" + t, i)) : (window._dswk || navigator.userAgent.indexOf("_dsbridge") != -1) && (n = prompt("_flutterDsbridge=" + t, i)), n instanceof Promise)
11
+ return n;
12
+ try {
13
+ return JSON.parse(n || "{}").data;
14
+ } catch {
15
+ console.error("callHandle异常,JSON.parse错误");
16
+ }
17
+ }, _ = () => window.navigator.userAgent.includes("Android") ? window.flutter_inappwebview && window.flutter_inappwebview._platformReady : !0, y = (() => {
18
+ const t = [], e = setInterval(() => {
19
+ _() && (clearInterval(e), t.forEach((r) => {
20
+ p.apply(window, r);
21
+ }), t.length = 0);
22
+ }, 500);
23
+ return (...r) => {
24
+ t.push(r);
25
+ };
26
+ })();
27
+ var d = {
28
+ default: void 0,
29
+ // for typescript
30
+ callHandler: function(t, e, r) {
31
+ return _() ? p(t, e, r) : y(t, e, r);
32
+ },
33
+ register: function(t, e, r) {
34
+ var n = r ? window._dsaf : window._dsf;
35
+ window._dsInit || (window._dsInit = !0, setTimeout(function() {
36
+ d.callHandler("_dsb.dsinit");
37
+ }, 0)), typeof e == "object" ? n._obs[t] = e : n[t] = e;
38
+ },
39
+ registerHandler: function(t, e) {
40
+ this.register(t, e, !0);
41
+ }
42
+ };
43
+ return function() {
44
+ if (!window._dsf) {
45
+ var t = {
46
+ //保存JS同步方法
47
+ _dsf: {
48
+ _obs: {}
49
+ },
50
+ //保存JS异步方法
51
+ _dsaf: {
52
+ _obs: {}
53
+ },
54
+ dscb: 0,
55
+ jsBridge: d,
56
+ _handleMessageFromNative: function(r) {
57
+ var n = JSON.parse(r.data), i = {
58
+ id: r.callbackId,
59
+ complete: !0
60
+ }, s = this._dsf[r.method], f = this._dsaf[r.method], v = function(c, w) {
61
+ i.data = c.apply(w, n), d.callHandler("_dsb.returnValue", i);
62
+ }, h = function(c, w) {
63
+ n.push(function(H, I) {
64
+ i.data = H, i.complete = I !== !1, d.callHandler("_dsb.returnValue", i);
65
+ }), c.apply(w, n);
66
+ };
67
+ if (s)
68
+ v(s, this._dsf);
69
+ else if (f)
70
+ h(f, this._dsaf);
71
+ else {
72
+ var o = r.method.split(".");
73
+ if (o.length < 2) return;
74
+ var b = o.pop(), g = o.join("."), u = this._dsf._obs, l = u[g] || {}, a = l[b];
75
+ if (a && typeof a == "function") {
76
+ v(a, l);
77
+ return;
78
+ }
79
+ if (u = this._dsaf._obs, l = u[g] || {}, a = l[b], a && typeof a == "function") {
80
+ h(a, l);
81
+ return;
82
+ }
83
+ }
84
+ }
85
+ };
86
+ for (var e in t)
87
+ window[e] = t[e];
88
+ }
89
+ }(), d;
90
+ };
91
+ export {
92
+ S as default
93
+ };
@@ -0,0 +1,59 @@
1
+ import { defineBridgeCallback as r, runBridgeApi as p, runBridgeApiResponse as t } from "./core/index.js";
2
+ import { decorateAppVersionSupport as i, isAppVersionSupport as a } from "./lib/app-version-support.js";
3
+ import { BridgeCode as s } from "./lib/bridge-code.js";
4
+ import { checkForNewVersion as x } from "./lib/check-for-new-version.js";
5
+ import { closeWebView as A } from "./lib/close-webview.js";
6
+ import { definePermissionUsage as S } from "./lib/define-permission-usage.js";
7
+ import { IS_KB_APP_ENV as l } from "./lib/env.js";
8
+ import { generateKBSign as u } from "./lib/generate-kb-sign.js";
9
+ import { AppBaseInfo as B, getAppBaseInfo as b } from "./lib/get-app-base-info.js";
10
+ import { KbRequirement as L, NoteThreadPostRule as V, generatePostEditorParamsByThreadPostRule as N, openPostEditor as R } from "./lib/open-post-editor.js";
11
+ import { reportDAEvent as w } from "./lib/report-da-event.js";
12
+ import { runAction as E } from "./lib/run-action.js";
13
+ import { saveImageToLocal as v } from "./lib/save-image-to-local.js";
14
+ import { saveVideoToLocal as K } from "./lib/save-video-to-local.js";
15
+ import { scanQRCode as M } from "./lib/scan-qr-code.js";
16
+ import { setScreenOrientation as q } from "./lib/screen-orientation.js";
17
+ import { setWebViewTitle as F } from "./lib/set-webview-title.js";
18
+ import { shareImage as Q } from "./lib/share-image.js";
19
+ import { AppShareModel as j, defineAppShareModel as z, defineAppSharePanelState as G, onAppSharePanelShow as H, openAppSharePanel as J } from "./lib/share-model.js";
20
+ import { getAppSubscribeNotifyStatus as Y, openAppSubscribeNotifySettings as Z } from "./lib/subscribe-notify.js";
21
+ import { AppLoginInfo as ee, getAppLoginInfo as oe, onLoopCheckAppLogin as re, triggerAppLogin as pe } from "./lib/trigger-login.js";
22
+ export {
23
+ B as AppBaseInfo,
24
+ ee as AppLoginInfo,
25
+ j as AppShareModel,
26
+ s as BridgeCode,
27
+ l as IS_KB_APP_ENV,
28
+ L as KbRequirement,
29
+ V as NoteThreadPostRule,
30
+ x as checkForNewVersion,
31
+ A as closeWebView,
32
+ i as decorateAppVersionSupport,
33
+ z as defineAppShareModel,
34
+ G as defineAppSharePanelState,
35
+ r as defineBridgeCallback,
36
+ S as definePermissionUsage,
37
+ u as generateKBSign,
38
+ N as generatePostEditorParamsByThreadPostRule,
39
+ b as getAppBaseInfo,
40
+ oe as getAppLoginInfo,
41
+ Y as getAppSubscribeNotifyStatus,
42
+ a as isAppVersionSupport,
43
+ H as onAppSharePanelShow,
44
+ re as onLoopCheckAppLogin,
45
+ J as openAppSharePanel,
46
+ Z as openAppSubscribeNotifySettings,
47
+ R as openPostEditor,
48
+ w as reportDAEvent,
49
+ E as runAction,
50
+ p as runBridgeApi,
51
+ t as runBridgeApiResponse,
52
+ v as saveImageToLocal,
53
+ K as saveVideoToLocal,
54
+ M as scanQRCode,
55
+ q as setScreenOrientation,
56
+ F as setWebViewTitle,
57
+ Q as shareImage,
58
+ pe as triggerAppLogin
59
+ };
@@ -0,0 +1,18 @@
1
+ import { wrapAsync as t } from "../utils/wrap-async.js";
2
+ import { getAppBaseInfo as p } from "./get-app-base-info.js";
3
+ import { BridgeCode as e } from "./bridge-code.js";
4
+ const s = t(async (r) => (await p()).vcode >= r.minVersion);
5
+ function a(r, o) {
6
+ return (...n) => s({
7
+ minVersion: r.minVersion
8
+ }).then((i) => i ? o(...n) : Promise.reject(
9
+ new e({
10
+ errorCode: e.UNSUPPORTED_VERSION.errorCode,
11
+ errorMsg: `最低版本要求${r.minVersion}`
12
+ })
13
+ ));
14
+ }
15
+ export {
16
+ a as decorateAppVersionSupport,
17
+ s as isAppVersionSupport
18
+ };
@@ -0,0 +1,22 @@
1
+ const r = class r {
2
+ constructor(s) {
3
+ this.errorCode = s.errorCode, this.errorMsg = s.errorMsg;
4
+ }
5
+ };
6
+ r.UNKNOWN = new r({
7
+ errorCode: 1e3,
8
+ errorMsg: "未知错误"
9
+ }), r.UNSUPPORTED_VERSION = new r({
10
+ errorCode: 1001,
11
+ errorMsg: "当前开吧版本不支持"
12
+ }), r.TIMEOUT = new r({
13
+ errorCode: 1002,
14
+ errorMsg: "执行超时"
15
+ }), r.UNSUPPORTED_BRIDGE_ENV = new r({
16
+ errorCode: 1003,
17
+ errorMsg: "请在开吧app内执行"
18
+ });
19
+ let t = r;
20
+ export {
21
+ t as BridgeCode
22
+ };
@@ -0,0 +1,14 @@
1
+ import { wrapAsync as r } from "../utils/wrap-async.js";
2
+ import { runBridgeApi as e } from "../core/index.js";
3
+ const t = r(() => {
4
+ e({
5
+ name: "OpenActRequest",
6
+ params: {
7
+ type: 56,
8
+ data: null
9
+ }
10
+ });
11
+ });
12
+ export {
13
+ t as checkForNewVersion
14
+ };
@@ -0,0 +1,14 @@
1
+ import { runBridgeApi as e } from "../core/index.js";
2
+ import { wrapAsync as r } from "../utils/wrap-async.js";
3
+ const o = r(() => {
4
+ e({
5
+ name: "OpenActRequest",
6
+ params: {
7
+ type: -1,
8
+ data: {}
9
+ }
10
+ });
11
+ });
12
+ export {
13
+ o as closeWebView
14
+ };
@@ -0,0 +1,15 @@
1
+ import { defineBridgeCallback as n } from "../core/index.js";
2
+ import { wrapAsync as o } from "../utils/wrap-async.js";
3
+ const e = {
4
+ microphone: { description: "用于发帖上传音频" },
5
+ location: { description: "获取你选择的位置信息,用于线下导航服务" },
6
+ camera: { description: "收集你选中的照片或视频信息 ,用于 发表评论、分享视频" }
7
+ }, c = o((i) => (Object.assign(e, i), n({
8
+ name: "getPermissionUsage",
9
+ handler(r, s) {
10
+ s(e[r.permission]);
11
+ }
12
+ })));
13
+ export {
14
+ c as definePermissionUsage
15
+ };
@@ -0,0 +1,4 @@
1
+ const t = /(kb_flutter|kb_dsbridge_flutter|kb_ios|kb_android|kb_dsbridge_android)/i.test(window.navigator.userAgent);
2
+ export {
3
+ t as IS_KB_APP_ENV
4
+ };
@@ -0,0 +1,16 @@
1
+ import { wrapAsync as n } from "../utils/wrap-async.js";
2
+ import { runBridgeApiResponse as r } from "../core/index.js";
3
+ const m = n(async (t) => {
4
+ const { kbKey: o, ...e } = t, { data: a } = await r({
5
+ name: "OpenActRequest",
6
+ timeout: 5e3,
7
+ params: {
8
+ type: 51,
9
+ data: e
10
+ }
11
+ });
12
+ return a;
13
+ });
14
+ export {
15
+ m as generateKBSign
16
+ };
@@ -0,0 +1,19 @@
1
+ import { decorateCacheAsyncResult as e } from "../utils/promise-cache.js";
2
+ import { runBridgeApiResponse as t } from "../core/index.js";
3
+ import { wrapAsync as p } from "../utils/wrap-async.js";
4
+ class n {
5
+ }
6
+ const m = p(
7
+ e(() => t({
8
+ name: "OpenActRequest",
9
+ timeout: 5e3,
10
+ params: {
11
+ type: 35,
12
+ data: {}
13
+ }
14
+ }))
15
+ );
16
+ export {
17
+ n as AppBaseInfo,
18
+ m as getAppBaseInfo
19
+ };
@@ -0,0 +1,46 @@
1
+ import { runBridgeApiResponse as n } from "../core/index.js";
2
+ import { wrapAsync as s } from "../utils/wrap-async.js";
3
+ var d = /* @__PURE__ */ ((t) => (t[t.FREE = 1] = "FREE", t[t.FORBID = 2] = "FORBID", t[t.REQUIRED = 3] = "REQUIRED", t))(d || {});
4
+ class r {
5
+ constructor() {
6
+ this.textMin = 0, this.textMax = 1e3, this.imageMax = 9, this.imageMin = 0, this.audioRqr = 1, this.videoRqr = 1, this.mediaRqr = 2, this.streetRqr = 1;
7
+ }
8
+ }
9
+ function c(t) {
10
+ const e = new r();
11
+ return t && Object.keys(t).forEach((i) => {
12
+ e[i] = t[i];
13
+ }), {
14
+ hint: t == null ? void 0 : t.placeholder,
15
+ initialText: t == null ? void 0 : t.initialText,
16
+ audio: e.audioRqr !== 2,
17
+ image: e.imageMax !== 0,
18
+ video: e.videoRqr !== 2,
19
+ address: e.streetRqr !== 2,
20
+ asset_video: e.mediaRqr !== 2,
21
+ audio_must: e.audioRqr === 3,
22
+ image_must: e.imageMin > 0,
23
+ asset_video_must: e.mediaRqr === 3,
24
+ max_image_count: e.imageMax,
25
+ min_image_count: e.imageMin,
26
+ video_must: e.videoRqr === 3,
27
+ text_must: e.textMin > 0,
28
+ content_max_length: e.textMax,
29
+ content_min_length: e.textMin
30
+ };
31
+ }
32
+ const h = s(
33
+ async (t) => n({
34
+ name: "OpenActRequest",
35
+ params: { type: 13, data: (t == null ? void 0 : t.postRule) ?? {} }
36
+ }).then(({ data: e }) => {
37
+ const { pic: i, ...o } = e;
38
+ return { images: i, ...o };
39
+ })
40
+ );
41
+ export {
42
+ d as KbRequirement,
43
+ r as NoteThreadPostRule,
44
+ c as generatePostEditorParamsByThreadPostRule,
45
+ h as openPostEditor
46
+ };
@@ -0,0 +1,23 @@
1
+ import { runBridgeApi as t } from "../core/index.js";
2
+ import { wrapAsync as r } from "../utils/wrap-async.js";
3
+ const a = r(
4
+ (e) => {
5
+ t({
6
+ name: "OpenActRequest",
7
+ params: {
8
+ type: 69,
9
+ data: {
10
+ /** 事件名 */
11
+ eventId: e.eventName,
12
+ /** 上报值 */
13
+ trackParams: e.eventParams,
14
+ /** 开始结束类型传递 */
15
+ ExtEventType: e.eventType
16
+ }
17
+ }
18
+ });
19
+ }
20
+ );
21
+ export {
22
+ a as reportDAEvent
23
+ };
@@ -0,0 +1,14 @@
1
+ import { runBridgeApi as t } from "../core/index.js";
2
+ import { wrapAsync as p } from "../utils/wrap-async.js";
3
+ const o = p((r) => {
4
+ t({
5
+ name: "OpenActRequest",
6
+ params: {
7
+ type: 1001,
8
+ data: r
9
+ }
10
+ });
11
+ });
12
+ export {
13
+ o as runAction
14
+ };
@@ -0,0 +1,16 @@
1
+ import { runBridgeApi as r } from "../core/index.js";
2
+ import { wrapAsync as o } from "../utils/wrap-async.js";
3
+ const m = o(
4
+ (e) => {
5
+ r({
6
+ name: "OpenActRequest",
7
+ params: {
8
+ type: 62,
9
+ data: e
10
+ }
11
+ });
12
+ }
13
+ );
14
+ export {
15
+ m as saveImageToLocal
16
+ };
@@ -0,0 +1,16 @@
1
+ import { runBridgeApi as o } from "../core/index.js";
2
+ import { wrapAsync as r } from "../utils/wrap-async.js";
3
+ const a = r(
4
+ (e) => {
5
+ o({
6
+ name: "OpenActRequest",
7
+ params: {
8
+ type: 63,
9
+ data: e
10
+ }
11
+ });
12
+ }
13
+ );
14
+ export {
15
+ a as saveVideoToLocal
16
+ };
@@ -0,0 +1,12 @@
1
+ import { runBridgeApiResponse as e } from "../core/index.js";
2
+ import { wrapAsync as r } from "../utils/wrap-async.js";
3
+ const n = r(() => e({
4
+ name: "OpenActRequest",
5
+ params: {
6
+ type: 26,
7
+ data: {}
8
+ }
9
+ }));
10
+ export {
11
+ n as scanQRCode
12
+ };
@@ -0,0 +1,16 @@
1
+ import { runBridgeApi as r } from "../core/index.js";
2
+ import { wrapAsync as t } from "../utils/wrap-async.js";
3
+ const o = t(
4
+ (e) => {
5
+ r({
6
+ name: "OpenActRequest",
7
+ params: {
8
+ type: 71,
9
+ data: e
10
+ }
11
+ });
12
+ }
13
+ );
14
+ export {
15
+ o as setScreenOrientation
16
+ };
@@ -0,0 +1,16 @@
1
+ import { runBridgeApi as r } from "../core/index.js";
2
+ import { wrapAsync as t } from "../utils/wrap-async.js";
3
+ const m = t(
4
+ (e) => {
5
+ r({
6
+ name: "OpenActRequest",
7
+ params: {
8
+ type: 64,
9
+ data: e
10
+ }
11
+ });
12
+ }
13
+ );
14
+ export {
15
+ m as setWebViewTitle
16
+ };
@@ -0,0 +1,16 @@
1
+ import { runBridgeApi as e } from "../core/index.js";
2
+ import { wrapAsync as p } from "../utils/wrap-async.js";
3
+ const a = p(
4
+ (r) => {
5
+ e({
6
+ name: "OpenActRequest",
7
+ params: {
8
+ type: 58,
9
+ data: r
10
+ }
11
+ });
12
+ }
13
+ );
14
+ export {
15
+ a as shareImage
16
+ };
@@ -0,0 +1,45 @@
1
+ import { defineBridgeCallback as a, runBridgeApi as p } from "../core/index.js";
2
+ import { wrapAsync as t } from "../utils/wrap-async.js";
3
+ const n = "SHARE_EVENT_NAME";
4
+ class A {
5
+ }
6
+ const h = t((e) => a({
7
+ name: "CommonShare",
8
+ handler(r, o) {
9
+ window.dispatchEvent(new Event(n)), "onShareApp" in e && e.onShareApp ? o({ type: 12, data: e.onShareApp() }) : o({ type: 12, data: e });
10
+ }
11
+ })), s = t(async (e) => {
12
+ window.dispatchEvent(new Event(n)), p({
13
+ name: "OpenActRequest",
14
+ params: {
15
+ type: 58,
16
+ data: e
17
+ }
18
+ });
19
+ });
20
+ function w(e) {
21
+ return window.addEventListener(n, e), () => {
22
+ window.removeEventListener(n, e);
23
+ };
24
+ }
25
+ const E = t(
26
+ (e) => {
27
+ p({
28
+ name: "OpenActRequest",
29
+ params: {
30
+ type: 68,
31
+ data: {
32
+ show: e.showMenu,
33
+ showActionMode: e.panelStyle || 0
34
+ }
35
+ }
36
+ });
37
+ }
38
+ );
39
+ export {
40
+ A as AppShareModel,
41
+ h as defineAppShareModel,
42
+ E as defineAppSharePanelState,
43
+ w as onAppSharePanelShow,
44
+ s as openAppSharePanel
45
+ };
@@ -0,0 +1,19 @@
1
+ import { runBridgeApiResponse as t, runBridgeApi as p } from "../core/index.js";
2
+ import { wrapAsync as e } from "../utils/wrap-async.js";
3
+ const s = e(() => t({
4
+ name: "OpenActRequest",
5
+ params: {
6
+ type: 72
7
+ }
8
+ })), i = e(async () => {
9
+ p({
10
+ name: "OpenActRequest",
11
+ params: {
12
+ type: 73
13
+ }
14
+ });
15
+ });
16
+ export {
17
+ s as getAppSubscribeNotifyStatus,
18
+ i as openAppSubscribeNotifySettings
19
+ };
@@ -0,0 +1,60 @@
1
+ import { runBridgeApiResponse as i } from "../core/index.js";
2
+ import { wrapAsync as c } from "../utils/wrap-async.js";
3
+ class d {
4
+ }
5
+ const g = c(async () => (await i({
6
+ name: "OpenActRequest",
7
+ timeout: 5e3,
8
+ params: { type: 31, data: { requireLogin: !1 } }
9
+ })).data || null), r = /* @__PURE__ */ (() => {
10
+ const e = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ (() => {
11
+ let t;
12
+ const n = (o) => {
13
+ t = setTimeout(async () => {
14
+ const s = await g();
15
+ if (!s)
16
+ return n(++o);
17
+ e.forEach((p) => p(s)), e.clear();
18
+ }, ((s) => s === 0 ? 0 : s < 50 ? 600 : s < 80 ? 1e3 : 5e3)(o));
19
+ };
20
+ return {
21
+ start() {
22
+ t && clearTimeout(t), e.size > 0 && n(0);
23
+ },
24
+ stop() {
25
+ t && clearTimeout(t);
26
+ }
27
+ };
28
+ })();
29
+ return {
30
+ /** 注册监听事件(需要通过triggerCheckTask触发检测任务) */
31
+ addTask(t) {
32
+ e.add(t);
33
+ },
34
+ /** 移除监听 */
35
+ removeTask(t) {
36
+ e.delete(t), e.size === 0 && a.stop();
37
+ },
38
+ /** 触发定时检测是否登录成功任务 */
39
+ triggerCheckTask() {
40
+ a.start();
41
+ }
42
+ };
43
+ })(), l = c(async () => {
44
+ r.triggerCheckTask(), i({
45
+ name: "OpenActRequest",
46
+ params: { type: 31, data: { requireLogin: !0 } },
47
+ success(e) {
48
+ var a;
49
+ (a = e.data) != null && a.userId && r.triggerCheckTask();
50
+ }
51
+ });
52
+ }), m = (e) => (r.addTask(e), r.triggerCheckTask(), () => {
53
+ r.removeTask(e);
54
+ });
55
+ export {
56
+ d as AppLoginInfo,
57
+ g as getAppLoginInfo,
58
+ m as onLoopCheckAppLogin,
59
+ l as triggerAppLogin
60
+ };