@arcblock/ux 3.0.30 → 3.0.31
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,11 @@
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
2
2
|
import { UserPublicInfo } from '@blocklet/js-sdk';
|
3
|
+
import { Ref } from 'react';
|
3
4
|
import { RequestAppInfo, CurrentAppInfo } from './auth-apps-info';
|
4
5
|
/**
|
5
6
|
* @example app/connect-to-did-space?appPid=zNKp8tdZUanWKnvhwZWvF2hKRutwM9ykLaY8&appDid=zNKp8tdZUanWKnvhwZWvF2hKRutwM9ykLaY8&appName=233&appDescription=456&appUrl=https://bbqaw5mgxc6fnihrwqcejcxvukkdgkk4anwxwk5msvm.did.abtnet.io/zh
|
6
7
|
*/
|
7
|
-
export default function AuthApps({ session, requestAppInfo, currentAppInfo, children, userInfo, hideSwitchConnect, hideAuthorize, hideCancel, notThisText, authorizeText, connectText, cancelText, useAnotherText, slotProps, onConnect, onAuthorize, onSwitchConnect, onCancel, }: {
|
8
|
+
export default function AuthApps({ session, requestAppInfo, currentAppInfo, children, userInfo, hideSwitchConnect, hideAuthorize, hideCancel, notThisText, authorizeText, connectText, cancelText, useAnotherText, slotProps, onConnect, onAuthorize, onSwitchConnect, onCancel, ref, }: {
|
8
9
|
session: any;
|
9
10
|
requestAppInfo: RequestAppInfo;
|
10
11
|
currentAppInfo: CurrentAppInfo;
|
@@ -27,4 +28,7 @@ export default function AuthApps({ session, requestAppInfo, currentAppInfo, chil
|
|
27
28
|
onAuthorize?: (done: () => void) => void;
|
28
29
|
onSwitchConnect?: (done: () => void) => void;
|
29
30
|
onCancel?: () => void;
|
31
|
+
ref: Ref<{
|
32
|
+
closeLoading: () => void;
|
33
|
+
}>;
|
30
34
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -1,17 +1,18 @@
|
|
1
|
-
import { jsx as e, jsxs as o, Fragment as
|
1
|
+
import { jsx as e, jsxs as o, Fragment as H } from "react/jsx-runtime";
|
2
2
|
import { CircularProgress as u, Box as l, Stack as N, Button as h, Typography as q, Link as E } from "@mui/material";
|
3
3
|
import { useReactive as G, useMemoizedFn as i } from "ahooks";
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import {
|
11
|
-
import
|
12
|
-
import
|
4
|
+
import c from "lodash/noop";
|
5
|
+
import { useImperativeHandle as J } from "react";
|
6
|
+
import K from "../did-connect-container.js";
|
7
|
+
import O from "./auth-apps-info.js";
|
8
|
+
import Q from "../../Center/index.js";
|
9
|
+
import V from "../landing-page.js";
|
10
|
+
import { translate as X } from "../../Locale/util.js";
|
11
|
+
import { useLocaleContext as Y } from "../../Locale/context.js";
|
12
|
+
import Z from "../../UserCard/index.js";
|
13
|
+
import { InfoType as _, CardType as $ } from "../../UserCard/types.js";
|
13
14
|
import { mergeSx as m } from "../../Util/style.js";
|
14
|
-
const
|
15
|
+
const P = {
|
15
16
|
en: {
|
16
17
|
notThis: "Not this?",
|
17
18
|
useAnother: "Use another",
|
@@ -27,8 +28,8 @@ const _ = {
|
|
27
28
|
cancel: "取消"
|
28
29
|
}
|
29
30
|
};
|
30
|
-
function
|
31
|
-
session:
|
31
|
+
function pe({
|
32
|
+
session: s,
|
32
33
|
requestAppInfo: p,
|
33
34
|
currentAppInfo: f,
|
34
35
|
children: g = null,
|
@@ -42,28 +43,31 @@ function ue({
|
|
42
43
|
cancelText: k = void 0,
|
43
44
|
useAnotherText: T = void 0,
|
44
45
|
slotProps: r = void 0,
|
45
|
-
onConnect: w =
|
46
|
-
onAuthorize: D =
|
47
|
-
onSwitchConnect: I =
|
48
|
-
onCancel: L =
|
46
|
+
onConnect: w = c,
|
47
|
+
onAuthorize: D = c,
|
48
|
+
onSwitchConnect: I = c,
|
49
|
+
onCancel: L = c,
|
50
|
+
ref: S
|
49
51
|
}) {
|
50
52
|
const n = G({
|
51
53
|
loading: !1
|
52
|
-
}), { locale:
|
54
|
+
}), { locale: W = "en" } = Y() || {}, t = i((R, U = {}) => X(P, R, W, "en", U)), a = i(() => {
|
53
55
|
n.loading = !1;
|
54
|
-
}), W = i(() => {
|
55
|
-
n.loading = !0, w?.(s);
|
56
56
|
}), j = i(() => {
|
57
|
-
n.loading = !0,
|
57
|
+
n.loading = !0, w?.(a);
|
58
58
|
}), B = i(() => {
|
59
|
-
n.loading = !0,
|
59
|
+
n.loading = !0, I?.(a);
|
60
60
|
}), F = i(() => {
|
61
|
+
n.loading = !0, D?.(a);
|
62
|
+
}), M = i(() => {
|
61
63
|
L?.();
|
62
64
|
});
|
63
|
-
if (
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
if (J(S, () => ({
|
66
|
+
closeLoading: a
|
67
|
+
})), s.loading || !s.initialized)
|
68
|
+
return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(u, {}) });
|
69
|
+
const d = x ?? s?.user;
|
70
|
+
return /* @__PURE__ */ e(V, { did: window.blocklet?.appPid, standalone: !0, children: /* @__PURE__ */ e(
|
67
71
|
l,
|
68
72
|
{
|
69
73
|
...r?.root,
|
@@ -74,7 +78,7 @@ function ue({
|
|
74
78
|
},
|
75
79
|
r?.root?.sx
|
76
80
|
),
|
77
|
-
children: /* @__PURE__ */ e(
|
81
|
+
children: /* @__PURE__ */ e(K, { hideCloseButton: !0, ...r?.didConnectContainer, children: /* @__PURE__ */ o(
|
78
82
|
l,
|
79
83
|
{
|
80
84
|
...r?.contentContainer,
|
@@ -97,9 +101,9 @@ function ue({
|
|
97
101
|
r?.contentContainer?.sx
|
98
102
|
),
|
99
103
|
children: [
|
100
|
-
/* @__PURE__ */ e(
|
101
|
-
|
102
|
-
/* @__PURE__ */ e(
|
104
|
+
/* @__PURE__ */ e(O, { requestAppInfo: p, currentAppInfo: f }),
|
105
|
+
d ? /* @__PURE__ */ o(H, { children: [
|
106
|
+
/* @__PURE__ */ e(Z, { user: d, showDid: !0, cardType: $.Detailed, infoType: _.Minimal }),
|
103
107
|
/* @__PURE__ */ e(l, {})
|
104
108
|
] }) : null,
|
105
109
|
g,
|
@@ -123,20 +127,20 @@ function ue({
|
|
123
127
|
variant: "outlined",
|
124
128
|
size: "large",
|
125
129
|
fullWidth: !0,
|
126
|
-
onClick:
|
130
|
+
onClick: M,
|
127
131
|
sx: {
|
128
132
|
color: "grey.500"
|
129
133
|
},
|
130
134
|
children: k || t("cancel")
|
131
135
|
}
|
132
136
|
),
|
133
|
-
|
137
|
+
d && !v ? /* @__PURE__ */ o(
|
134
138
|
h,
|
135
139
|
{
|
136
140
|
variant: "contained",
|
137
141
|
size: "large",
|
138
142
|
fullWidth: !0,
|
139
|
-
onClick:
|
143
|
+
onClick: F,
|
140
144
|
disabled: n.loading,
|
141
145
|
children: [
|
142
146
|
n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
|
@@ -150,7 +154,7 @@ function ue({
|
|
150
154
|
size: "large",
|
151
155
|
fullWidth: !0,
|
152
156
|
disabled: n.loading,
|
153
|
-
onClick:
|
157
|
+
onClick: j,
|
154
158
|
children: [
|
155
159
|
n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
|
156
160
|
b || t("connect")
|
@@ -158,7 +162,7 @@ function ue({
|
|
158
162
|
}
|
159
163
|
)
|
160
164
|
] }),
|
161
|
-
C || !
|
165
|
+
C || !d ? null : /* @__PURE__ */ e(l, { sx: { textAlign: "center" }, children: /* @__PURE__ */ o(
|
162
166
|
q,
|
163
167
|
{
|
164
168
|
variant: "body2",
|
@@ -175,7 +179,7 @@ function ue({
|
|
175
179
|
E,
|
176
180
|
{
|
177
181
|
underline: "hover",
|
178
|
-
onClick:
|
182
|
+
onClick: B,
|
179
183
|
sx: {
|
180
184
|
cursor: "pointer"
|
181
185
|
},
|
@@ -192,5 +196,5 @@ function ue({
|
|
192
196
|
) });
|
193
197
|
}
|
194
198
|
export {
|
195
|
-
|
199
|
+
pe as default
|
196
200
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.31",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -60,16 +60,16 @@
|
|
60
60
|
"react": "^19.0.0",
|
61
61
|
"react-router-dom": "^6.22.3"
|
62
62
|
},
|
63
|
-
"gitHead": "
|
63
|
+
"gitHead": "0a320cf26cee69b651a5cd708cd4fc0e44667cd7",
|
64
64
|
"dependencies": {
|
65
|
-
"@arcblock/bridge": "3.0.
|
65
|
+
"@arcblock/bridge": "3.0.31",
|
66
66
|
"@arcblock/did": "^1.21.0",
|
67
67
|
"@arcblock/did-motif": "^1.1.14",
|
68
|
-
"@arcblock/icons": "3.0.
|
69
|
-
"@arcblock/nft-display": "3.0.
|
70
|
-
"@arcblock/react-hooks": "3.0.
|
68
|
+
"@arcblock/icons": "3.0.31",
|
69
|
+
"@arcblock/nft-display": "3.0.31",
|
70
|
+
"@arcblock/react-hooks": "3.0.31",
|
71
71
|
"@blocklet/js-sdk": "^1.16.46",
|
72
|
-
"@blocklet/theme": "3.0.
|
72
|
+
"@blocklet/theme": "3.0.31",
|
73
73
|
"@fontsource/roboto": "~5.1.1",
|
74
74
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
75
75
|
"@iconify-icons/logos": "^1.2.36",
|
@@ -2,6 +2,7 @@ import { Box, BoxProps, Button, CircularProgress, Link, Stack, SxProps, Typograp
|
|
2
2
|
import { useMemoizedFn, useReactive } from 'ahooks';
|
3
3
|
import noop from 'lodash/noop';
|
4
4
|
import type { UserPublicInfo } from '@blocklet/js-sdk';
|
5
|
+
import { useImperativeHandle, Ref } from 'react';
|
5
6
|
|
6
7
|
import DIDConnectContainer from '../did-connect-container';
|
7
8
|
import AuthAppsInfo, { type RequestAppInfo, type CurrentAppInfo } from './auth-apps-info';
|
@@ -56,6 +57,7 @@ export default function AuthApps({
|
|
56
57
|
onAuthorize = noop,
|
57
58
|
onSwitchConnect = noop,
|
58
59
|
onCancel = noop,
|
60
|
+
ref,
|
59
61
|
}: {
|
60
62
|
session: any;
|
61
63
|
requestAppInfo: RequestAppInfo;
|
@@ -83,6 +85,7 @@ export default function AuthApps({
|
|
83
85
|
onAuthorize?: (done: () => void) => void;
|
84
86
|
onSwitchConnect?: (done: () => void) => void;
|
85
87
|
onCancel?: () => void;
|
88
|
+
ref: Ref<{ closeLoading: () => void }>;
|
86
89
|
}) {
|
87
90
|
const currentState = useReactive({
|
88
91
|
loading: false,
|
@@ -110,6 +113,10 @@ export default function AuthApps({
|
|
110
113
|
onCancel?.();
|
111
114
|
});
|
112
115
|
|
116
|
+
useImperativeHandle(ref, () => ({
|
117
|
+
closeLoading: handleCloseLoading,
|
118
|
+
}));
|
119
|
+
|
113
120
|
if (session.loading || !session.initialized) {
|
114
121
|
return (
|
115
122
|
<Center>
|