@arcblock/did-playground 2.13.70 → 3.0.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.
@@ -1,272 +1,203 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _ahooks = require("ahooks");
10
- var _useBrowser = _interopRequireDefault(require("@arcblock/react-hooks/lib/useBrowser"));
11
- var _Theme = require("@arcblock/ux/lib/Theme");
12
- var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
13
- var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
14
- var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
15
- var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
16
- var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
17
- var _Util = require("@arcblock/ux/lib/Util");
18
- var _session = require("./session");
19
- var _actions = require("./actions");
20
- var _jsxRuntime = require("react/jsx-runtime");
21
- const _excluded = ["autoClose", "action", "buttonText", "buttonColor", "buttonVariant", "buttonSize", "buttonRounded", "children", "disableClose", "title", "scanMessage", "successMessage", "successUrl", "successTarget", "frameProps", "confirmMessage", "extraParams", "timeout", "webWalletUrl"];
22
- var _templateObject;
23
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
27
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
28
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
30
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
31
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
32
- function Close(_ref) {
33
- let {
34
- onClose
35
- } = _ref;
36
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseContainer, {
37
- onClick: onClose,
38
- children: "\xD7"
39
- });
1
+ import { jsx as n, jsxs as l, Fragment as k } from "react/jsx-runtime";
2
+ import { use as ne, useState as d, useEffect as ie } from "react";
3
+ import t from "prop-types";
4
+ import { useSize as ae } from "ahooks";
5
+ import ce from "@arcblock/react-hooks/lib/useBrowser";
6
+ import { styled as le, useTheme as ue } from "@arcblock/ux/lib/Theme";
7
+ import s from "lodash/isUndefined";
8
+ import { CircularProgress as fe, Dialog as me, DialogContent as de } from "@mui/material";
9
+ import ge from "@arcblock/did-connect/lib/Connect";
10
+ import R from "@arcblock/ux/lib/Button";
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 q, getActionName as E, getActionParams as he } from "./actions.js";
14
+ function h({ onClose: u }) {
15
+ return /* @__PURE__ */ n(Ce, { onClick: u, children: "×" });
40
16
  }
41
- Close.propTypes = {
42
- onClose: _propTypes.default.func.isRequired
43
- };
44
- const CloseContainer = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: ", ";\n position: absolute;\n top: 1rem;\n right: 1rem;\n color: #999999;\n font-size: 2rem;\n line-height: 1rem;\n cursor: pointer;\n user-select: none;\n"])), props => props.disableClose ? 'none' : 'block');
45
- function PlaygroundAction(props) {
46
- const newProps = (0, _Util.mergeProps)(props, PlaygroundAction, ['buttonRounded', 'extraParams', 'timeout']);
47
- const {
48
- autoClose,
49
- action,
50
- buttonText,
51
- buttonColor,
52
- buttonVariant,
53
- buttonSize,
54
- buttonRounded,
55
- children,
56
- disableClose,
57
- title,
58
- scanMessage,
59
- successMessage,
60
- successUrl,
61
- successTarget,
62
- frameProps,
63
- confirmMessage,
64
- extraParams,
65
- timeout,
66
- webWalletUrl
67
- } = newProps,
68
- rest = _objectWithoutProperties(newProps, _excluded);
69
- const theme = (0, _Theme.useTheme)();
70
- const browser = (0, _useBrowser.default)();
71
- const {
72
- api,
73
- session
74
- } = (0, _react.useContext)(_session.SessionContext);
75
- const [open, setOpen] = (0, _react.useState)(false);
76
- const [loading, setLoading] = (0, _react.useState)(false);
77
- const [dynamicParams, setDynamicParams] = (0, _react.useState)({});
78
- const size = (0, _ahooks.useSize)(document.body);
79
- const [success, setSuccess] = (0, _react.useState)(false);
80
- const [showFrame, setShowFrame] = (0, _react.useState)(success && successUrl && successTarget === 'frame');
81
- const width = (size === null || size === void 0 ? void 0 : size.width) || 0;
82
-
83
- // 当打开或关闭组件时,重置部分状态
84
- (0, _react.useEffect)(() => () => {
85
- setSuccess(false);
86
- setShowFrame(false);
87
- }, [open]);
88
-
89
- // If this is just a login button, we do not do anything actually
90
- if (action === 'login') {
91
- if (session.user) {
92
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread({}, rest), {}, {
93
- rounded: buttonRounded,
94
- color: buttonColor,
95
- variant: buttonVariant,
96
- size: buttonSize,
97
- children: (0, _actions.getMessage)(successMessage || "Hello ".concat(session.user.name), session)
98
- }));
99
- }
100
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread({}, rest), {}, {
101
- rounded: buttonRounded,
102
- color: buttonColor,
103
- variant: buttonVariant,
104
- size: buttonSize,
105
- onClick: () => session.login(),
106
- children: (0, _actions.getMessage)(buttonText || title, session)
107
- }));
108
- }
109
- const config = _actions.actions[action];
110
- if (!_actions.actions[action]) {
111
- throw new Error("Unsupported playground action ".concat(action));
112
- }
113
- const doStart = async () => {
114
- if (typeof config.onStart === 'function') {
17
+ h.propTypes = { onClose: t.func.isRequired };
18
+ const Ce = le("div")`
19
+ display: ${(u) => u.disableClose ? "none" : "block"};
20
+ position: absolute;
21
+ top: 1rem;
22
+ right: 1rem;
23
+ color: #999999;
24
+ font-size: 2rem;
25
+ line-height: 1rem;
26
+ cursor: pointer;
27
+ user-select: none;
28
+ `;
29
+ function I(u) {
30
+ const e = Object.assign({}, u);
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,
34
+ action: g,
35
+ buttonText: U,
36
+ buttonColor: C,
37
+ buttonVariant: w,
38
+ buttonSize: y,
39
+ buttonRounded: P,
40
+ children: D,
41
+ disableClose: we,
42
+ title: S,
43
+ scanMessage: K,
44
+ successMessage: z,
45
+ successUrl: r,
46
+ successTarget: p,
47
+ frameProps: L,
48
+ confirmMessage: N,
49
+ extraParams: Q,
50
+ timeout: G,
51
+ webWalletUrl: J,
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;
54
+ if (ie(
55
+ () => () => {
56
+ _(!1), A(!1);
57
+ },
58
+ [x]
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,
62
+ {
63
+ ...a,
64
+ rounded: P,
65
+ color: C,
66
+ variant: w,
67
+ size: y,
68
+ onClick: () => o.login(),
69
+ children: i(U || S, o)
70
+ }
71
+ );
72
+ const f = q[g];
73
+ if (!q[g])
74
+ throw new Error(`Unsupported playground action ${g}`);
75
+ const O = async () => {
76
+ if (typeof f.onStart == "function") {
115
77
  try {
116
- setLoading(true);
117
- const params = await config.onStart(api, session);
118
- setDynamicParams(params);
119
- setLoading(false);
120
- } catch (err) {
121
- console.error("Cannot generate dynamicParams for playground action ".concat((0, _actions.getActionName)(config, rest)));
78
+ F(!0);
79
+ const $ = await f.onStart(v, o);
80
+ Z($), F(!1);
81
+ } catch {
82
+ console.error(`Cannot generate dynamicParams for playground action ${E(f, a)}`);
122
83
  }
123
- setOpen(true);
124
- } else {
125
- setOpen(true);
126
- }
127
- };
128
- const onStart = async () => {
129
- if (!session.user) {
130
- session.login(doStart);
84
+ T(!0);
85
+ } else
86
+ T(!0);
87
+ }, te = async () => {
88
+ if (!o.user) {
89
+ o.login(O);
131
90
  return;
132
91
  }
133
- await doStart();
134
- };
135
- const onClose = () => setOpen(false);
136
- const onSuccess = () => {
137
- setSuccess(true);
138
- if (successUrl) {
139
- if (successTarget === 'frame') {
140
- setShowFrame(!!successUrl);
141
- } else if (successTarget === '_blank') {
142
- // 这里是安全的
143
- window.open(successUrl, '_blank');
144
- } else {
145
- // 这里是安全的
146
- window.open(successUrl, '_self');
92
+ await O();
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: [
96
+ /* @__PURE__ */ n(h, { onClose: m }),
97
+ /* @__PURE__ */ l("div", { children: [
98
+ "Redirecting to",
99
+ " ",
100
+ /* @__PURE__ */ n("a", { href: r, target: p, children: r })
101
+ ] })
102
+ ] }), re = () => /* @__PURE__ */ l(k, { children: [
103
+ /* @__PURE__ */ n(h, { onClose: m }),
104
+ /* @__PURE__ */ n(
105
+ "iframe",
106
+ {
107
+ style: { width: "100%", height: "100%" },
108
+ allow: "fullscreen",
109
+ id: "successFrame",
110
+ title: "successFrame",
111
+ src: r,
112
+ ...L
147
113
  }
148
- } else if (children) {
149
- // Do nothing
150
- } else if (autoClose) {
151
- setTimeout(onClose, 2000);
152
- }
153
- };
154
- const renderRedirectUrlAfterSuccess = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
155
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Close, {
156
- onClose: onClose
157
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
158
- children: ["Redirecting to", ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
159
- href: successUrl,
160
- target: successTarget,
161
- children: successUrl
162
- })]
163
- })]
164
- });
165
- const renderFrameAfterSuccess = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
166
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Close, {
167
- onClose: onClose
168
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", _objectSpread({
169
- style: {
170
- width: '100%',
171
- height: '100%'
172
- },
173
- allow: "fullscreen",
174
- id: "successFrame",
175
- title: "successFrame",
176
- src: successUrl
177
- }, frameProps))]
178
- });
179
- const showDidConnect = !successUrl || successUrl && !success;
180
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
181
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, _objectSpread(_objectSpread({}, rest), {}, {
182
- rounded: buttonRounded,
183
- color: buttonColor,
184
- variant: buttonVariant,
185
- size: buttonSize,
186
- onClick: onStart,
187
- children: [(0, _actions.getMessage)(buttonText || title, session), " ", loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
188
- size: 12,
189
- sx: {
190
- color: '#fff'
114
+ )
115
+ ] }), V = !r || r && !b;
116
+ return /* @__PURE__ */ l(k, { children: [
117
+ /* @__PURE__ */ l(
118
+ R,
119
+ {
120
+ ...a,
121
+ rounded: P,
122
+ color: C,
123
+ variant: w,
124
+ size: y,
125
+ onClick: te,
126
+ children: [
127
+ i(U || S, o),
128
+ " ",
129
+ X && /* @__PURE__ */ n(fe, { size: 12, sx: { color: "#fff" } })
130
+ ]
131
+ }
132
+ ),
133
+ x && !V && /* @__PURE__ */ n(
134
+ me,
135
+ {
136
+ open: !0,
137
+ disableEscapeKeyDown: !0,
138
+ fullScreen: ee < W.breakpoints.values.sm && !(j.wallet || j.arcSphere),
139
+ fullWidth: c,
140
+ maxWidth: c ? "lg" : "",
141
+ children: /* @__PURE__ */ l(
142
+ de,
143
+ {
144
+ style: {
145
+ padding: b && !c && r ? 55 : 0,
146
+ display: "flex",
147
+ justifyContent: "center",
148
+ alignItems: "center",
149
+ height: c ? W.breakpoints.values.md : ""
150
+ },
151
+ children: [
152
+ /* @__PURE__ */ n(h, { onClose: m }),
153
+ r && b && !c && oe(),
154
+ c && re()
155
+ ]
156
+ }
157
+ )
158
+ }
159
+ ),
160
+ /* @__PURE__ */ n(
161
+ ge,
162
+ {
163
+ popup: !0,
164
+ open: x && V,
165
+ action: E(f, a),
166
+ checkFn: v.get,
167
+ onClose: m,
168
+ onSuccess: se,
169
+ checkTimeout: G,
170
+ extraParams: Object.assign(he(f, a, o), Y, Q),
171
+ webWalletUrl: J,
172
+ messages: {
173
+ title: i(S, o),
174
+ scan: i(K, o),
175
+ confirm: i(N, o),
176
+ success: D || i(z, o)
191
177
  }
192
- })]
193
- })), open && !showDidConnect && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
194
- open: true,
195
- disableEscapeKeyDown: true,
196
- fullScreen: width < theme.breakpoints.values.sm && !(browser.wallet || browser.arcSphere),
197
- fullWidth: showFrame,
198
- maxWidth: showFrame ? 'lg' : '',
199
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_DialogContent.default, {
200
- style: {
201
- padding: success && !showFrame && successUrl ? 55 : 0,
202
- display: 'flex',
203
- justifyContent: 'center',
204
- alignItems: 'center',
205
- height: showFrame ? theme.breakpoints.values.md : ''
206
- },
207
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Close, {
208
- onClose: onClose
209
- }), successUrl && success && !showFrame && renderRedirectUrlAfterSuccess(), showFrame && renderFrameAfterSuccess()]
210
- })
211
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
212
- popup: true,
213
- open: open && showDidConnect,
214
- action: (0, _actions.getActionName)(config, rest),
215
- checkFn: api.get,
216
- onClose: onClose,
217
- onSuccess: onSuccess,
218
- checkTimeout: timeout
219
- // 3 layers of extraParams: user props, dynamically generated, from other props
220
- ,
221
- extraParams: Object.assign((0, _actions.getActionParams)(config, rest, session), dynamicParams, extraParams),
222
- webWalletUrl: webWalletUrl,
223
- messages: {
224
- title: (0, _actions.getMessage)(title, session),
225
- scan: (0, _actions.getMessage)(scanMessage, session),
226
- confirm: (0, _actions.getMessage)(confirmMessage, session),
227
- success: children || (0, _actions.getMessage)(successMessage, session)
228
178
  }
229
- })]
230
- });
179
+ )
180
+ ] });
231
181
  }
232
- PlaygroundAction.propTypes = {
233
- action: _propTypes.default.string.isRequired,
234
- autoClose: _propTypes.default.bool,
235
- buttonText: _propTypes.default.string,
236
- buttonColor: _propTypes.default.string,
237
- buttonVariant: _propTypes.default.string,
238
- buttonSize: _propTypes.default.string,
239
- buttonRounded: _propTypes.default.bool,
240
- title: _propTypes.default.string.isRequired,
241
- scanMessage: _propTypes.default.string,
242
- successMessage: _propTypes.default.string,
243
- confirmMessage: _propTypes.default.string,
244
- extraParams: _propTypes.default.object,
245
- timeout: _propTypes.default.number,
246
- successUrl: _propTypes.default.string,
247
- successTarget: _propTypes.default.oneOf(['_blank', '_self', 'frame']),
248
- frameProps: _propTypes.default.object,
249
- webWalletUrl: _propTypes.default.string
182
+ I.propTypes = {
183
+ action: t.string.isRequired,
184
+ autoClose: t.bool,
185
+ buttonText: t.string,
186
+ buttonColor: t.string,
187
+ buttonVariant: t.string,
188
+ buttonSize: t.string,
189
+ buttonRounded: t.bool,
190
+ title: t.string.isRequired,
191
+ scanMessage: t.string,
192
+ successMessage: t.string,
193
+ confirmMessage: t.string,
194
+ extraParams: t.object,
195
+ timeout: t.number,
196
+ successUrl: t.string,
197
+ successTarget: t.oneOf(["_blank", "_self", "frame"]),
198
+ frameProps: t.object,
199
+ webWalletUrl: t.string
250
200
  };
251
- PlaygroundAction.defaultProps = {
252
- autoClose: true,
253
- // 只在没有 successUrl 属性下有效
254
- buttonText: '',
255
- buttonColor: 'primary',
256
- // primary | secondary | reverse | error
257
- buttonVariant: 'contained',
258
- // contained | outlined | default
259
- buttonSize: 'large',
260
- // small | large | medium
261
- buttonRounded: false,
262
- scanMessage: 'Scan the QR Code with your DID Wallet',
263
- confirmMessage: 'Confirm in your DID Wallet',
264
- successMessage: 'Operation success!',
265
- extraParams: {},
266
- timeout: 5 * 60 * 1000,
267
- successUrl: '',
268
- successTarget: '_self',
269
- frameProps: {},
270
- webWalletUrl: ''
201
+ export {
202
+ I as default
271
203
  };
272
- var _default = exports.default = PlaygroundAction;
@@ -1,17 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.withSession = exports.SessionProvider = exports.SessionContext = exports.SessionConsumer = void 0;
7
- var _Session = require("@arcblock/did-connect/lib/Session");
8
- const {
9
- SessionProvider,
10
- SessionContext,
11
- SessionConsumer,
12
- withSession
13
- } = (0, _Session.createAuthServiceSessionContext)();
14
- exports.withSession = withSession;
15
- exports.SessionConsumer = SessionConsumer;
16
- exports.SessionContext = SessionContext;
17
- exports.SessionProvider = SessionProvider;
1
+ import { createAuthServiceSessionContext as e } from "@arcblock/did-connect/lib/Session";
2
+ const { SessionProvider: s, SessionContext: t, SessionConsumer: i, withSession: n } = e();
3
+ export {
4
+ i as SessionConsumer,
5
+ t as SessionContext,
6
+ s as SessionProvider,
7
+ n as withSession
8
+ };
package/lib/index.js CHANGED
@@ -1,32 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "PlaygroundAction", {
7
- enumerable: true,
8
- get: function get() {
9
- return _Action.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "SessionConsumer", {
13
- enumerable: true,
14
- get: function get() {
15
- return _session.SessionConsumer;
16
- }
17
- });
18
- Object.defineProperty(exports, "SessionContext", {
19
- enumerable: true,
20
- get: function get() {
21
- return _session.SessionContext;
22
- }
23
- });
24
- Object.defineProperty(exports, "SessionProvider", {
25
- enumerable: true,
26
- get: function get() {
27
- return _session.SessionProvider;
28
- }
29
- });
30
- var _Action = _interopRequireDefault(require("./Action"));
31
- var _session = require("./Action/session");
32
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
1
+ import { default as r } from "./Action/index.js";
2
+ import { SessionConsumer as n, SessionContext as t, SessionProvider as i } from "./Action/session.js";
3
+ export {
4
+ r as PlaygroundAction,
5
+ n as SessionConsumer,
6
+ t as SessionContext,
7
+ i as SessionProvider
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/did-playground",
3
- "version": "2.13.70",
3
+ "version": "3.0.0",
4
4
  "description": "React components that works with wallet-playground",
5
5
  "keywords": [
6
6
  "react",
@@ -18,8 +18,8 @@
18
18
  "scripts": {
19
19
  "lint": "eslint src tests --ext js --ext jsx",
20
20
  "lint:fix": "npm run lint -- --fix",
21
- "build": "../../node_modules/.bin/babel src --out-dir lib --copy-files",
22
- "watch": "../../node_modules/.bin/babel src --out-dir lib -w --copy-files",
21
+ "build": "vite build",
22
+ "watch": "vite build --watch",
23
23
  "precommit": "CI=1 npm run lint",
24
24
  "prepush": "CI=1 npm run lint",
25
25
  "prepublish": "npm run build",
@@ -30,28 +30,21 @@
30
30
  "url": "https://github.com/ArcBlock/wallet-playground/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@arcblock/did-connect": "^2.13.70",
34
- "@arcblock/react-hooks": "^2.13.70",
35
- "ahooks": "^3.7.10",
36
- "axios": "^1.7.5",
37
- "core-js": "^3.25.5",
33
+ "@arcblock/did-connect": "3.0.0",
34
+ "@arcblock/react-hooks": "3.0.0",
35
+ "ahooks": "^3.8.5",
36
+ "axios": "^1.10.0",
38
37
  "mustache": "^4.2.0"
39
38
  },
40
39
  "peerDependencies": {
41
- "@arcblock/ux": "^2.11.48",
42
- "@emotion/react": "^11.10.4",
43
- "@emotion/styled": "^11.10.4",
44
- "@mui/material": "^5.15.0",
45
- "react": "^18.2.0"
46
- },
47
- "devDependencies": {
48
- "@babel/cli": "^7.19.3",
49
- "@babel/core": "^7.19.3",
50
- "@babel/preset-env": "^7.19.3",
51
- "@babel/preset-react": "^7.18.6"
40
+ "@arcblock/ux": "workspace:*",
41
+ "@emotion/react": "^11.14.0",
42
+ "@emotion/styled": "^11.14.0",
43
+ "@mui/material": "^7.1.2",
44
+ "react": "^19.0.0"
52
45
  },
53
46
  "publishConfig": {
54
47
  "access": "public"
55
48
  },
56
- "gitHead": "b38a83a2c7d9a22e90bab369d8f61340db2abbd0"
49
+ "gitHead": "b001c32ca85d40d8a0784ca581bfd54d90550b24"
57
50
  }