@arcblock/did-playground 3.0.9 → 3.0.10

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 (2) hide show
  1. package/lib/Action/index.js +52 -52
  2. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import { jsx as n, jsxs as l, Fragment as k } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as l, Fragment as M } from "react/jsx-runtime";
2
2
  import { use as ne, useState as d, useEffect as ie } from "react";
3
3
  import t from "prop-types";
4
4
  import { useSize as ae } from "ahooks";
@@ -7,10 +7,10 @@ import { styled as le, useTheme as ue } from "@arcblock/ux/lib/Theme";
7
7
  import s from "lodash/isUndefined";
8
8
  import { CircularProgress as fe, Dialog as me, DialogContent as de } from "@mui/material";
9
9
  import ge from "@arcblock/did-connect/lib/Connect";
10
- import R from "@arcblock/ux/lib/Button";
10
+ import k from "@arcblock/ux/lib/Button";
11
11
  import { mergeProps as pe } from "@arcblock/ux/lib/Util";
12
12
  import { SessionContext as be } from "./session.js";
13
- import { getMessage as i, actions as q, getActionName as E, getActionParams as he } from "./actions.js";
13
+ import { getMessage as i, actions as $, getActionName as q, getActionParams as he } from "./actions.js";
14
14
  function h({ onClose: u }) {
15
15
  return /* @__PURE__ */ n(Ce, { onClick: u, children: "×" });
16
16
  }
@@ -26,39 +26,39 @@ const Ce = le("div")`
26
26
  cursor: pointer;
27
27
  user-select: none;
28
28
  `;
29
- function I({ ...u }) {
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 B = pe(e, I, ["buttonRounded", "extraParams", "timeout"]), {
33
- autoClose: H,
32
+ const I = pe(e, E, ["buttonRounded", "extraParams", "timeout"]), {
33
+ autoClose: B,
34
34
  action: g,
35
- buttonText: U,
35
+ buttonText: z,
36
36
  buttonColor: C,
37
37
  buttonVariant: w,
38
38
  buttonSize: y,
39
39
  buttonRounded: P,
40
- children: D,
40
+ children: R,
41
41
  disableClose: we,
42
42
  title: S,
43
- scanMessage: K,
44
- successMessage: z,
43
+ scanMessage: H,
44
+ successMessage: U,
45
45
  successUrl: r,
46
46
  successTarget: p,
47
- frameProps: L,
48
- confirmMessage: N,
49
- extraParams: Q,
50
- timeout: G,
51
- webWalletUrl: J,
47
+ frameProps: K,
48
+ confirmMessage: L,
49
+ extraParams: N,
50
+ timeout: Q,
51
+ webWalletUrl: G,
52
52
  ...a
53
- } = B, W = ue(), j = ce(), { api: v, session: o } = ne(be), [x, T] = d(!1), [X, F] = d(!1), [Y, Z] = d({}), M = ae(document.body), [b, _] = d(!1), [c, A] = d(b && r && p === "frame"), ee = (M == null ? void 0 : M.width) || 0;
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
- _(!1), A(!1);
56
+ F(!1), _(!1);
57
57
  },
58
58
  [x]
59
59
  ), g === "login")
60
- return o.user ? /* @__PURE__ */ n(R, { ...a, rounded: P, color: C, variant: w, size: y, children: i(z || `Hello ${o.user.name}`, o) }) : /* @__PURE__ */ n(
61
- R,
60
+ return o.user ? /* @__PURE__ */ n(k, { ...a, rounded: P, color: C, variant: w, size: y, children: i(U || `Hello ${o.user.name}`, o) }) : /* @__PURE__ */ n(
61
+ k,
62
62
  {
63
63
  ...a,
64
64
  rounded: P,
@@ -66,40 +66,40 @@ function I({ ...u }) {
66
66
  variant: w,
67
67
  size: y,
68
68
  onClick: () => o.login(),
69
- children: i(U || S, o)
69
+ children: i(z || S, o)
70
70
  }
71
71
  );
72
- const f = q[g];
73
- if (!q[g])
72
+ const f = $[g];
73
+ if (!$[g])
74
74
  throw new Error(`Unsupported playground action ${g}`);
75
- const O = async () => {
75
+ const A = async () => {
76
76
  if (typeof f.onStart == "function") {
77
77
  try {
78
- F(!0);
79
- const $ = await f.onStart(v, o);
80
- Z($), F(!1);
78
+ v(!0);
79
+ const V = await f.onStart(j, o);
80
+ Y(V), v(!1);
81
81
  } catch {
82
- console.error(`Cannot generate dynamicParams for playground action ${E(f, a)}`);
82
+ console.error(`Cannot generate dynamicParams for playground action ${q(f, a)}`);
83
83
  }
84
84
  T(!0);
85
85
  } else
86
86
  T(!0);
87
87
  }, te = async () => {
88
88
  if (!o.user) {
89
- o.login(O);
89
+ o.login(A);
90
90
  return;
91
91
  }
92
- await O();
92
+ await A();
93
93
  }, m = () => T(!1), se = () => {
94
- _(!0), r ? p === "frame" ? A(!!r) : p === "_blank" ? window.open(r, "_blank") : window.open(r, "_self") : D || H && setTimeout(m, 2e3);
95
- }, oe = () => /* @__PURE__ */ l(k, { children: [
94
+ F(!0), r ? p === "frame" ? _(!!r) : p === "_blank" ? window.open(r, "_blank") : window.open(r, "_self") : R || B && setTimeout(m, 2e3);
95
+ }, oe = () => /* @__PURE__ */ l(M, { children: [
96
96
  /* @__PURE__ */ n(h, { onClose: m }),
97
97
  /* @__PURE__ */ l("div", { children: [
98
98
  "Redirecting to",
99
99
  " ",
100
100
  /* @__PURE__ */ n("a", { href: r, target: p, children: r })
101
101
  ] })
102
- ] }), re = () => /* @__PURE__ */ l(k, { children: [
102
+ ] }), re = () => /* @__PURE__ */ l(M, { children: [
103
103
  /* @__PURE__ */ n(h, { onClose: m }),
104
104
  /* @__PURE__ */ n(
105
105
  "iframe",
@@ -109,13 +109,13 @@ function I({ ...u }) {
109
109
  id: "successFrame",
110
110
  title: "successFrame",
111
111
  src: r,
112
- ...L
112
+ ...K
113
113
  }
114
114
  )
115
- ] }), V = !r || r && !b;
116
- return /* @__PURE__ */ l(k, { children: [
115
+ ] }), O = !r || r && !b;
116
+ return /* @__PURE__ */ l(M, { children: [
117
117
  /* @__PURE__ */ l(
118
- R,
118
+ k,
119
119
  {
120
120
  ...a,
121
121
  rounded: P,
@@ -124,18 +124,18 @@ function I({ ...u }) {
124
124
  size: y,
125
125
  onClick: te,
126
126
  children: [
127
- i(U || S, o),
127
+ i(z || S, o),
128
128
  " ",
129
- X && /* @__PURE__ */ n(fe, { size: 12, sx: { color: "#fff" } })
129
+ J && /* @__PURE__ */ n(fe, { size: 12, sx: { color: "#fff" } })
130
130
  ]
131
131
  }
132
132
  ),
133
- x && !V && /* @__PURE__ */ n(
133
+ x && !O && /* @__PURE__ */ n(
134
134
  me,
135
135
  {
136
136
  open: !0,
137
137
  disableEscapeKeyDown: !0,
138
- fullScreen: ee < W.breakpoints.values.sm && !(j.wallet || j.arcSphere),
138
+ fullScreen: ee < D.breakpoints.values.sm && !(W.wallet || W.arcSphere),
139
139
  fullWidth: c,
140
140
  maxWidth: c ? "lg" : "",
141
141
  children: /* @__PURE__ */ l(
@@ -146,7 +146,7 @@ function I({ ...u }) {
146
146
  display: "flex",
147
147
  justifyContent: "center",
148
148
  alignItems: "center",
149
- height: c ? W.breakpoints.values.md : ""
149
+ height: c ? D.breakpoints.values.md : ""
150
150
  },
151
151
  children: [
152
152
  /* @__PURE__ */ n(h, { onClose: m }),
@@ -161,25 +161,25 @@ function I({ ...u }) {
161
161
  ge,
162
162
  {
163
163
  popup: !0,
164
- open: x && V,
165
- action: E(f, a),
166
- checkFn: v.get,
164
+ open: x && O,
165
+ action: q(f, a),
166
+ checkFn: j.get,
167
167
  onClose: m,
168
168
  onSuccess: se,
169
- checkTimeout: G,
170
- extraParams: Object.assign(he(f, a, o), Y, Q),
171
- webWalletUrl: J,
169
+ checkTimeout: Q,
170
+ extraParams: Object.assign(he(f, a, o), X, N),
171
+ webWalletUrl: G,
172
172
  messages: {
173
173
  title: i(S, o),
174
- scan: i(K, o),
175
- confirm: i(N, o),
176
- success: D || i(z, o)
174
+ scan: i(H, o),
175
+ confirm: i(L, o),
176
+ success: R || i(U, o)
177
177
  }
178
178
  }
179
179
  )
180
180
  ] });
181
181
  }
182
- I.propTypes = {
182
+ E.propTypes = {
183
183
  action: t.string.isRequired,
184
184
  autoClose: t.bool,
185
185
  buttonText: t.string,
@@ -199,5 +199,5 @@ I.propTypes = {
199
199
  webWalletUrl: t.string
200
200
  };
201
201
  export {
202
- I as default
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.9",
3
+ "version": "3.0.10",
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.9",
34
- "@arcblock/react-hooks": "3.0.9",
33
+ "@arcblock/did-connect": "3.0.10",
34
+ "@arcblock/react-hooks": "3.0.10",
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": "e2283285cb6e99f09146cde5e1af002e55091619"
49
+ "gitHead": "8e4b3b4f9cc52c8f1f1d270ab03a3c566073617a"
50
50
  }