@arcblock/did-connect-react 3.4.7 → 3.4.9

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.
@@ -1,10 +1,10 @@
1
- import { useBrowser as k } from "@arcblock/react-hooks";
2
- import { useRequest as y, useCreation as p } from "ahooks";
3
- import i from "lodash/isNil";
1
+ import { useBrowser as C } from "@arcblock/react-hooks";
2
+ import { useRequest as T, useCreation as p } from "ahooks";
3
+ import n from "lodash/isNil";
4
4
  import { LOGIN_PROVIDER as s } from "@arcblock/ux/lib/Util/constant";
5
- import { getFederatedEnabled as C, getMaster as T, getBlockletData as I } from "@arcblock/ux/lib/Util/federated";
6
- import { useState as S } from "react";
7
- const B = async ({ sourceAppPid: d }) => {
5
+ import { getFederatedEnabled as y, getMaster as D, getBlockletData as I } from "@arcblock/ux/lib/Util/federated";
6
+ import { useState as R } from "react";
7
+ const S = async ({ sourceAppPid: d }) => {
8
8
  const t = globalThis?.blocklet;
9
9
  if (!t)
10
10
  return {
@@ -18,49 +18,52 @@ const B = async ({ sourceAppPid: d }) => {
18
18
  enabled: !0
19
19
  }
20
20
  };
21
- const a = C(t), e = T(t);
22
- return a && e?.appPid && d === e?.appPid ? (await I(e.appUrl))?.settings?.authentication || {} : t?.settings?.authentication || {};
23
- }, R = async ({ sourceAppPid: d } = {}) => {
24
- const t = await B({ sourceAppPid: d });
25
- return Object.entries(t).map(([e, o]) => ({ ...o, provider: e })).filter((e) => e.enabled).sort((e, o) => !i(e?.order) && !i(o?.order) ? e.order - o.order : i(e?.order) ? 1 : -1);
21
+ const l = y(t), e = D(t);
22
+ return l && e?.appPid && d === e?.appPid ? (await I(e.appUrl))?.settings?.authentication || {} : t?.settings?.authentication || {};
23
+ }, B = async ({ sourceAppPid: d } = {}) => {
24
+ const t = await S({ sourceAppPid: d });
25
+ return Object.entries(t).map(([e, o]) => ({ ...o, provider: e })).filter((e) => e.enabled).sort((e, o) => !n(e?.order) && !n(o?.order) ? e.order - o.order : n(e?.order) ? 1 : -1);
26
26
  };
27
- function j({
27
+ function Y({
28
28
  allowWallet: d = !0,
29
29
  passkeyBehavior: t = "none",
30
- action: a,
30
+ action: l,
31
31
  sourceAppPid: e,
32
32
  mode: o = "dialog",
33
- blocklet: b = globalThis.blocklet,
33
+ blocklet: P = globalThis.blocklet,
34
34
  isSmallView: L = !1,
35
- lastLoginMethod: u = ""
35
+ lastLoginMethod: a = ""
36
36
  }) {
37
- const [P, g] = S(!1), w = ["login", "invite", "connect-to-did-space", "connect-to-did-domain", "destroy-self"], E = ["login", "invite", "connect-to-did-space", "connect-to-did-domain", "destroy-self"], c = k(), { data: v = [] } = y(
37
+ const [m, g] = R(!1), w = ["login", "invite", "connect-to-did-space", "connect-to-did-domain", "destroy-self"], E = ["login", "invite", "connect-to-did-space", "connect-to-did-domain", "destroy-self"], c = C(), { data: v = [] } = T(
38
38
  async () => {
39
39
  g(!0);
40
- const l = await R({ sourceAppPid: e });
41
- return g(!1), l;
40
+ const i = await B({ sourceAppPid: e });
41
+ return g(!1), i;
42
42
  },
43
43
  { refreshDeps: [e] }
44
- ), f = p(() => v.filter((r) => r.provider === s.WALLET ? d : r.provider === s.PASSKEY ? t !== "none" && !c.wallet && !c.arcSphere : r.provider === s.EMAIL ? E.includes(a) && (b?.settings?.notification?.email?.enabled ?? !1) : !(r.type === "oauth" && !w.includes(a))).sort((r, n) => {
45
- if (u) {
46
- const h = r.provider === u, m = n.provider === u;
47
- if (h && !m)
48
- return -1;
49
- if (!h && m)
50
- return 1;
51
- }
52
- return !i(r?.order) && !i(n?.order) ? r.order - n.order : i(r?.order) ? i(n?.order) ? 0 : 1 : -1;
53
- }), [v, u]), A = p(() => {
54
- const l = o === "drawer" || L && c.mobile.any;
55
- return globalThis?.blocklet ? !!(f.find((n) => n.provider === s.WALLET)?.showQrcode !== !0 || l) : !!l;
44
+ ), f = p(() => {
45
+ const i = globalThis?.blocklet?.DID_CONNECT_ENABLED_PROVIDERS?.split(",") || [];
46
+ return v.filter((r) => i.length > 0 && !i.includes(r.provider) ? !1 : r.provider === s.WALLET ? d : r.provider === s.PASSKEY ? t !== "none" && !c.wallet && !c.arcSphere : r.provider === s.EMAIL ? E.includes(l) && (P?.settings?.notification?.email?.enabled ?? !1) : !(r.type === "oauth" && !w.includes(l))).sort((r, u) => {
47
+ if (a) {
48
+ const h = r.provider === a, b = u.provider === a;
49
+ if (h && !b)
50
+ return -1;
51
+ if (!h && b)
52
+ return 1;
53
+ }
54
+ return !n(r?.order) && !n(u?.order) ? r.order - u.order : n(r?.order) ? n(u?.order) ? 0 : 1 : -1;
55
+ });
56
+ }, [v, a]), A = p(() => {
57
+ const i = o === "drawer" || L && c.mobile.any;
58
+ return globalThis?.blocklet ? !!(f.find((r) => r.provider === s.WALLET)?.showQrcode !== !0 || i) : !!i;
56
59
  }, [o, L, f]);
57
60
  return {
58
61
  hideChooseList: p(() => !1),
59
62
  hideQRCode: A,
60
63
  providerList: f,
61
- loadingProviderList: P
64
+ loadingProviderList: m
62
65
  };
63
66
  }
64
67
  export {
65
- j as default
68
+ Y as default
66
69
  };
@@ -1,4 +1,4 @@
1
- const o = "3.4.7", s = {
1
+ const o = "3.4.9", s = {
2
2
  version: o
3
3
  };
4
4
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/did-connect-react",
3
- "version": "3.4.7",
3
+ "version": "3.4.9",
4
4
  "description": "Client side library to work with DID Connect by ArcBlock.",
5
5
  "keywords": [
6
6
  "react",
@@ -32,17 +32,17 @@
32
32
  "url": "https://github.com/ArcBlock/ux/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/bridge": "3.4.7",
36
- "@arcblock/did": "^1.28.5",
37
- "@arcblock/icons": "3.4.7",
38
- "@arcblock/react-hooks": "3.4.7",
39
- "@arcblock/ws": "^1.28.5",
35
+ "@arcblock/bridge": "3.4.9",
36
+ "@arcblock/did": "^1.28.6",
37
+ "@arcblock/icons": "3.4.9",
38
+ "@arcblock/react-hooks": "3.4.9",
39
+ "@arcblock/ws": "^1.28.6",
40
40
  "@blocklet/constant": "^1.17.7",
41
41
  "@fontsource/lexend": "^5.2.9",
42
42
  "@iconify-icons/logos": "^1.2.36",
43
43
  "@iconify-icons/material-symbols": "^1.2.58",
44
44
  "@iconify/react": "^5.2.1",
45
- "@ocap/util": "^1.28.5",
45
+ "@ocap/util": "^1.28.6",
46
46
  "@simplewebauthn/browser": "^13.1.0",
47
47
  "ahooks": "^3.8.5",
48
48
  "axios": "^1.10.0",
@@ -85,5 +85,5 @@
85
85
  "eslint-plugin-react-hooks": "^4.6.2",
86
86
  "jest": "^29.7.0"
87
87
  },
88
- "gitHead": "eb0fca0015ba4ee80affb3b03d47505c45f8ec1c"
88
+ "gitHead": "e01324f3084f688f514eed2b5fb8d1c4b3e4247e"
89
89
  }
@@ -74,8 +74,14 @@ export default function useProviderList({
74
74
  );
75
75
 
76
76
  const showedLoginProviderList = useCreation(() => {
77
+ const allowedProviders = globalThis?.blocklet?.DID_CONNECT_ENABLED_PROVIDERS?.split(',') || [];
77
78
  const result = loginProviderList
78
79
  .filter((item) => {
80
+ if (allowedProviders.length > 0) {
81
+ if (!allowedProviders.includes(item.provider)) {
82
+ return false;
83
+ }
84
+ }
79
85
  if (item.provider === LOGIN_PROVIDER.WALLET) {
80
86
  return allowWallet;
81
87
  }