@abtnode/ux 1.6.26 → 1.6.29

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.
@@ -104,7 +104,11 @@ function LostPassport(_ref2) {
104
104
  const [passport, setPassport] = (0, _react.useState)(false);
105
105
  const [success, setSuccess] = (0, _react.useState)(false);
106
106
  const history = (0, _reactRouterDom.useHistory)();
107
- const [activeStep, setActiveStep] = (0, _react.useState)(0);
107
+ const [activeStep, setActiveStep] = (0, _react.useState)(0); // eslint-disable-next-line no-undef
108
+
109
+ const {
110
+ searchParams
111
+ } = new URL(window.location.href);
108
112
 
109
113
  const onNext = () => {
110
114
  setActiveStep(activeStep + 1);
@@ -129,7 +133,8 @@ function LostPassport(_ref2) {
129
133
  } catch (err) {// Do nothing
130
134
  }
131
135
 
132
- history.replace('/');
136
+ const redirect = searchParams.get('redirect') || '/';
137
+ history.replace(redirect);
133
138
  };
134
139
 
135
140
  const handleChange = event => {
@@ -296,7 +301,7 @@ function LostPassport(_ref2) {
296
301
  const Div = (0, _styledComponents.default)(_Container.default).withConfig({
297
302
  displayName: "lost-passport__Div",
298
303
  componentId: "sc-1ov2rpb-0"
299
- })(["padding-top:46px;padding-bottom:46px;height:100%;overflow:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;@media (max-width:", "px){display:block;}.header{text-align:center;margin-bottom:24px;}.stepper{padding:24px;height:auto;width:100%;min-height:640px;display:flex;flex-direction:column;.stepper-progress{background:#fbfbfb;padding:0;flex:0;margin-bottom:24px;.MuiStepLabel-label.MuiStepLabel-alternativeLabel{margin-top:8px;}.MuiStepConnector-alternativeLabel{top:24px;}.MuiStepConnector-lineHorizontal{height:3px;border:none;background-color:#eaeaf0;border-radius:1px;}.step-icon-w{background-color:", ";z-index:1;color:", ";width:50px;height:50px;display:flex;border-radius:50%;justify-content:center;align-items:center;.step-icon{font-size:30px;}}.step-icon-w--active{background-color:", ";}.step-icon-w--completed{background-color:", ";}}.stepper-content{padding:0 64px;flex:1;display:flex;justify-content:center;align-items:center;margin-bottom:24px;.stepper-icon{margin-left:40px;}.stepper-auth{padding:0;.auth-title{margin-bottom:16px;}}.stepper-tip{text-align:center;margin-bottom:16px;}@media (max-width:", "px){padding:0;}}.stepper-actions{flex:0;text-align:right;padding:0 64px;display:none;.step-button{margin-right:8px;}}.select-passport{width:80%;@media (max-width:", "px){width:100%;}}.user-info{.name{font-weight:500;font-size:18px;line-height:25px;color:#222222;}}}.connect{background:#fafafa;}"], props => props.theme.breakpoints.values.sm, props => props.theme.palette.grey[500], props => props.theme.palette.common.white, props => props.theme.palette.primary.main, props => props.theme.palette.secondary.main, props => props.theme.breakpoints.values.sm, props => props.theme.breakpoints.values.sm);
304
+ })(["padding-top:46px;padding-bottom:46px;height:100%;overflow:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;@media (max-width:", "px){display:block;}.header{text-align:center;margin-bottom:24px;}.stepper{padding:24px;height:auto;width:100%;min-height:640px;display:flex;flex-direction:column;.stepper-progress{padding:0;flex:0;margin-bottom:24px;.MuiStepLabel-label.MuiStepLabel-alternativeLabel{margin-top:8px;}.MuiStepConnector-alternativeLabel{top:24px;}.MuiStepConnector-lineHorizontal{height:3px;border:none;background-color:#eaeaf0;border-radius:1px;}.step-icon-w{background-color:", ";z-index:1;color:", ";width:50px;height:50px;display:flex;border-radius:50%;justify-content:center;align-items:center;.step-icon{font-size:30px;}}.step-icon-w--active{background-color:", ";}.step-icon-w--completed{background-color:", ";}}.stepper-content{padding:0 64px;flex:1;display:flex;justify-content:center;align-items:center;margin-bottom:24px;.stepper-icon{margin-left:40px;}.stepper-auth{padding:0;.auth-title{margin-bottom:16px;}}.stepper-tip{text-align:center;margin-bottom:16px;}@media (max-width:", "px){padding:0;}}.stepper-actions{flex:0;text-align:right;padding:0 64px;display:none;.step-button{margin-right:8px;}}.select-passport{width:80%;@media (max-width:", "px){width:100%;}}.user-info{.name{font-weight:500;font-size:18px;line-height:25px;color:#222222;}}}.connect{background:#fafafa;}"], props => props.theme.breakpoints.values.sm, props => props.theme.palette.grey[500], props => props.theme.palette.common.white, props => props.theme.palette.primary.main, props => props.theme.palette.secondary.main, props => props.theme.breakpoints.values.sm, props => props.theme.breakpoints.values.sm);
300
305
 
301
306
  var _default = (0, _wrapLocale.default)(LostPassport);
302
307
 
package/lib/toast.js ADDED
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ToastProvider = ToastProvider;
7
+ exports.default = void 0;
8
+
9
+ var _react = _interopRequireDefault(require("react"));
10
+
11
+ var _notistack = require("notistack");
12
+
13
+ var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
14
+
15
+ var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
+
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
+
23
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
+
25
+ const noop = () => {};
26
+
27
+ let _success = noop;
28
+ let _error = noop;
29
+ let _warning = noop;
30
+ let _info = noop;
31
+
32
+ const genFn = (enqueueSnackbar, variant) => (message, opts) => {
33
+ enqueueSnackbar(message, _objectSpread({
34
+ autoHideDuration: 3000,
35
+ variant
36
+ }, opts));
37
+ }; // eslint-disable-next-line react/prop-types
38
+
39
+
40
+ function ToastProvider(_ref) {
41
+ let {
42
+ children
43
+ } = _ref;
44
+
45
+ const notistackRef = /*#__PURE__*/_react.default.createRef();
46
+
47
+ const onClickDismiss = key => () => {
48
+ notistackRef.current.closeSnackbar(key);
49
+ };
50
+
51
+ return /*#__PURE__*/_react.default.createElement(_notistack.SnackbarProvider, {
52
+ anchorOrigin: {
53
+ vertical: 'top',
54
+ horizontal: 'right'
55
+ },
56
+ ref: notistackRef,
57
+ action: key => /*#__PURE__*/_react.default.createElement(_IconButton.default, {
58
+ key: "close",
59
+ "aria-label": "close",
60
+ color: "inherit",
61
+ onClick: onClickDismiss(key)
62
+ }, /*#__PURE__*/_react.default.createElement(_Close.default, {
63
+ style: {
64
+ fontSize: 16
65
+ }
66
+ }))
67
+ }, /*#__PURE__*/_react.default.createElement(Toast, null), children);
68
+ }
69
+
70
+ function Toast() {
71
+ const {
72
+ enqueueSnackbar
73
+ } = (0, _notistack.useSnackbar)();
74
+ _success = genFn(enqueueSnackbar, 'success');
75
+ _error = genFn(enqueueSnackbar, 'error');
76
+ _warning = genFn(enqueueSnackbar, 'warning');
77
+ _info = genFn(enqueueSnackbar, 'info');
78
+ return null;
79
+ }
80
+
81
+ var _default = {
82
+ success: function success() {
83
+ return _success(...arguments);
84
+ },
85
+ error: function error() {
86
+ return _error(...arguments);
87
+ },
88
+ warning: function warning() {
89
+ return _warning(...arguments);
90
+ },
91
+ info: function info() {
92
+ return _info(...arguments);
93
+ }
94
+ };
95
+ exports.default = _default;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.26",
6
+ "version": "1.6.29",
7
7
  "description": "UX components shared across abtnode packages",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -24,6 +24,7 @@
24
24
  "@arcblock/ux": "^1.16.40",
25
25
  "@material-ui/core": "^4.12.3",
26
26
  "@material-ui/icons": "^4.11.2",
27
+ "notistack": "^1.0.6",
27
28
  "prop-types": "^15.7.2",
28
29
  "react": "^16.13.0",
29
30
  "react-router-dom": "^5.1.2",
@@ -38,5 +39,5 @@
38
39
  "babel-plugin-inline-react-svg": "^1.1.1",
39
40
  "babel-plugin-styled-components": "^1.10.7"
40
41
  },
41
- "gitHead": "4e92f2af78718332882c7542fd475cc261903788"
42
+ "gitHead": "0d02246307d364e952990b3e64b608dfefc80efe"
42
43
  }