@abtnode/ux 1.16.15-beta-933eb977 → 1.16.15-beta-18951729

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.
@@ -6,11 +6,10 @@ import Typography from '@mui/material/Typography';
6
6
  import TextField from '@mui/material/TextField';
7
7
  import MenuItem from '@mui/material/MenuItem';
8
8
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
9
- import Toast from '@arcblock/ux/lib/Toast';
10
9
  import Confirm from '../../../confirm';
11
10
  import { formatError, sleep } from '../../../util';
12
11
  import { useNodeContext } from '../../../contexts/node';
13
- import { validateDomain } from '../util';
12
+ import { parseDomainFromURL, validateDomain } from '../util';
14
13
  import { jsx as _jsx } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -41,15 +40,13 @@ export default function AddDomainAlias({
41
40
  await api.addDomainAlias({
42
41
  input: {
43
42
  id,
44
- domainAlias: params.domain.trim(),
43
+ domainAlias: parseDomainFromURL(params.domain),
45
44
  teamDid
46
45
  }
47
46
  });
48
47
  await sleep(2000);
49
- } catch (err) {
50
- Toast.error(err.message);
51
- } finally {
52
48
  setConfirmSetting(null);
49
+ } finally {
53
50
  setLoading(false);
54
51
  }
55
52
  };
@@ -69,6 +66,7 @@ export default function AddDomainAlias({
69
66
  component: "div",
70
67
  children: /*#__PURE__*/_jsx(TextField, {
71
68
  label: t('router.domainAlias.add.domainDescription'),
69
+ helperText: t('router.domainAlias.add.helperText'),
72
70
  autoComplete: "off",
73
71
  variant: "outlined",
74
72
  name: "domain",
@@ -128,4 +128,20 @@ export const isSpecialDomain = name => {
128
128
  specialDomains.push(window.location.hostname);
129
129
  }
130
130
  return specialDomains.includes(name);
131
+ };
132
+ export const parseDomainFromURL = tmpDomain => {
133
+ if (!tmpDomain || typeof tmpDomain !== 'string') {
134
+ return tmpDomain;
135
+ }
136
+ let domain = tmpDomain.trim();
137
+ try {
138
+ domain = domain.toLowerCase();
139
+ if (domain.startsWith('http://') || domain.startsWith('https://')) {
140
+ return new URL(domain).hostname;
141
+ }
142
+ return domain;
143
+ } catch (error) {
144
+ console.error('format domain failed', error);
145
+ return domain;
146
+ }
131
147
  };
package/es/locales/en.js CHANGED
@@ -820,13 +820,14 @@ module.exports = {
820
820
  rewriteUrlRequired: 'Rewrite URL is required'
821
821
  },
822
822
  domain: {
823
+ addSite: 'Add Site',
823
824
  validate: {
824
825
  emptyTip: 'Site domain cannot be empty',
825
826
  suffixTip: 'Site domain cannot include {suffix}'
826
827
  },
827
828
  add: {
828
- title: 'Add Site',
829
- description: 'Please provide a valid site name address',
829
+ title: 'Add Domain Name',
830
+ description: 'Please provide a valid domain name',
830
831
  confirm: 'Add',
831
832
  cancel: 'Cancel',
832
833
  blocklet: 'Select Blocklet',
@@ -861,7 +862,8 @@ module.exports = {
861
862
  add: {
862
863
  title: 'Add Additional Domain',
863
864
  domainDescription: 'Please provide a valid domain name',
864
- forceTip: 'Force add if domain name already exists'
865
+ forceTip: 'Force add if domain name already exists',
866
+ helperText: 'If an HTTP or HTTPS URL is entered, it will be automatically converted into a domain name.'
865
867
  },
866
868
  delete: {
867
869
  title: 'Delete',
package/es/locales/zh.js CHANGED
@@ -823,13 +823,14 @@ module.exports = {
823
823
  rewriteUrlRequired: '重写到 URL 是必填的'
824
824
  },
825
825
  domain: {
826
+ addSite: '添加站点',
826
827
  validate: {
827
828
  emptyTip: '站点域名不能为空',
828
829
  suffixTip: '站点域名不能包含 {suffix}'
829
830
  },
830
831
  add: {
831
- title: '添加站点',
832
- description: '请填写你所拥有的合法的站点地址',
832
+ title: '添加域名',
833
+ description: '请填写你所拥有的合法的域名',
833
834
  confirm: '添加',
834
835
  cancel: '取消',
835
836
  blocklet: '选择基石程序',
@@ -864,7 +865,8 @@ module.exports = {
864
865
  add: {
865
866
  title: '添加额外域名',
866
867
  domainDescription: '请填写有效的域名',
867
- forceTip: '当域名已存在时强制添加'
868
+ forceTip: '当域名已存在时强制添加',
869
+ helperText: '如果输入 HTTP 或者 HTTPS URL, 则会被自动转换为域名。'
868
870
  },
869
871
  delete: {
870
872
  title: '删除',
package/es/util/index.js CHANGED
@@ -606,7 +606,8 @@ export const getSubscriptionURL = async ({
606
606
  timeout: 5000
607
607
  });
608
608
  const mountPoint = appMeta.componentMountPoints?.find(item => item.did === 'z8iZy4P83i6AgnNdNUexsh2kBcsDHoqcwPavn');
609
- baseUrl = joinUrl(launcherUrl, mountPoint?.mountPoint, '/nfts');
609
+ const launcherUrlObj = new URL(launcherUrl);
610
+ baseUrl = joinUrl(launcherUrlObj.origin, mountPoint?.mountPoint, '/nfts');
610
611
  } catch (error) {
611
612
  console.error(error);
612
613
  }
@@ -12,7 +12,6 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
12
12
  var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
13
13
  var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
14
14
  var _context = require("@arcblock/ux/lib/Locale/context");
15
- var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
16
15
  var _confirm = _interopRequireDefault(require("../../../confirm"));
17
16
  var _util = require("../../../util");
18
17
  var _node = require("../../../contexts/node");
@@ -52,15 +51,13 @@ function AddDomainAlias(_ref) {
52
51
  await api.addDomainAlias({
53
52
  input: {
54
53
  id,
55
- domainAlias: params.domain.trim(),
54
+ domainAlias: (0, _util2.parseDomainFromURL)(params.domain),
56
55
  teamDid
57
56
  }
58
57
  });
59
58
  await (0, _util.sleep)(2000);
60
- } catch (err) {
61
- _Toast.default.error(err.message);
62
- } finally {
63
59
  setConfirmSetting(null);
60
+ } finally {
64
61
  setLoading(false);
65
62
  }
66
63
  };
@@ -80,6 +77,7 @@ function AddDomainAlias(_ref) {
80
77
  component: "div",
81
78
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
82
79
  label: t('router.domainAlias.add.domainDescription'),
80
+ helperText: t('router.domainAlias.add.helperText'),
83
81
  autoComplete: "off",
84
82
  variant: "outlined",
85
83
  name: "domain",
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.validateSite = exports.validateRule = exports.validatePathPrefix = exports.validateDomain = exports.isSpecialDomain = exports.getInitialBlockletDid = void 0;
6
+ exports.validateSite = exports.validateRule = exports.validatePathPrefix = exports.validateDomain = exports.parseDomainFromURL = exports.isSpecialDomain = exports.getInitialBlockletDid = void 0;
7
7
  var _constant = require("@abtnode/constant");
8
8
  var _isPathPrefixEqual = _interopRequireDefault(require("@abtnode/util/lib/is-path-prefix-equal"));
9
9
  var _constant2 = require("@blocklet/constant");
@@ -143,4 +143,21 @@ const isSpecialDomain = name => {
143
143
  }
144
144
  return specialDomains.includes(name);
145
145
  };
146
- exports.isSpecialDomain = isSpecialDomain;
146
+ exports.isSpecialDomain = isSpecialDomain;
147
+ const parseDomainFromURL = tmpDomain => {
148
+ if (!tmpDomain || typeof tmpDomain !== 'string') {
149
+ return tmpDomain;
150
+ }
151
+ let domain = tmpDomain.trim();
152
+ try {
153
+ domain = domain.toLowerCase();
154
+ if (domain.startsWith('http://') || domain.startsWith('https://')) {
155
+ return new URL(domain).hostname;
156
+ }
157
+ return domain;
158
+ } catch (error) {
159
+ console.error('format domain failed', error);
160
+ return domain;
161
+ }
162
+ };
163
+ exports.parseDomainFromURL = parseDomainFromURL;
package/lib/locales/en.js CHANGED
@@ -822,13 +822,14 @@ module.exports = {
822
822
  rewriteUrlRequired: 'Rewrite URL is required'
823
823
  },
824
824
  domain: {
825
+ addSite: 'Add Site',
825
826
  validate: {
826
827
  emptyTip: 'Site domain cannot be empty',
827
828
  suffixTip: 'Site domain cannot include {suffix}'
828
829
  },
829
830
  add: {
830
- title: 'Add Site',
831
- description: 'Please provide a valid site name address',
831
+ title: 'Add Domain Name',
832
+ description: 'Please provide a valid domain name',
832
833
  confirm: 'Add',
833
834
  cancel: 'Cancel',
834
835
  blocklet: 'Select Blocklet',
@@ -863,7 +864,8 @@ module.exports = {
863
864
  add: {
864
865
  title: 'Add Additional Domain',
865
866
  domainDescription: 'Please provide a valid domain name',
866
- forceTip: 'Force add if domain name already exists'
867
+ forceTip: 'Force add if domain name already exists',
868
+ helperText: 'If an HTTP or HTTPS URL is entered, it will be automatically converted into a domain name.'
867
869
  },
868
870
  delete: {
869
871
  title: 'Delete',
package/lib/locales/zh.js CHANGED
@@ -825,13 +825,14 @@ module.exports = {
825
825
  rewriteUrlRequired: '重写到 URL 是必填的'
826
826
  },
827
827
  domain: {
828
+ addSite: '添加站点',
828
829
  validate: {
829
830
  emptyTip: '站点域名不能为空',
830
831
  suffixTip: '站点域名不能包含 {suffix}'
831
832
  },
832
833
  add: {
833
- title: '添加站点',
834
- description: '请填写你所拥有的合法的站点地址',
834
+ title: '添加域名',
835
+ description: '请填写你所拥有的合法的域名',
835
836
  confirm: '添加',
836
837
  cancel: '取消',
837
838
  blocklet: '选择基石程序',
@@ -866,7 +867,8 @@ module.exports = {
866
867
  add: {
867
868
  title: '添加额外域名',
868
869
  domainDescription: '请填写有效的域名',
869
- forceTip: '当域名已存在时强制添加'
870
+ forceTip: '当域名已存在时强制添加',
871
+ helperText: '如果输入 HTTP 或者 HTTPS URL, 则会被自动转换为域名。'
870
872
  },
871
873
  delete: {
872
874
  title: '删除',
package/lib/util/index.js CHANGED
@@ -713,7 +713,8 @@ const getSubscriptionURL = async _ref8 => {
713
713
  timeout: 5000
714
714
  });
715
715
  const mountPoint = (_appMeta$componentMou = appMeta.componentMountPoints) === null || _appMeta$componentMou === void 0 ? void 0 : _appMeta$componentMou.find(item => item.did === 'z8iZy4P83i6AgnNdNUexsh2kBcsDHoqcwPavn');
716
- baseUrl = (0, _urlJoin.default)(launcherUrl, mountPoint === null || mountPoint === void 0 ? void 0 : mountPoint.mountPoint, '/nfts');
716
+ const launcherUrlObj = new URL(launcherUrl);
717
+ baseUrl = (0, _urlJoin.default)(launcherUrlObj.origin, mountPoint === null || mountPoint === void 0 ? void 0 : mountPoint.mountPoint, '/nfts');
717
718
  } catch (error) {
718
719
  console.error(error);
719
720
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.15-beta-933eb977",
3
+ "version": "1.16.15-beta-18951729",
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.15-beta-933eb977",
31
- "@abtnode/constant": "1.16.15-beta-933eb977",
32
- "@abtnode/util": "1.16.15-beta-933eb977",
30
+ "@abtnode/auth": "1.16.15-beta-18951729",
31
+ "@abtnode/constant": "1.16.15-beta-18951729",
32
+ "@abtnode/util": "1.16.15-beta-18951729",
33
33
  "@ahooksjs/use-url-state": "^3.5.1",
34
34
  "@arcblock/did": "^1.18.89",
35
35
  "@arcblock/did-connect": "^2.7.6",
@@ -39,10 +39,10 @@
39
39
  "@arcblock/react-hooks": "^2.7.6",
40
40
  "@arcblock/terminal": "^2.7.6",
41
41
  "@arcblock/ux": "^2.7.6",
42
- "@blocklet/constant": "1.16.15-beta-933eb977",
42
+ "@blocklet/constant": "1.16.15-beta-18951729",
43
43
  "@blocklet/launcher-layout": "2.1.93",
44
44
  "@blocklet/list": "^0.12.27",
45
- "@blocklet/meta": "1.16.15-beta-933eb977",
45
+ "@blocklet/meta": "1.16.15-beta-18951729",
46
46
  "@blocklet/ui-react": "^2.7.6",
47
47
  "@emotion/react": "^11.10.4",
48
48
  "@emotion/styled": "^11.10.4",
@@ -98,7 +98,7 @@
98
98
  "babel-plugin-inline-react-svg": "^1.1.2",
99
99
  "glob": "^10.3.3"
100
100
  },
101
- "gitHead": "d98826a347c05fb1c3dc50a44d8d492290c406ad",
101
+ "gitHead": "6ba076bcc138a3b9948771deae0f723a5104f70f",
102
102
  "exports": {
103
103
  ".": {
104
104
  "import": "./es/index.js",