@abtnode/ux 1.16.17 → 1.16.18-beta-adeeb0b3

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.
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
3
3
  import styled from '@emotion/styled';
4
4
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
5
5
  import DidButton from '@arcblock/did-connect/lib/Button';
6
- import { getFederatedEnabled, getMaster } from '@arcblock/ux/lib/Util/federated';
7
6
  import { AUTH_SERVICE_PREFIX, API_DID_PREFIX } from '@arcblock/did-connect/lib/constant';
8
7
  import joinURL from 'url-join';
9
8
  import { formatDateTime } from '../util';
@@ -14,7 +13,8 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
14
13
  function InvitationReceive({
15
14
  invitation,
16
15
  onLogin,
17
- onReceive
16
+ onReceive,
17
+ inService
18
18
  }) {
19
19
  const {
20
20
  t,
@@ -49,30 +49,46 @@ function InvitationReceive({
49
49
  onReceive();
50
50
  return;
51
51
  }
52
- const masterSite = getMaster();
53
- const federatedEnabled = getFederatedEnabled();
54
- const baseUrl = federatedEnabled ? masterSite.appUrl : window.location.origin;
55
- connectApi.openPopup({
56
- action: 'invite',
57
- className: 'connect',
58
- forceConnected: false,
59
- autoConnect: false,
60
- locale,
61
- extraParams,
62
- baseUrl: window.location.origin,
63
- prefix: joinURL(window.location.origin, AUTH_SERVICE_PREFIX, API_DID_PREFIX),
64
- messages: {
65
- title: t('receive.dialog.title'),
66
- scan: t('receive.dialog.scan'),
67
- confirm: t('receive.dialog.confirm'),
68
- success: t('receive.dialog.success')
69
- },
70
- onSuccess,
71
- onClose
72
- }, {
73
- baseUrl,
74
- locale
75
- });
52
+ if (inService) {
53
+ connectApi.openPopup({
54
+ action: 'invite',
55
+ className: 'connect',
56
+ forceConnected: false,
57
+ autoConnect: false,
58
+ locale,
59
+ extraParams,
60
+ baseUrl: window.location.origin,
61
+ prefix: joinURL(window.location.origin, AUTH_SERVICE_PREFIX, API_DID_PREFIX),
62
+ messages: {
63
+ title: t('receive.dialog.title'),
64
+ scan: t('receive.dialog.scan'),
65
+ confirm: t('receive.dialog.confirm'),
66
+ success: t('receive.dialog.success')
67
+ },
68
+ onSuccess,
69
+ onClose
70
+ }, {
71
+ locale
72
+ });
73
+ } else {
74
+ connectApi.open({
75
+ action: 'invite',
76
+ className: 'connect',
77
+ forceConnected: false,
78
+ autoConnect: false,
79
+ locale,
80
+ extraParams,
81
+ messages: {
82
+ title: t('receive.dialog.title'),
83
+ scan: t('receive.dialog.scan'),
84
+ confirm: t('receive.dialog.confirm'),
85
+ success: t('receive.dialog.success')
86
+ },
87
+ onSuccess,
88
+ onClose
89
+ });
90
+ }
91
+
76
92
  // eslint-disable-next-line react-hooks/exhaustive-deps
77
93
  }, [connectApi.openPopup]);
78
94
  return /*#__PURE__*/_jsxs(Root, {
@@ -93,11 +109,13 @@ function InvitationReceive({
93
109
  InvitationReceive.propTypes = {
94
110
  invitation: PropTypes.object.isRequired,
95
111
  onLogin: PropTypes.func,
96
- onReceive: PropTypes.func
112
+ onReceive: PropTypes.func,
113
+ inService: PropTypes.bool
97
114
  };
98
115
  InvitationReceive.defaultProps = {
99
116
  onLogin: () => {},
100
- onReceive: null
117
+ onReceive: null,
118
+ inService: false
101
119
  };
102
120
  const Root = styled.div`
103
121
  text-align: center;
@@ -18,7 +18,8 @@ function Invitation({
18
18
  createPassportSvg,
19
19
  onLoginSuccess,
20
20
  checkFn,
21
- onReceive
21
+ onReceive,
22
+ inService
22
23
  }) {
23
24
  const state = useRequest(getDataFn);
24
25
  if (state.loading) {
@@ -50,7 +51,8 @@ function Invitation({
50
51
  invitation: state.data,
51
52
  onLogin: onLoginSuccess,
52
53
  checkFn: checkFn,
53
- onReceive: onReceive
54
+ onReceive: onReceive,
55
+ inService: inService
54
56
  })]
55
57
  })]
56
58
  });
@@ -61,12 +63,14 @@ Invitation.propTypes = {
61
63
  createPassportSvg: PropTypes.func.isRequired,
62
64
  onLoginSuccess: PropTypes.func,
63
65
  onReceive: PropTypes.func,
64
- passportColor: PropTypes.string
66
+ passportColor: PropTypes.string,
67
+ inService: PropTypes.bool
65
68
  };
66
69
  Invitation.defaultProps = {
67
70
  onLoginSuccess: () => {},
68
71
  passportColor: 'auto',
69
- onReceive: null
72
+ onReceive: null,
73
+ inService: false
70
74
  };
71
75
  const Root = styled.div`
72
76
  max-width: 460px;
@@ -9,7 +9,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _styled = _interopRequireDefault(require("@emotion/styled"));
10
10
  var _context = require("@arcblock/ux/lib/Locale/context");
11
11
  var _Button = _interopRequireDefault(require("@arcblock/did-connect/lib/Button"));
12
- var _federated = require("@arcblock/ux/lib/Util/federated");
13
12
  var _constant = require("@arcblock/did-connect/lib/constant");
14
13
  var _urlJoin = _interopRequireDefault(require("url-join"));
15
14
  var _util = require("../util");
@@ -23,7 +22,8 @@ function InvitationReceive(_ref) {
23
22
  let {
24
23
  invitation,
25
24
  onLogin,
26
- onReceive
25
+ onReceive,
26
+ inService
27
27
  } = _ref;
28
28
  const {
29
29
  t,
@@ -59,30 +59,46 @@ function InvitationReceive(_ref) {
59
59
  onReceive();
60
60
  return;
61
61
  }
62
- const masterSite = (0, _federated.getMaster)();
63
- const federatedEnabled = (0, _federated.getFederatedEnabled)();
64
- const baseUrl = federatedEnabled ? masterSite.appUrl : window.location.origin;
65
- connectApi.openPopup({
66
- action: 'invite',
67
- className: 'connect',
68
- forceConnected: false,
69
- autoConnect: false,
70
- locale,
71
- extraParams,
72
- baseUrl: window.location.origin,
73
- prefix: (0, _urlJoin.default)(window.location.origin, _constant.AUTH_SERVICE_PREFIX, _constant.API_DID_PREFIX),
74
- messages: {
75
- title: t('receive.dialog.title'),
76
- scan: t('receive.dialog.scan'),
77
- confirm: t('receive.dialog.confirm'),
78
- success: t('receive.dialog.success')
79
- },
80
- onSuccess,
81
- onClose
82
- }, {
83
- baseUrl,
84
- locale
85
- });
62
+ if (inService) {
63
+ connectApi.openPopup({
64
+ action: 'invite',
65
+ className: 'connect',
66
+ forceConnected: false,
67
+ autoConnect: false,
68
+ locale,
69
+ extraParams,
70
+ baseUrl: window.location.origin,
71
+ prefix: (0, _urlJoin.default)(window.location.origin, _constant.AUTH_SERVICE_PREFIX, _constant.API_DID_PREFIX),
72
+ messages: {
73
+ title: t('receive.dialog.title'),
74
+ scan: t('receive.dialog.scan'),
75
+ confirm: t('receive.dialog.confirm'),
76
+ success: t('receive.dialog.success')
77
+ },
78
+ onSuccess,
79
+ onClose
80
+ }, {
81
+ locale
82
+ });
83
+ } else {
84
+ connectApi.open({
85
+ action: 'invite',
86
+ className: 'connect',
87
+ forceConnected: false,
88
+ autoConnect: false,
89
+ locale,
90
+ extraParams,
91
+ messages: {
92
+ title: t('receive.dialog.title'),
93
+ scan: t('receive.dialog.scan'),
94
+ confirm: t('receive.dialog.confirm'),
95
+ success: t('receive.dialog.success')
96
+ },
97
+ onSuccess,
98
+ onClose
99
+ });
100
+ }
101
+
86
102
  // eslint-disable-next-line react-hooks/exhaustive-deps
87
103
  }, [connectApi.openPopup]);
88
104
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, {
@@ -103,11 +119,13 @@ function InvitationReceive(_ref) {
103
119
  InvitationReceive.propTypes = {
104
120
  invitation: _propTypes.default.object.isRequired,
105
121
  onLogin: _propTypes.default.func,
106
- onReceive: _propTypes.default.func
122
+ onReceive: _propTypes.default.func,
123
+ inService: _propTypes.default.bool
107
124
  };
108
125
  InvitationReceive.defaultProps = {
109
126
  onLogin: () => {},
110
- onReceive: null
127
+ onReceive: null,
128
+ inService: false
111
129
  };
112
130
  const Root = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n text-align: center;\n .invite-receive__logo-wrapper {\n display: inline-flex;\n align-items: center;\n color: #9397a1;\n font-size: 14px;\n }\n .invite-receive__logo {\n height: 16px;\n margin-left: 8px;\n }\n .invite-receive__button {\n width: 100%;\n margin: 16px 0;\n white-space: nowrap;\n }\n .invite-receive__until {\n text-align: center;\n font-size: 14px;\n }\n .invite-receive__description {\n color: #999;\n text-align: left;\n list-style: decimal;\n padding: 0;\n padding-left: 1.2em;\n margin: 40px 0;\n }\n .invite-receive__description-item {\n list-style: decimal;\n }\n .invite-receive__link {\n color: ", ";\n }\n"])), _ref2 => {
113
131
  let {
@@ -27,7 +27,8 @@ function Invitation(_ref) {
27
27
  createPassportSvg,
28
28
  onLoginSuccess,
29
29
  checkFn,
30
- onReceive
30
+ onReceive,
31
+ inService
31
32
  } = _ref;
32
33
  const state = (0, _ahooks.useRequest)(getDataFn);
33
34
  if (state.loading) {
@@ -60,7 +61,8 @@ function Invitation(_ref) {
60
61
  invitation: state.data,
61
62
  onLogin: onLoginSuccess,
62
63
  checkFn: checkFn,
63
- onReceive: onReceive
64
+ onReceive: onReceive,
65
+ inService: inService
64
66
  })]
65
67
  })]
66
68
  });
@@ -71,12 +73,14 @@ Invitation.propTypes = {
71
73
  createPassportSvg: _propTypes.default.func.isRequired,
72
74
  onLoginSuccess: _propTypes.default.func,
73
75
  onReceive: _propTypes.default.func,
74
- passportColor: _propTypes.default.string
76
+ passportColor: _propTypes.default.string,
77
+ inService: _propTypes.default.bool
75
78
  };
76
79
  Invitation.defaultProps = {
77
80
  onLoginSuccess: () => {},
78
81
  passportColor: 'auto',
79
- onReceive: null
82
+ onReceive: null,
83
+ inService: false
80
84
  };
81
85
  const Root = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-width: 460px;\n max-height: 650px;\n min-height: 450px;\n width: 90%;\n height: 80%;\n display: flex;\n flex-direction: column;\n .page-invite__card {\n background-color: #fff;\n border-radius: 4px;\n flex: 1;\n padding: 20px 30px;\n margin-top: 10px;\n }\n .page-invite__app {\n margin-top: 20px;\n }\n"])));
82
86
  var _default = (0, _wrapLocale.default)(Invitation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.17",
3
+ "version": "1.16.18-beta-adeeb0b3",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,9 +27,9 @@
27
27
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "@abtnode/auth": "1.16.17",
31
- "@abtnode/constant": "1.16.17",
32
- "@abtnode/util": "1.16.17",
30
+ "@abtnode/auth": "1.16.18-beta-adeeb0b3",
31
+ "@abtnode/constant": "1.16.18-beta-adeeb0b3",
32
+ "@abtnode/util": "1.16.18-beta-adeeb0b3",
33
33
  "@ahooksjs/use-url-state": "^3.5.1",
34
34
  "@arcblock/did": "^1.18.93",
35
35
  "@arcblock/did-connect": "^2.8.5",
@@ -39,10 +39,10 @@
39
39
  "@arcblock/react-hooks": "^2.8.5",
40
40
  "@arcblock/terminal": "^2.8.5",
41
41
  "@arcblock/ux": "^2.8.5",
42
- "@blocklet/constant": "1.16.17",
42
+ "@blocklet/constant": "1.16.18-beta-adeeb0b3",
43
43
  "@blocklet/launcher-layout": "2.2.22",
44
44
  "@blocklet/list": "^0.12.46",
45
- "@blocklet/meta": "1.16.17",
45
+ "@blocklet/meta": "1.16.18-beta-adeeb0b3",
46
46
  "@blocklet/ui-react": "^2.8.5",
47
47
  "@blocklet/uploader": "^0.0.32",
48
48
  "@emotion/react": "^11.10.4",
@@ -100,7 +100,7 @@
100
100
  "babel-plugin-inline-react-svg": "^1.1.2",
101
101
  "glob": "^10.3.3"
102
102
  },
103
- "gitHead": "628ba2f5dac74749900bc1e9fd81bab8d320412a",
103
+ "gitHead": "1bef55d8f6ec840d5336e5a8c113771535a1416f",
104
104
  "exports": {
105
105
  ".": {
106
106
  "import": "./es/index.js",