@arcblock/did-playground 3.0.12 → 3.0.14
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/lib/Action/index.js +23 -23
- package/package.json +4 -4
- package/src/Action/index.jsx +2 -2
package/lib/Action/index.js
CHANGED
|
@@ -5,17 +5,17 @@ import { useSize as ae } from "ahooks";
|
|
|
5
5
|
import ce from "@arcblock/react-hooks/lib/useBrowser";
|
|
6
6
|
import { styled as le, useTheme as ue } from "@arcblock/ux/lib/Theme";
|
|
7
7
|
import s from "lodash/isUndefined";
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
8
|
+
import { CircularProgress as fe, Dialog as me, DialogContent as de } from "@mui/material";
|
|
9
|
+
import ge from "@arcblock/did-connect/lib/Connect";
|
|
10
10
|
import k from "@arcblock/ux/lib/Button";
|
|
11
|
-
import { mergeProps as
|
|
12
|
-
import { SessionContext as
|
|
13
|
-
import { getMessage as i, actions as $, getActionName as q, getActionParams as
|
|
11
|
+
import { mergeProps as pe } from "@arcblock/ux/lib/Util";
|
|
12
|
+
import { SessionContext as be } from "./session.js";
|
|
13
|
+
import { getMessage as i, actions as $, getActionName as q, getActionParams as he } from "./actions.js";
|
|
14
14
|
function h({ onClose: u }) {
|
|
15
|
-
return /* @__PURE__ */ n(
|
|
15
|
+
return /* @__PURE__ */ n(Ce, { onClick: u, children: "×" });
|
|
16
16
|
}
|
|
17
17
|
h.propTypes = { onClose: t.func.isRequired };
|
|
18
|
-
const
|
|
18
|
+
const Ce = le("div")`
|
|
19
19
|
display: ${(u) => u.disableClose ? "none" : "block"};
|
|
20
20
|
position: absolute;
|
|
21
21
|
top: 1rem;
|
|
@@ -26,11 +26,11 @@ const we = le(fe)`
|
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
user-select: none;
|
|
28
28
|
`;
|
|
29
|
-
function
|
|
29
|
+
function E({ ...u }) {
|
|
30
30
|
const e = Object.assign({}, u);
|
|
31
31
|
s(e.autoClose) && (e.autoClose = !0), s(e.buttonText) && (e.buttonText = ""), s(e.buttonColor) && (e.buttonColor = "primary"), s(e.buttonVariant) && (e.buttonVariant = "contained"), s(e.buttonSize) && (e.buttonSize = "large"), s(e.buttonRounded) && (e.buttonRounded = !1), s(e.scanMessage) && (e.scanMessage = "Scan the QR Code with your DID Wallet"), s(e.confirmMessage) && (e.confirmMessage = "Confirm in your DID Wallet"), s(e.successMessage) && (e.successMessage = "Operation success!"), s(e.extraParams) && (e.extraParams = {}), s(e.timeout) && (e.timeout = 5 * 60 * 1e3), s(e.successUrl) && (e.successUrl = ""), s(e.successTarget) && (e.successTarget = "_self"), s(e.frameProps) && (e.frameProps = {}), s(e.webWalletUrl) && (e.webWalletUrl = "");
|
|
32
|
-
const
|
|
33
|
-
autoClose:
|
|
32
|
+
const I = pe(e, E, ["buttonRounded", "extraParams", "timeout"]), {
|
|
33
|
+
autoClose: B,
|
|
34
34
|
action: g,
|
|
35
35
|
buttonText: z,
|
|
36
36
|
buttonColor: C,
|
|
@@ -38,7 +38,7 @@ function B({ ...u }) {
|
|
|
38
38
|
buttonSize: y,
|
|
39
39
|
buttonRounded: P,
|
|
40
40
|
children: R,
|
|
41
|
-
disableClose:
|
|
41
|
+
disableClose: we,
|
|
42
42
|
title: S,
|
|
43
43
|
scanMessage: H,
|
|
44
44
|
successMessage: U,
|
|
@@ -50,10 +50,10 @@ function B({ ...u }) {
|
|
|
50
50
|
timeout: Q,
|
|
51
51
|
webWalletUrl: G,
|
|
52
52
|
...a
|
|
53
|
-
} =
|
|
53
|
+
} = I, D = ue(), W = ce(), { api: j, session: o } = ne(be), [x, T] = d(!1), [J, v] = d(!1), [X, Y] = d({}), Z = ae(document.body), [b, F] = d(!1), [c, _] = d(b && r && p === "frame"), ee = Z?.width || 0;
|
|
54
54
|
if (ie(
|
|
55
55
|
() => () => {
|
|
56
|
-
|
|
56
|
+
F(!1), _(!1);
|
|
57
57
|
},
|
|
58
58
|
[x]
|
|
59
59
|
), g === "login")
|
|
@@ -75,9 +75,9 @@ function B({ ...u }) {
|
|
|
75
75
|
const A = async () => {
|
|
76
76
|
if (typeof f.onStart == "function") {
|
|
77
77
|
try {
|
|
78
|
-
|
|
78
|
+
v(!0);
|
|
79
79
|
const V = await f.onStart(j, o);
|
|
80
|
-
Y(V),
|
|
80
|
+
Y(V), v(!1);
|
|
81
81
|
} catch {
|
|
82
82
|
console.error(`Cannot generate dynamicParams for playground action ${q(f, a)}`);
|
|
83
83
|
}
|
|
@@ -91,7 +91,7 @@ function B({ ...u }) {
|
|
|
91
91
|
}
|
|
92
92
|
await A();
|
|
93
93
|
}, m = () => T(!1), se = () => {
|
|
94
|
-
|
|
94
|
+
F(!0), r ? p === "frame" ? _(!!r) : p === "_blank" ? window.open(r, "_blank") : window.open(r, "_self") : R || B && setTimeout(m, 2e3);
|
|
95
95
|
}, oe = () => /* @__PURE__ */ l(M, { children: [
|
|
96
96
|
/* @__PURE__ */ n(h, { onClose: m }),
|
|
97
97
|
/* @__PURE__ */ l("div", { children: [
|
|
@@ -126,12 +126,12 @@ function B({ ...u }) {
|
|
|
126
126
|
children: [
|
|
127
127
|
i(z || S, o),
|
|
128
128
|
" ",
|
|
129
|
-
J && /* @__PURE__ */ n(
|
|
129
|
+
J && /* @__PURE__ */ n(fe, { size: 12, sx: { color: "#fff" } })
|
|
130
130
|
]
|
|
131
131
|
}
|
|
132
132
|
),
|
|
133
133
|
x && !O && /* @__PURE__ */ n(
|
|
134
|
-
|
|
134
|
+
me,
|
|
135
135
|
{
|
|
136
136
|
open: !0,
|
|
137
137
|
disableEscapeKeyDown: !0,
|
|
@@ -139,7 +139,7 @@ function B({ ...u }) {
|
|
|
139
139
|
fullWidth: c,
|
|
140
140
|
maxWidth: c ? "lg" : "",
|
|
141
141
|
children: /* @__PURE__ */ l(
|
|
142
|
-
|
|
142
|
+
de,
|
|
143
143
|
{
|
|
144
144
|
style: {
|
|
145
145
|
padding: b && !c && r ? 55 : 0,
|
|
@@ -158,7 +158,7 @@ function B({ ...u }) {
|
|
|
158
158
|
}
|
|
159
159
|
),
|
|
160
160
|
/* @__PURE__ */ n(
|
|
161
|
-
|
|
161
|
+
ge,
|
|
162
162
|
{
|
|
163
163
|
popup: !0,
|
|
164
164
|
open: x && O,
|
|
@@ -167,7 +167,7 @@ function B({ ...u }) {
|
|
|
167
167
|
onClose: m,
|
|
168
168
|
onSuccess: se,
|
|
169
169
|
checkTimeout: Q,
|
|
170
|
-
extraParams: Object.assign(
|
|
170
|
+
extraParams: Object.assign(he(f, a, o), X, N),
|
|
171
171
|
webWalletUrl: G,
|
|
172
172
|
messages: {
|
|
173
173
|
title: i(S, o),
|
|
@@ -179,7 +179,7 @@ function B({ ...u }) {
|
|
|
179
179
|
)
|
|
180
180
|
] });
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
E.propTypes = {
|
|
183
183
|
action: t.string.isRequired,
|
|
184
184
|
autoClose: t.bool,
|
|
185
185
|
buttonText: t.string,
|
|
@@ -199,5 +199,5 @@ B.propTypes = {
|
|
|
199
199
|
webWalletUrl: t.string
|
|
200
200
|
};
|
|
201
201
|
export {
|
|
202
|
-
|
|
202
|
+
E as default
|
|
203
203
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did-playground",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"description": "React components that works with wallet-playground",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"url": "https://github.com/ArcBlock/wallet-playground/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@arcblock/did-connect": "3.0.
|
|
34
|
-
"@arcblock/react-hooks": "3.0.
|
|
33
|
+
"@arcblock/did-connect": "3.0.14",
|
|
34
|
+
"@arcblock/react-hooks": "3.0.14",
|
|
35
35
|
"ahooks": "^3.8.5",
|
|
36
36
|
"axios": "^1.10.0",
|
|
37
37
|
"mustache": "^4.2.0"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "3957f4585b68497a5f297c25649f8759e98c6c7a"
|
|
50
50
|
}
|
package/src/Action/index.jsx
CHANGED
|
@@ -5,7 +5,7 @@ import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
|
|
5
5
|
import { styled, useTheme } from '@arcblock/ux/lib/Theme';
|
|
6
6
|
import isUndefined from 'lodash/isUndefined';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { CircularProgress, Dialog, DialogContent } from '@mui/material';
|
|
9
9
|
|
|
10
10
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
11
11
|
import Button from '@arcblock/ux/lib/Button';
|
|
@@ -19,7 +19,7 @@ function Close({ onClose }) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
Close.propTypes = { onClose: PropTypes.func.isRequired };
|
|
22
|
-
const CloseContainer = styled(
|
|
22
|
+
const CloseContainer = styled('div')`
|
|
23
23
|
display: ${(props) => (props.disableClose ? 'none' : 'block')};
|
|
24
24
|
position: absolute;
|
|
25
25
|
top: 1rem;
|