@beaver-im/js-sdk 1.0.2 → 1.1.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
@@ -12,7 +12,7 @@ npm install @beaver-im/js-sdk
12
12
 
13
13
  ```html
14
14
  <beaver-login
15
- app-id="your_app_id"
15
+ oauth-Id="your_app_id"
16
16
  api-base="https://server.wsrh8888.com"
17
17
  oauth-base="https://oauth.wsrh8888.com"
18
18
  redirect-url="https://yoursite.com/callback"
@@ -36,7 +36,7 @@ npm install @beaver-im/js-sdk
36
36
 
37
37
  | 属性 | 类型 | 必填 | 说明 |
38
38
  |------|------|------|------|
39
- | app-id | string | 是 | 开放平台应用 AppID |
39
+ | oauth-Id | string | 是 | 开放平台应用 AppID |
40
40
  | api-base | string | 否 | 开放 API 网关,默认 `https://server.wsrh8888.com` |
41
41
  | oauth-base | string | 否 | 扫码页域名(拼 `/scan?sceneId=`),默认 `https://oauth.wsrh8888.com` |
42
42
  | redirect-url | string | 否 | 登录成功后的回跳地址 |
@@ -62,7 +62,7 @@ element.addEventListener('login', (e) => {
62
62
  ```vue
63
63
  <template>
64
64
  <beaver-login
65
- :app-id="appId"
65
+ :oauth-Id="oauthId"
66
66
  :api-base="apiBase"
67
67
  :oauth-base="oauthBase"
68
68
  @login="onLogin"
@@ -1,4 +1,4 @@
1
1
  import { IQuickSignRes } from '../types/api/localClient';
2
2
 
3
3
  /** 本机客户端快捷登录(海狸 PC 已登录时) */
4
- export declare const quickSignApi: (appId: string) => Promise<import('../utils/request').IResponseSuccessData<IQuickSignRes>>;
4
+ export declare const quickSignApi: (oauthId: string) => Promise<import('../utils/request').IResponseSuccessData<IQuickSignRes>>;
@@ -3662,7 +3662,7 @@ const Zs = (e) => De({
3662
3662
  }), ta = wt({
3663
3663
  name: "QrcodeLoginView",
3664
3664
  props: {
3665
- appId: {
3665
+ oauthId: {
3666
3666
  type: String,
3667
3667
  required: !0
3668
3668
  }
@@ -3672,7 +3672,7 @@ const Zs = (e) => De({
3672
3672
  const n = c0(""), r = c0(""), o = c0(""), i = c0("waiting"), a = c0(300), s = c0(null);
3673
3673
  let x = null, c = null;
3674
3674
  const f = async () => {
3675
- const u = await ea(e.appId);
3675
+ const u = await ea(e.oauthId);
3676
3676
  if (u.code !== 0 || !u.result) {
3677
3677
  console.error(u.msg);
3678
3678
  return;
@@ -3699,7 +3699,7 @@ const Zs = (e) => De({
3699
3699
  n.value = d;
3700
3700
  }, p = async () => {
3701
3701
  o.value = "", i.value = "waiting";
3702
- const u = await Zs({ appId: e.appId });
3702
+ const u = await Zs({ oauthId: e.oauthId });
3703
3703
  if (u.code !== 0) {
3704
3704
  console.error(u.msg), o.value = u.msg;
3705
3705
  return;
@@ -3747,7 +3747,7 @@ const Zs = (e) => De({
3747
3747
  handleLocalLogin: C
3748
3748
  };
3749
3749
  }
3750
- }), ra = `.qrcode-login-view[data-v-3a819666]{min-height:280px;padding:20px 16px 24px;box-sizing:border-box}.login-columns[data-v-3a819666]{display:flex;justify-content:center;align-items:flex-start;gap:24px}.login-column[data-v-3a819666]{display:flex;flex-direction:column;align-items:center;width:160px}.login-column--clickable[data-v-3a819666]{cursor:pointer}.login-column--clickable:hover .user-card[data-v-3a819666]{border-color:#ff7d45}.login-card[data-v-3a819666]{width:160px;height:160px;border:1px solid #ebeef5;border-radius:8px;overflow:hidden;background:#ffffff;box-sizing:border-box}.qrcode-box[data-v-3a819666]{position:relative;display:flex;align-items:center;justify-content:center}.user-card[data-v-3a819666]{display:flex;align-items:center;justify-content:center;padding:16px;box-sizing:border-box;transition:border-color .2s cubic-bezier(.33,1,.68,1)}.user-avatar[data-v-3a819666]{width:100%;height:100%;border-radius:8px;object-fit:cover}.login-column__label[data-v-3a819666]{margin-top:15px;font-size:14px;line-height:1.5;text-align:center;color:#2d3436;font-weight:500;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.login-column__label--action[data-v-3a819666]{color:#ff7d45;font-weight:500;cursor:pointer;transition:color .2s cubic-bezier(.33,1,.68,1);-webkit-user-select:none;user-select:none}.login-column__label--action[data-v-3a819666]:hover{color:#e86835}.qr-code-img[data-v-3a819666]{width:100%;height:100%;object-fit:contain}.qr-placeholder[data-v-3a819666]{color:#b2bec3;font-size:13px}.qrcode-mask[data-v-3a819666]{position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(255,255,255,.95);display:flex;align-items:center;justify-content:center}.mask-content[data-v-3a819666]{text-align:center}.mask-content p[data-v-3a819666]{margin:4px 0;font-size:13px;color:#ff7d45;line-height:1.5}.login-error[data-v-3a819666]{margin:16px 0 0;font-size:12px;color:#ff5252;line-height:1.4;text-align:center}
3750
+ }), ra = `.qrcode-login-view[data-v-51bb6762]{min-height:280px;padding:20px 16px 24px;box-sizing:border-box}.login-columns[data-v-51bb6762]{display:flex;justify-content:center;align-items:flex-start;gap:24px}.login-column[data-v-51bb6762]{display:flex;flex-direction:column;align-items:center;width:160px}.login-column--clickable[data-v-51bb6762]{cursor:pointer}.login-column--clickable:hover .user-card[data-v-51bb6762]{border-color:#ff7d45}.login-card[data-v-51bb6762]{width:160px;height:160px;border:1px solid #ebeef5;border-radius:8px;overflow:hidden;background:#ffffff;box-sizing:border-box}.qrcode-box[data-v-51bb6762]{position:relative;display:flex;align-items:center;justify-content:center}.user-card[data-v-51bb6762]{display:flex;align-items:center;justify-content:center;padding:16px;box-sizing:border-box;transition:border-color .2s cubic-bezier(.33,1,.68,1)}.user-avatar[data-v-51bb6762]{width:100%;height:100%;border-radius:8px;object-fit:cover}.login-column__label[data-v-51bb6762]{margin-top:15px;font-size:14px;line-height:1.5;text-align:center;color:#2d3436;font-weight:500;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.login-column__label--action[data-v-51bb6762]{color:#ff7d45;font-weight:500;cursor:pointer;transition:color .2s cubic-bezier(.33,1,.68,1);-webkit-user-select:none;user-select:none}.login-column__label--action[data-v-51bb6762]:hover{color:#e86835}.qr-code-img[data-v-51bb6762]{width:100%;height:100%;object-fit:contain}.qr-placeholder[data-v-51bb6762]{color:#b2bec3;font-size:13px}.qrcode-mask[data-v-51bb6762]{position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(255,255,255,.95);display:flex;align-items:center;justify-content:center}.mask-content[data-v-51bb6762]{text-align:center}.mask-content p[data-v-51bb6762]{margin:4px 0;font-size:13px;color:#ff7d45;line-height:1.5}.login-error[data-v-51bb6762]{margin:16px 0 0;font-size:12px;color:#ff5252;line-height:1.4;text-align:center}
3751
3751
  `, qt = (e, t) => {
3752
3752
  const n = e.__vccOpts || e;
3753
3753
  for (const [r, o] of t)
@@ -3804,7 +3804,7 @@ function ha(e, t, n, r, o, i) {
3804
3804
  e.error ? (x0(), h0("p", da, k0(e.error), 1)) : m0("", !0)
3805
3805
  ]);
3806
3806
  }
3807
- const pa = /* @__PURE__ */ qt(ta, [["render", ha], ["styles", [ra]], ["__scopeId", "data-v-3a819666"]]);
3807
+ const pa = /* @__PURE__ */ qt(ta, [["render", ha], ["styles", [ra]], ["__scopeId", "data-v-51bb6762"]]);
3808
3808
  var qn = { exports: {} };
3809
3809
  function va(e) {
3810
3810
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
@@ -8802,7 +8802,7 @@ const Ka = (e) => De({
8802
8802
  }), Va = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPgogICAgPHBhdGggZD0iTTEgMTJzNC04IDExLTggMTEgOCAxMSA4LTQgOC0xMSA4LTExLTgtMTEtOHoiPjwvcGF0aD4KICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjMiPjwvY2lyY2xlPgo8L3N2Zz4K", Ga = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPgogICAgPHBhdGggZD0iTTE3Ljk0IDE3Ljk0QTEwLjA3IDEwLjA3IDAgMCAxIDEyIDIwYy03IDAtMTEtOC0xMS04YTE4LjQ1IDE4LjQ1IDAgMCAxIDUuMDYtNS45NE05LjkgNC4yNEE5LjEyIDkuMTIgMCAwIDEgMTIgNGM3IDAgMTEgOCAxMSA4YTE4LjUgMTguNSAwIDAgMS0yLjE2IDMuMTltLTYuNzItMS4wN2EzIDMgMCAxIDEtNC4yNC00LjI0Ij48L3BhdGg+CiAgICA8bGluZSB4MT0iMSIgeTE9IjEiIHgyPSIyMyIgeTI9IjIzIj48L2xpbmU+Cjwvc3ZnPgo=", Xa = wt({
8803
8803
  name: "PasswordLoginView",
8804
8804
  props: {
8805
- appId: {
8805
+ oauthId: {
8806
8806
  type: String,
8807
8807
  required: !0
8808
8808
  }
@@ -8822,7 +8822,7 @@ const Ka = (e) => De({
8822
8822
  if (!s() || !x())
8823
8823
  return;
8824
8824
  const f = Wa.MD5(r.value).toString(), C = await Ka({
8825
- appId: e.appId,
8825
+ oauthId: e.oauthId,
8826
8826
  account: n.value,
8827
8827
  password: f
8828
8828
  });
@@ -8836,7 +8836,7 @@ const Ka = (e) => De({
8836
8836
  eyeOffIcon: Ga
8837
8837
  };
8838
8838
  }
8839
- }), Qa = `.password-login-view[data-v-b1796c26]{min-height:280px}.login-form[data-v-b1796c26]{width:100%;margin:0 auto;padding:8px 0 24px}.input-wrap[data-v-b1796c26]{position:relative;font-size:13px;width:100%;max-width:274px;margin:0 auto 26px}.input-wrap input[data-v-b1796c26]{background:#f9fafb;box-sizing:border-box;border:1px solid #ebeef5;border-radius:6px;color:#2d3436;display:inline-block;font-size:13px;height:40px;line-height:40px;padding:0 12px;transition:border-color .2s cubic-bezier(.33,1,.68,1),box-shadow .2s cubic-bezier(.33,1,.68,1);width:100%;outline:none;-webkit-appearance:none}.input-wrap input[data-v-b1796c26]:focus{border-color:#ff7d45;background:#ffffff;box-shadow:0 0 0 3px #ffe6d9}.input-wrap input[data-v-b1796c26]::-webkit-input-placeholder{color:#b2bec3}.input-wrap input.password-input[data-v-b1796c26]{padding-right:40px}.password-toggle[data-v-b1796c26]{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:20px;height:20px;color:#b2bec3;cursor:pointer;transition:color .2s cubic-bezier(.33,1,.68,1)}.password-toggle[data-v-b1796c26]:hover{color:#636e72}.password-toggle img[data-v-b1796c26]{width:18px;height:18px;display:block}.error-text[data-v-b1796c26]{color:#ff5252;font-size:12px;line-height:1.2;padding-top:4px;margin:0;position:absolute;top:100%;left:0}.notice-text[data-v-b1796c26]{width:100%;max-width:274px;font-size:13px;color:#ff5252;font-weight:500;margin:0 auto;line-height:1.5;text-align:center}.login-btn[data-v-b1796c26]{width:100%;max-width:274px;background:#ff7d45;border-radius:6px;text-align:center;line-height:36px;height:36px;color:#fff;font-size:13px;font-weight:500;cursor:pointer;margin:38px auto 0;transition:background .2s cubic-bezier(.33,1,.68,1)}.login-btn[data-v-b1796c26]:hover{background:#e86835}
8839
+ }), Qa = `.password-login-view[data-v-104904b2]{min-height:280px}.login-form[data-v-104904b2]{width:100%;margin:0 auto;padding:8px 0 24px}.input-wrap[data-v-104904b2]{position:relative;font-size:13px;width:100%;max-width:274px;margin:0 auto 26px}.input-wrap input[data-v-104904b2]{background:#f9fafb;box-sizing:border-box;border:1px solid #ebeef5;border-radius:6px;color:#2d3436;display:inline-block;font-size:13px;height:40px;line-height:40px;padding:0 12px;transition:border-color .2s cubic-bezier(.33,1,.68,1),box-shadow .2s cubic-bezier(.33,1,.68,1);width:100%;outline:none;-webkit-appearance:none}.input-wrap input[data-v-104904b2]:focus{border-color:#ff7d45;background:#ffffff;box-shadow:0 0 0 3px #ffe6d9}.input-wrap input[data-v-104904b2]::-webkit-input-placeholder{color:#b2bec3}.input-wrap input.password-input[data-v-104904b2]{padding-right:40px}.password-toggle[data-v-104904b2]{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:20px;height:20px;color:#b2bec3;cursor:pointer;transition:color .2s cubic-bezier(.33,1,.68,1)}.password-toggle[data-v-104904b2]:hover{color:#636e72}.password-toggle img[data-v-104904b2]{width:18px;height:18px;display:block}.error-text[data-v-104904b2]{color:#ff5252;font-size:12px;line-height:1.2;padding-top:4px;margin:0;position:absolute;top:100%;left:0}.notice-text[data-v-104904b2]{width:100%;max-width:274px;font-size:13px;color:#ff5252;font-weight:500;margin:0 auto;line-height:1.5;text-align:center}.login-btn[data-v-104904b2]{width:100%;max-width:274px;background:#ff7d45;border-radius:6px;text-align:center;line-height:36px;height:36px;color:#fff;font-size:13px;font-weight:500;cursor:pointer;margin:38px auto 0;transition:background .2s cubic-bezier(.33,1,.68,1)}.login-btn[data-v-104904b2]:hover{background:#e86835}
8840
8840
  `, Za = { class: "password-login-view" }, Ya = { class: "login-form" }, Ja = { class: "input-wrap" }, ec = {
8841
8841
  key: 0,
8842
8842
  class: "error-text"
@@ -8887,14 +8887,14 @@ function ic(e, t, n, r, o, i) {
8887
8887
  ])
8888
8888
  ]);
8889
8889
  }
8890
- const sc = /* @__PURE__ */ qt(Xa, [["render", ic], ["styles", [Qa]], ["__scopeId", "data-v-b1796c26"]]), ac = wt({
8890
+ const sc = /* @__PURE__ */ qt(Xa, [["render", ic], ["styles", [Qa]], ["__scopeId", "data-v-104904b2"]]), ac = wt({
8891
8891
  name: "BeaverLogin",
8892
8892
  components: {
8893
8893
  QrcodeLoginView: pa,
8894
8894
  PasswordLoginView: sc
8895
8895
  },
8896
8896
  props: {
8897
- appId: {
8897
+ oauthId: {
8898
8898
  type: String,
8899
8899
  required: !0
8900
8900
  },
@@ -8968,14 +8968,14 @@ function lc(e, t, n, r, o, i) {
8968
8968
  ]),
8969
8969
  e.currentMode === "qrcode" ? (x0(), sr(a, {
8970
8970
  key: 0,
8971
- "app-id": e.appId,
8971
+ oauthId: e.oauthId,
8972
8972
  onLoginSuccess: e.handleLoginSuccess
8973
- }, null, 8, ["app-id", "onLoginSuccess"])) : m0("", !0),
8973
+ }, null, 8, ["oauthId", "onLoginSuccess"])) : m0("", !0),
8974
8974
  e.currentMode === "password" ? (x0(), sr(s, {
8975
8975
  key: 1,
8976
- "app-id": e.appId,
8976
+ oauthId: e.oauthId,
8977
8977
  onLoginSuccess: e.handleLoginSuccess
8978
- }, null, 8, ["app-id", "onLoginSuccess"])) : m0("", !0)
8978
+ }, null, 8, ["oauthId", "onLoginSuccess"])) : m0("", !0)
8979
8979
  ]);
8980
8980
  }
8981
8981
  const sn = /* @__PURE__ */ qt(ac, [["render", lc], ["styles", [cc]]]), dc = "1.0.0";