@abtnode/ux 1.7.16 → 1.7.17
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/hooks/use-passport-id.js +26 -0
- package/lib/issue-passport.js +13 -4
- package/lib/lost-passport.js +14 -5
- package/package.json +7 -6
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = usePassportId;
|
|
7
|
+
|
|
8
|
+
var _useLocalStorage = _interopRequireDefault(require("react-use/lib/useLocalStorage"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function usePassportId() {
|
|
13
|
+
const [passportId, setPassportId, clearPassportId] = (0, _useLocalStorage.default)('passportId', '');
|
|
14
|
+
|
|
15
|
+
const getPassportId = () => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
clearPassportId();
|
|
18
|
+
}, 0);
|
|
19
|
+
return passportId;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
getPassportId,
|
|
24
|
+
setPassportId
|
|
25
|
+
};
|
|
26
|
+
}
|
package/lib/issue-passport.js
CHANGED
|
@@ -29,6 +29,8 @@ var _constant = require("@abtnode/constant");
|
|
|
29
29
|
|
|
30
30
|
var _wrapLocale = _interopRequireDefault(require("./wrap-locale"));
|
|
31
31
|
|
|
32
|
+
var _usePassportId = _interopRequireDefault(require("./hooks/use-passport-id"));
|
|
33
|
+
|
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
35
|
|
|
34
36
|
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); }
|
|
@@ -52,8 +54,15 @@ function IssuePassport(_ref) {
|
|
|
52
54
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
53
55
|
const [success, setSuccess] = (0, _react.useState)(false);
|
|
54
56
|
const history = (0, _reactRouterDom.useHistory)();
|
|
57
|
+
const {
|
|
58
|
+
setPassportId
|
|
59
|
+
} = (0, _usePassportId.default)();
|
|
60
|
+
|
|
61
|
+
const onReceivePassport = result => {
|
|
62
|
+
if (result !== null && result !== void 0 && result.passportId) {
|
|
63
|
+
setPassportId(result.passportId);
|
|
64
|
+
}
|
|
55
65
|
|
|
56
|
-
const onSuccess = () => {
|
|
57
66
|
setSuccess(true);
|
|
58
67
|
};
|
|
59
68
|
|
|
@@ -67,7 +76,7 @@ function IssuePassport(_ref) {
|
|
|
67
76
|
extraParams.id = id;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
|
-
const
|
|
79
|
+
const onUsePassport = () => {
|
|
71
80
|
var _window$env;
|
|
72
81
|
|
|
73
82
|
try {
|
|
@@ -105,7 +114,7 @@ function IssuePassport(_ref) {
|
|
|
105
114
|
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
106
115
|
variant: "contained",
|
|
107
116
|
color: "primary",
|
|
108
|
-
onClick:
|
|
117
|
+
onClick: onUsePassport
|
|
109
118
|
}, t('issuePassport.dialog.loginWithPassport')))))) : /*#__PURE__*/_react.default.createElement(_Connect.default, {
|
|
110
119
|
className: "connect",
|
|
111
120
|
action: "issue-passport",
|
|
@@ -113,7 +122,7 @@ function IssuePassport(_ref) {
|
|
|
113
122
|
checkTimeout: 10 * 60 * 1000,
|
|
114
123
|
socketUrl: api.socketUrl,
|
|
115
124
|
webWalletUrl: webWalletUrl,
|
|
116
|
-
onSuccess:
|
|
125
|
+
onSuccess: onReceivePassport,
|
|
117
126
|
locale: locale,
|
|
118
127
|
messages: {
|
|
119
128
|
title: t('issuePassport.title'),
|
package/lib/lost-passport.js
CHANGED
|
@@ -47,6 +47,8 @@ var _cardSelector = _interopRequireDefault(require("./card-selector"));
|
|
|
47
47
|
|
|
48
48
|
var _wrapLocale = _interopRequireDefault(require("./wrap-locale"));
|
|
49
49
|
|
|
50
|
+
var _usePassportId = _interopRequireDefault(require("./hooks/use-passport-id"));
|
|
51
|
+
|
|
50
52
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
53
|
|
|
52
54
|
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); }
|
|
@@ -107,7 +109,10 @@ function LostPassport(_ref2) {
|
|
|
107
109
|
const [passport, setPassport] = (0, _react.useState)(false);
|
|
108
110
|
const [success, setSuccess] = (0, _react.useState)(false);
|
|
109
111
|
const history = (0, _reactRouterDom.useHistory)();
|
|
110
|
-
const [activeStep, setActiveStep] = (0, _react.useState)(0);
|
|
112
|
+
const [activeStep, setActiveStep] = (0, _react.useState)(0);
|
|
113
|
+
const {
|
|
114
|
+
setPassportId
|
|
115
|
+
} = (0, _usePassportId.default)(); // eslint-disable-next-line no-undef
|
|
111
116
|
|
|
112
117
|
const {
|
|
113
118
|
searchParams
|
|
@@ -125,12 +130,16 @@ function LostPassport(_ref2) {
|
|
|
125
130
|
onNext();
|
|
126
131
|
};
|
|
127
132
|
|
|
128
|
-
const
|
|
133
|
+
const onReceivePassport = result => {
|
|
134
|
+
if (result !== null && result !== void 0 && result.passportId) {
|
|
135
|
+
setPassportId(result.passportId);
|
|
136
|
+
}
|
|
137
|
+
|
|
129
138
|
setSuccess(true);
|
|
130
139
|
onNext();
|
|
131
140
|
};
|
|
132
141
|
|
|
133
|
-
const
|
|
142
|
+
const onUsePassport = () => {
|
|
134
143
|
var _window$env;
|
|
135
144
|
|
|
136
145
|
try {
|
|
@@ -251,7 +260,7 @@ function LostPassport(_ref2) {
|
|
|
251
260
|
checkTimeout: 10 * 60 * 1000,
|
|
252
261
|
socketUrl: api.socketUrl,
|
|
253
262
|
webWalletUrl: webWalletUrl,
|
|
254
|
-
onSuccess:
|
|
263
|
+
onSuccess: onReceivePassport,
|
|
255
264
|
locale: locale,
|
|
256
265
|
messages: {
|
|
257
266
|
scan: t('lostPassport.dialog.scan'),
|
|
@@ -282,7 +291,7 @@ function LostPassport(_ref2) {
|
|
|
282
291
|
},
|
|
283
292
|
variant: "contained",
|
|
284
293
|
color: "primary",
|
|
285
|
-
onClick:
|
|
294
|
+
onClick: onUsePassport
|
|
286
295
|
}, t('issuePassport.dialog.loginWithPassport')))
|
|
287
296
|
}];
|
|
288
297
|
return /*#__PURE__*/_react.default.createElement(Div, null, /*#__PURE__*/_react.default.createElement("div", {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.7.
|
|
6
|
+
"version": "1.7.17",
|
|
7
7
|
"description": "UX components shared across abtnode packages",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@abtnode/constant": "1.7.
|
|
25
|
-
"@arcblock/did-connect": "^2.
|
|
26
|
-
"@arcblock/ux": "^2.
|
|
27
|
-
"@blocklet/meta": "1.7.
|
|
24
|
+
"@abtnode/constant": "1.7.17",
|
|
25
|
+
"@arcblock/did-connect": "^2.1.1",
|
|
26
|
+
"@arcblock/ux": "^2.1.1",
|
|
27
|
+
"@blocklet/meta": "1.7.17",
|
|
28
28
|
"@emotion/react": "^11.9.0",
|
|
29
29
|
"@emotion/styled": "^11.8.1",
|
|
30
30
|
"@mui/icons-material": "^5.6.2",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"prop-types": "^15.7.2",
|
|
35
35
|
"react": "^18.1.0",
|
|
36
36
|
"react-router-dom": "^5.1.2",
|
|
37
|
+
"react-use": "^17.3.2",
|
|
37
38
|
"styled-components": "^5.0.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"babel-plugin-inline-react-svg": "^1.1.1",
|
|
46
47
|
"babel-plugin-styled-components": "^1.10.7"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "142a5b1e83ea03647ef9bea8de9bb269c9c82928"
|
|
49
50
|
}
|