@arcblock/did-playground 1.4.12 → 1.6.59
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/LICENSE +1 -1
- package/README.md +11 -11
- package/lib/Action/actions.js +172 -7
- package/lib/Action/index.js +25 -15
- package/lib/Action/session.js +3 -6
- package/lib/index.js +4 -4
- package/package.json +11 -10
- package/src/Action/actions.js +575 -0
- package/src/Action/index.js +285 -0
- package/src/Action/session.js +5 -0
- package/src/index.js +4 -0
- package/version +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
> UI components that can be used in React Applications built on top of forge powered blockchain.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```shell
|
|
8
|
-
yarn add @arcblock/did-
|
|
8
|
+
yarn add @arcblock/did-connect
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Then:
|
|
12
12
|
|
|
13
13
|
```javascript
|
|
14
14
|
import axios from 'axios';
|
|
15
|
-
import
|
|
16
|
-
import DidAvatar from '@arcblock/did-
|
|
17
|
-
import DidLogo from '@arcblock/did-
|
|
18
|
-
import DidAddress from '@arcblock/did-
|
|
15
|
+
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
16
|
+
import DidAvatar from '@arcblock/did-connect/lib/Avatar';
|
|
17
|
+
import DidLogo from '@arcblock/did-connect/lib/Logo';
|
|
18
|
+
import DidAddress from '@arcblock/did-connect/lib/Address';
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
### DidAuth
|
|
22
22
|
|
|
23
23
|
```jsx
|
|
24
|
-
<
|
|
24
|
+
<DidConnect
|
|
25
25
|
action="login"
|
|
26
|
-
responsive
|
|
27
26
|
checkFn={axios.get}
|
|
28
|
-
onClose={() =>
|
|
27
|
+
onClose={() => handleOnClose()}
|
|
29
28
|
onSuccess={() => (window.location.href = '/profile')}
|
|
30
29
|
messages={{
|
|
31
30
|
title: 'login',
|
|
32
|
-
scan: 'Scan QR code with
|
|
33
|
-
confirm: 'Confirm login on your
|
|
31
|
+
scan: 'Scan QR code with DID Wallet',
|
|
32
|
+
confirm: 'Confirm login on your DID Wallet',
|
|
34
33
|
success: 'You have successfully signed in!',
|
|
35
34
|
}}
|
|
35
|
+
webWalletUrl={webWalletUrl}
|
|
36
36
|
/>
|
|
37
37
|
```
|
|
38
38
|
|
package/lib/Action/actions.js
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getMessage = exports.getActionParams = exports.getActionName = exports.actions = void 0;
|
|
7
7
|
|
|
8
8
|
var _mustache = _interopRequireDefault(require("mustache"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
-
/* eslint-disable object-curly-newline */
|
|
13
12
|
async function createSwapOrder(api) {
|
|
14
13
|
const res = await api.post('/api/did/swap', {});
|
|
15
14
|
return {
|
|
@@ -29,7 +28,10 @@ const getValidPayAmount = (payAmount, price) => {
|
|
|
29
28
|
return 1;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
const getMessage = (
|
|
31
|
+
const getMessage = function getMessage() {
|
|
32
|
+
let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
33
|
+
let session = arguments.length > 1 ? arguments[1] : undefined;
|
|
34
|
+
|
|
33
35
|
try {
|
|
34
36
|
return _mustache.default.render(message, {
|
|
35
37
|
user: session.user || {},
|
|
@@ -37,7 +39,6 @@ const getMessage = (message, session) => {
|
|
|
37
39
|
balance: session.balance || {}
|
|
38
40
|
}, {}, ['(%', '%)']);
|
|
39
41
|
} catch (err) {
|
|
40
|
-
// eslint-disable-next-line no-console
|
|
41
42
|
console.error('Cannot render message', {
|
|
42
43
|
message,
|
|
43
44
|
session
|
|
@@ -96,6 +97,24 @@ const actions = {
|
|
|
96
97
|
amount: props.amount || 1
|
|
97
98
|
})
|
|
98
99
|
},
|
|
100
|
+
exchange_to_foreign_token_v2: {
|
|
101
|
+
action: 'swap_token_v2',
|
|
102
|
+
onStart: createSwapOrder,
|
|
103
|
+
extraParams: props => ({
|
|
104
|
+
action: 'buy',
|
|
105
|
+
rate: props.exchangeRate,
|
|
106
|
+
amount: props.amount || 1
|
|
107
|
+
})
|
|
108
|
+
},
|
|
109
|
+
exchange_to_local_token_v2: {
|
|
110
|
+
action: 'swap_token_v2',
|
|
111
|
+
onStart: createSwapOrder,
|
|
112
|
+
extraParams: props => ({
|
|
113
|
+
action: 'sell',
|
|
114
|
+
rate: props.exchangeRate,
|
|
115
|
+
amount: props.amount || 1
|
|
116
|
+
})
|
|
117
|
+
},
|
|
99
118
|
// Cross chain assets and tokens
|
|
100
119
|
buy_foreign_certificate_with_local_token: {
|
|
101
120
|
action: 'swap_asset',
|
|
@@ -176,6 +195,79 @@ const actions = {
|
|
|
176
195
|
name: getMessage(props.name, session)
|
|
177
196
|
})
|
|
178
197
|
},
|
|
198
|
+
buy_foreign_certificate_with_local_token_v2: {
|
|
199
|
+
action: 'swap_asset_v2',
|
|
200
|
+
extraParams: (props, session) => ({
|
|
201
|
+
action: 'buy',
|
|
202
|
+
type: 'certificate',
|
|
203
|
+
pfc: 'local',
|
|
204
|
+
price: props.price || 1,
|
|
205
|
+
name: getMessage(props.name, session),
|
|
206
|
+
desc: getMessage(props.description, session),
|
|
207
|
+
loc: getMessage(props.location, session),
|
|
208
|
+
bg: props.backgroundUrl,
|
|
209
|
+
logo: props.logoUrl
|
|
210
|
+
})
|
|
211
|
+
},
|
|
212
|
+
buy_foreign_badge_with_local_token_v2: {
|
|
213
|
+
action: 'swap_asset_v2',
|
|
214
|
+
extraParams: (props, session) => ({
|
|
215
|
+
action: 'buy',
|
|
216
|
+
type: 'badge',
|
|
217
|
+
pfc: 'local',
|
|
218
|
+
price: props.price || 1,
|
|
219
|
+
name: getMessage(props.name, session),
|
|
220
|
+
desc: getMessage(props.description, session),
|
|
221
|
+
loc: getMessage(props.location, session),
|
|
222
|
+
bg: props.backgroundUrl,
|
|
223
|
+
logo: props.logoUrl,
|
|
224
|
+
svg: props.svg
|
|
225
|
+
})
|
|
226
|
+
},
|
|
227
|
+
buy_foreign_ticket_with_local_token_v2: {
|
|
228
|
+
action: 'swap_asset_v2',
|
|
229
|
+
extraParams: (props, session) => ({
|
|
230
|
+
action: 'buy',
|
|
231
|
+
type: 'ticket',
|
|
232
|
+
pfc: 'local',
|
|
233
|
+
price: props.price || 1,
|
|
234
|
+
name: getMessage(props.name, session),
|
|
235
|
+
desc: getMessage(props.description, session),
|
|
236
|
+
loc: getMessage(props.location, session),
|
|
237
|
+
bg: props.backgroundUrl,
|
|
238
|
+
logo: props.logoUrl
|
|
239
|
+
})
|
|
240
|
+
},
|
|
241
|
+
sell_foreign_certificate_for_local_token_v2: {
|
|
242
|
+
action: 'swap_asset_v2',
|
|
243
|
+
extraParams: (props, session) => ({
|
|
244
|
+
action: 'sell',
|
|
245
|
+
type: 'certificate',
|
|
246
|
+
pfc: 'local',
|
|
247
|
+
price: props.price || 1,
|
|
248
|
+
name: getMessage(props.name, session)
|
|
249
|
+
})
|
|
250
|
+
},
|
|
251
|
+
sell_foreign_badge_for_local_token_v2: {
|
|
252
|
+
action: 'swap_asset_v2',
|
|
253
|
+
extraParams: (props, session) => ({
|
|
254
|
+
action: 'sell',
|
|
255
|
+
type: 'badge',
|
|
256
|
+
pfc: 'local',
|
|
257
|
+
price: props.price || 1,
|
|
258
|
+
name: getMessage(props.name, session)
|
|
259
|
+
})
|
|
260
|
+
},
|
|
261
|
+
sell_foreign_ticket_for_local_token_v2: {
|
|
262
|
+
action: 'swap_asset_v2',
|
|
263
|
+
extraParams: (props, session) => ({
|
|
264
|
+
action: 'sell',
|
|
265
|
+
type: 'ticket',
|
|
266
|
+
pfc: 'local',
|
|
267
|
+
price: props.price || 1,
|
|
268
|
+
name: getMessage(props.name, session)
|
|
269
|
+
})
|
|
270
|
+
},
|
|
179
271
|
buy_local_certificate_with_foreign_token: {
|
|
180
272
|
action: 'swap_asset',
|
|
181
273
|
onStart: createSwapOrder,
|
|
@@ -255,6 +347,79 @@ const actions = {
|
|
|
255
347
|
name: getMessage(props.name, session)
|
|
256
348
|
})
|
|
257
349
|
},
|
|
350
|
+
buy_local_certificate_with_foreign_token_v2: {
|
|
351
|
+
action: 'swap_asset_v2',
|
|
352
|
+
extraParams: (props, session) => ({
|
|
353
|
+
pa: getValidPayAmount(props.payAmount, props.price),
|
|
354
|
+
pt: 'token',
|
|
355
|
+
ra: props.receiveAmount || 1,
|
|
356
|
+
rt: 'certificate',
|
|
357
|
+
name: getMessage(props.name, session),
|
|
358
|
+
desc: getMessage(props.description, session),
|
|
359
|
+
loc: getMessage(props.location, session),
|
|
360
|
+
bg: props.backgroundUrl,
|
|
361
|
+
logo: props.logoUrl
|
|
362
|
+
})
|
|
363
|
+
},
|
|
364
|
+
buy_local_badge_with_foreign_token_v2: {
|
|
365
|
+
action: 'swap_asset_v2',
|
|
366
|
+
extraParams: (props, session) => ({
|
|
367
|
+
pa: getValidPayAmount(props.payAmount, props.price),
|
|
368
|
+
pt: 'token',
|
|
369
|
+
ra: props.receiveAmount || 1,
|
|
370
|
+
rt: 'badge',
|
|
371
|
+
name: getMessage(props.name, session),
|
|
372
|
+
desc: getMessage(props.description, session),
|
|
373
|
+
loc: getMessage(props.location, session),
|
|
374
|
+
bg: props.backgroundUrl,
|
|
375
|
+
logo: props.logoUrl,
|
|
376
|
+
svg: props.svg
|
|
377
|
+
})
|
|
378
|
+
},
|
|
379
|
+
buy_local_ticket_with_foreign_token_v2: {
|
|
380
|
+
action: 'swap_asset_v2',
|
|
381
|
+
extraParams: (props, session) => ({
|
|
382
|
+
pa: getValidPayAmount(props.payAmount, props.price),
|
|
383
|
+
pt: 'token',
|
|
384
|
+
ra: props.receiveAmount || 1,
|
|
385
|
+
rt: 'badge',
|
|
386
|
+
name: getMessage(props.name, session),
|
|
387
|
+
desc: getMessage(props.description, session),
|
|
388
|
+
loc: getMessage(props.location, session),
|
|
389
|
+
bg: props.backgroundUrl,
|
|
390
|
+
logo: props.logoUrl
|
|
391
|
+
})
|
|
392
|
+
},
|
|
393
|
+
sell_local_certificate_for_foreign_token_v2: {
|
|
394
|
+
action: 'swap_asset_v2',
|
|
395
|
+
extraParams: (props, session) => ({
|
|
396
|
+
pa: props.payAmount || 1,
|
|
397
|
+
pt: 'certificate',
|
|
398
|
+
ra: getValidPayAmount(props.receiveAmount, props.price),
|
|
399
|
+
rt: 'token',
|
|
400
|
+
name: getMessage(props.name, session)
|
|
401
|
+
})
|
|
402
|
+
},
|
|
403
|
+
sell_local_badge_for_foreign_token_v2: {
|
|
404
|
+
action: 'swap_asset_v2',
|
|
405
|
+
extraParams: (props, session) => ({
|
|
406
|
+
pa: props.payAmount || 1,
|
|
407
|
+
pt: 'badge',
|
|
408
|
+
ra: getValidPayAmount(props.receiveAmount, props.price),
|
|
409
|
+
rt: 'token',
|
|
410
|
+
name: getMessage(props.name, session)
|
|
411
|
+
})
|
|
412
|
+
},
|
|
413
|
+
sell_local_ticket_for_foreign_token_v2: {
|
|
414
|
+
action: 'swap_asset_v2',
|
|
415
|
+
extraParams: (props, session) => ({
|
|
416
|
+
pa: props.payAmount || 1,
|
|
417
|
+
pt: 'ticket',
|
|
418
|
+
ra: getValidPayAmount(props.receiveAmount, props.price),
|
|
419
|
+
rt: 'token',
|
|
420
|
+
name: getMessage(props.name, session)
|
|
421
|
+
})
|
|
422
|
+
},
|
|
258
423
|
// Exchange Scenarios
|
|
259
424
|
buy_local_certificate_with_local_token: {
|
|
260
425
|
action: 'exchange_assets',
|
|
@@ -411,7 +576,7 @@ const actions = {
|
|
|
411
576
|
},
|
|
412
577
|
consume_local_asset_by_did: {
|
|
413
578
|
action: 'consume_asset',
|
|
414
|
-
extraParams:
|
|
579
|
+
extraParams: _ref5 => {
|
|
415
580
|
let {
|
|
416
581
|
did
|
|
417
582
|
} = _ref5;
|
|
@@ -423,7 +588,7 @@ const actions = {
|
|
|
423
588
|
},
|
|
424
589
|
consume_foreign_asset_by_did: {
|
|
425
590
|
action: 'consume_asset',
|
|
426
|
-
extraParams:
|
|
591
|
+
extraParams: _ref6 => {
|
|
427
592
|
let {
|
|
428
593
|
did
|
|
429
594
|
} = _ref6;
|
|
@@ -435,7 +600,7 @@ const actions = {
|
|
|
435
600
|
},
|
|
436
601
|
claim_signature: {
|
|
437
602
|
action: 'claim_signature',
|
|
438
|
-
extraParams:
|
|
603
|
+
extraParams: _ref7 => {
|
|
439
604
|
let {
|
|
440
605
|
type
|
|
441
606
|
} = _ref7;
|
package/lib/Action/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogCon
|
|
|
23
23
|
|
|
24
24
|
var _styles = require("@material-ui/core/styles");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
27
27
|
|
|
28
28
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
29
29
|
|
|
@@ -33,11 +33,13 @@ var _session = require("./session");
|
|
|
33
33
|
|
|
34
34
|
var _actions = require("./actions");
|
|
35
35
|
|
|
36
|
+
const _excluded = ["autoClose", "action", "buttonText", "buttonColor", "buttonVariant", "buttonSize", "buttonRounded", "children", "disableClose", "title", "scanMessage", "successMessage", "successUrl", "successTarget", "frameProps", "confirmMessage", "extraParams", "timeout", "theme", "webWalletUrl"];
|
|
37
|
+
|
|
36
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
39
|
|
|
38
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
41
|
|
|
40
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
42
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
43
|
|
|
42
44
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
43
45
|
|
|
@@ -58,7 +60,7 @@ Close.propTypes = {
|
|
|
58
60
|
|
|
59
61
|
const CloseContainer = _styledComponents.default.div.withConfig({
|
|
60
62
|
displayName: "Action__CloseContainer",
|
|
61
|
-
componentId: "y9rma2-0"
|
|
63
|
+
componentId: "sc-y9rma2-0"
|
|
62
64
|
})(["display:", ";position:absolute;top:1rem;right:1rem;color:#999999;font-size:2rem;line-height:1rem;cursor:pointer;user-select:none;"], props => props.disableClose ? 'none' : 'block');
|
|
63
65
|
|
|
64
66
|
function PlaygroundAction(props) {
|
|
@@ -83,9 +85,10 @@ function PlaygroundAction(props) {
|
|
|
83
85
|
confirmMessage,
|
|
84
86
|
extraParams,
|
|
85
87
|
timeout,
|
|
86
|
-
theme
|
|
88
|
+
theme,
|
|
89
|
+
webWalletUrl
|
|
87
90
|
} = newProps,
|
|
88
|
-
rest = _objectWithoutProperties(newProps,
|
|
91
|
+
rest = _objectWithoutProperties(newProps, _excluded);
|
|
89
92
|
|
|
90
93
|
const browser = (0, _useBrowser.default)();
|
|
91
94
|
const {
|
|
@@ -139,7 +142,6 @@ function PlaygroundAction(props) {
|
|
|
139
142
|
setDynamicParams(params);
|
|
140
143
|
setLoading(false);
|
|
141
144
|
} catch (err) {
|
|
142
|
-
// eslint-disable-next-line no-console
|
|
143
145
|
console.error("Cannot generate dynamicParams for playground action ".concat((0, _actions.getActionName)(config, rest)));
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -197,16 +199,17 @@ function PlaygroundAction(props) {
|
|
|
197
199
|
src: successUrl
|
|
198
200
|
}, frameProps)));
|
|
199
201
|
|
|
202
|
+
const showDidConnect = !successUrl || successUrl && !success;
|
|
200
203
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, Object.assign({}, rest, {
|
|
201
204
|
rounded: buttonRounded,
|
|
202
205
|
color: buttonColor,
|
|
203
206
|
variant: buttonVariant,
|
|
204
207
|
size: buttonSize,
|
|
205
208
|
onClick: onStart
|
|
206
|
-
}), (0, _actions.getMessage)(buttonText || title, session),
|
|
209
|
+
}), (0, _actions.getMessage)(buttonText || title, session), ' ', loading && /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
|
|
207
210
|
size: 12,
|
|
208
211
|
color: "#fff"
|
|
209
|
-
})), open && /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
212
|
+
})), open && !showDidConnect && /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
210
213
|
open: true,
|
|
211
214
|
disableBackdropClick: true,
|
|
212
215
|
disableEscapeKeyDown: true,
|
|
@@ -221,7 +224,11 @@ function PlaygroundAction(props) {
|
|
|
221
224
|
alignItems: 'center',
|
|
222
225
|
height: showFrame ? theme.breakpoints.values.md : ''
|
|
223
226
|
}
|
|
224
|
-
},
|
|
227
|
+
}, /*#__PURE__*/_react.default.createElement(Close, {
|
|
228
|
+
onClose: onClose
|
|
229
|
+
}), successUrl && success && !showFrame && renderRedirectUrlAfterSuccess(), showFrame && renderFrameAfterSuccess())), /*#__PURE__*/_react.default.createElement(_Connect.default, {
|
|
230
|
+
popup: true,
|
|
231
|
+
open: open && showDidConnect,
|
|
225
232
|
action: (0, _actions.getActionName)(config, rest),
|
|
226
233
|
checkFn: api.get,
|
|
227
234
|
onClose: onClose,
|
|
@@ -229,13 +236,14 @@ function PlaygroundAction(props) {
|
|
|
229
236
|
checkTimeout: timeout // 3 layers of extraParams: user props, dynamically generated, from other props
|
|
230
237
|
,
|
|
231
238
|
extraParams: Object.assign((0, _actions.getActionParams)(config, rest, session), dynamicParams, extraParams),
|
|
239
|
+
webWalletUrl: webWalletUrl,
|
|
232
240
|
messages: {
|
|
233
241
|
title: (0, _actions.getMessage)(title, session),
|
|
234
242
|
scan: (0, _actions.getMessage)(scanMessage, session),
|
|
235
243
|
confirm: (0, _actions.getMessage)(confirmMessage, session),
|
|
236
244
|
success: children || (0, _actions.getMessage)(successMessage, session)
|
|
237
245
|
}
|
|
238
|
-
}))
|
|
246
|
+
}));
|
|
239
247
|
}
|
|
240
248
|
|
|
241
249
|
PlaygroundAction.propTypes = {
|
|
@@ -254,7 +262,8 @@ PlaygroundAction.propTypes = {
|
|
|
254
262
|
timeout: _propTypes.default.number,
|
|
255
263
|
successUrl: _propTypes.default.string,
|
|
256
264
|
successTarget: _propTypes.default.oneOf(['_blank', '_self', 'frame']),
|
|
257
|
-
frameProps: _propTypes.default.object
|
|
265
|
+
frameProps: _propTypes.default.object,
|
|
266
|
+
webWalletUrl: _propTypes.default.string
|
|
258
267
|
};
|
|
259
268
|
PlaygroundAction.defaultProps = {
|
|
260
269
|
autoClose: true,
|
|
@@ -267,14 +276,15 @@ PlaygroundAction.defaultProps = {
|
|
|
267
276
|
buttonSize: 'large',
|
|
268
277
|
// small | large | medium
|
|
269
278
|
buttonRounded: false,
|
|
270
|
-
scanMessage: 'Scan the QRCode with your
|
|
271
|
-
confirmMessage: 'Confirm in your
|
|
279
|
+
scanMessage: 'Scan the QRCode with your DID Wallet',
|
|
280
|
+
confirmMessage: 'Confirm in your DID Wallet',
|
|
272
281
|
successMessage: 'Operation success!',
|
|
273
282
|
extraParams: {},
|
|
274
283
|
timeout: 5 * 60 * 1000,
|
|
275
284
|
successUrl: '',
|
|
276
285
|
successTarget: '_self',
|
|
277
|
-
frameProps: {}
|
|
286
|
+
frameProps: {},
|
|
287
|
+
webWalletUrl: ''
|
|
278
288
|
};
|
|
279
289
|
|
|
280
290
|
var _default = (0, _styles.withTheme)(PlaygroundAction);
|
package/lib/Action/session.js
CHANGED
|
@@ -3,19 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.withSession = exports.
|
|
6
|
+
exports.withSession = exports.SessionProvider = exports.SessionContext = exports.SessionConsumer = void 0;
|
|
7
7
|
|
|
8
|
-
var _Session =
|
|
8
|
+
var _Session = require("@arcblock/did-connect/lib/Session");
|
|
9
9
|
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
/* eslint-disable object-curly-newline */
|
|
13
10
|
const {
|
|
14
11
|
SessionProvider,
|
|
15
12
|
SessionContext,
|
|
16
13
|
SessionConsumer,
|
|
17
14
|
withSession
|
|
18
|
-
} = (0, _Session.
|
|
15
|
+
} = (0, _Session.createAuthServiceSessionContext)();
|
|
19
16
|
exports.withSession = withSession;
|
|
20
17
|
exports.SessionConsumer = SessionConsumer;
|
|
21
18
|
exports.SessionContext = SessionContext;
|
package/lib/index.js
CHANGED
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "PlaygroundAction", {
|
|
|
9
9
|
return _Action.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "SessionConsumer", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return _session.
|
|
15
|
+
return _session.SessionConsumer;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "SessionContext", {
|
|
@@ -21,10 +21,10 @@ Object.defineProperty(exports, "SessionContext", {
|
|
|
21
21
|
return _session.SessionContext;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "SessionProvider", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function get() {
|
|
27
|
-
return _session.
|
|
27
|
+
return _session.SessionProvider;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did-playground",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.59",
|
|
4
4
|
"description": "React components that works with wallet-playground",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
"main": "lib/index.js",
|
|
14
14
|
"files": [
|
|
15
15
|
"version",
|
|
16
|
-
"lib"
|
|
16
|
+
"lib",
|
|
17
|
+
"src"
|
|
17
18
|
],
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/ArcBlock/
|
|
21
|
+
"url": "git+https://github.com/ArcBlock/ux.git"
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
|
23
24
|
"lint": "eslint src tests",
|
|
@@ -33,14 +34,14 @@
|
|
|
33
34
|
"url": "https://github.com/ArcBlock/wallet-playground/issues"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@arcblock/did-
|
|
37
|
-
"@arcblock/react-hooks": "^
|
|
38
|
-
"@arcblock/ux": "^
|
|
39
|
-
"@material-ui/core": "^4.
|
|
40
|
-
"axios": "^0.
|
|
37
|
+
"@arcblock/did-connect": "^1.6.59",
|
|
38
|
+
"@arcblock/react-hooks": "^1.6.59",
|
|
39
|
+
"@arcblock/ux": "^1.6.59",
|
|
40
|
+
"@material-ui/core": "^4.12.3",
|
|
41
|
+
"axios": "^0.21.1",
|
|
41
42
|
"core-js": "^3.6.4",
|
|
42
43
|
"mustache": "^4.0.0",
|
|
43
|
-
"react-use": "^
|
|
44
|
+
"react-use": "^17.2.4",
|
|
44
45
|
"styled-components": "^5.0.1"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"publishConfig": {
|
|
57
58
|
"access": "public"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "0cafb36ee900f1f8f90790d77d88bd23624c30fd"
|
|
60
61
|
}
|