@blocklet/launcher-workflow 1.9.64 → 2.0.0
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/assets/images/check-reverse.svg +5 -0
- package/lib/assets/images/check.svg +5 -0
- package/lib/assets/images/checkbox-checked.svg +5 -0
- package/lib/assets/images/checkbox-unchecked.svg +3 -0
- package/lib/assets/images/cup.svg +9 -0
- package/lib/assets/images/space.svg +9 -0
- package/lib/checkout.js +312 -0
- package/lib/components/agreement.js +12 -0
- package/lib/components/checkbox.js +79 -0
- package/lib/components/{instance-operation.js → launch-dedicated.js} +63 -44
- package/lib/components/{prepare-serverless.js → launch-serverless.js} +5 -5
- package/lib/components/layout/body.js +27 -0
- package/lib/components/layout/footer.js +33 -0
- package/lib/components/layout/header.js +34 -0
- package/lib/components/layout/index.js +36 -0
- package/lib/components/plan.js +281 -0
- package/lib/contexts/request.js +25 -20
- package/lib/contexts/workflow.js +65 -0
- package/lib/launch.js +17 -8
- package/lib/locales/en.js +17 -6
- package/lib/locales/zh.js +19 -8
- package/lib/purchase.js +165 -207
- package/lib/util.js +18 -2
- package/package.json +6 -5
- package/lib/api.js +0 -35
- package/lib/components/prepare-standard.js +0 -241
- package/lib/contexts/router.js +0 -55
- package/lib/prepare.js +0 -26
- package/lib/router-content.js +0 -52
- package/lib/start.js +0 -34
package/lib/contexts/request.js
CHANGED
|
@@ -35,29 +35,33 @@ function RequestProvider(_ref) {
|
|
|
35
35
|
const {
|
|
36
36
|
locale
|
|
37
37
|
} = (0, _locale.useLocaleContext)();
|
|
38
|
-
const
|
|
38
|
+
const configRequest = r => {
|
|
39
|
+
r.interceptors.request.use(config => {
|
|
40
|
+
config.url = (0, _urlJoin.default)('/api', config.url);
|
|
41
|
+
if (!config.params) {
|
|
42
|
+
config.params = {};
|
|
43
|
+
}
|
|
44
|
+
config.params.locale = locale;
|
|
45
|
+
return config;
|
|
46
|
+
});
|
|
47
|
+
r.interceptors.response.use(response => response, err => {
|
|
48
|
+
if ((0, _lodash.default)(err, 'response.status') === 401) {
|
|
49
|
+
session.login();
|
|
50
|
+
}
|
|
51
|
+
return Promise.reject(err);
|
|
52
|
+
});
|
|
53
|
+
return r;
|
|
54
|
+
};
|
|
55
|
+
const request = _axios.default.create({
|
|
39
56
|
baseURL
|
|
40
57
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
config.params = {};
|
|
45
|
-
}
|
|
46
|
-
config.params.locale = locale;
|
|
47
|
-
return config;
|
|
48
|
-
});
|
|
49
|
-
privateRequest.interceptors.response.use(response => response, err => {
|
|
50
|
-
if ((0, _lodash.default)(err, 'response.status') === 401) {
|
|
51
|
-
session.login();
|
|
52
|
-
}
|
|
53
|
-
return Promise.reject(err);
|
|
54
|
-
});
|
|
58
|
+
const create = configs => configRequest(_axios.default.create(_objectSpread({
|
|
59
|
+
baseURL
|
|
60
|
+
}, configs || {})));
|
|
55
61
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
56
62
|
value: {
|
|
57
|
-
api:
|
|
58
|
-
create
|
|
59
|
-
baseURL
|
|
60
|
-
}, configs || {}))
|
|
63
|
+
api: configRequest(request),
|
|
64
|
+
create
|
|
61
65
|
},
|
|
62
66
|
children: children
|
|
63
67
|
});
|
|
@@ -67,8 +71,9 @@ RequestProvider.propTypes = {
|
|
|
67
71
|
children: _propTypes.default.any.isRequired
|
|
68
72
|
};
|
|
69
73
|
RequestProvider.defaultProps = {
|
|
70
|
-
baseURL: ''
|
|
74
|
+
baseURL: '/'
|
|
71
75
|
};
|
|
76
|
+
RequestProvider.defaultProps = {};
|
|
72
77
|
function useRequest() {
|
|
73
78
|
const value = (0, _react.useContext)(RequestContext);
|
|
74
79
|
return value;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WorkflowProvider = WorkflowProvider;
|
|
7
|
+
exports.useWorkflowContext = useWorkflowContext;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _locale = require("./locale");
|
|
11
|
+
var _request = require("./request");
|
|
12
|
+
var _locales = require("../locales");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
const Context = /*#__PURE__*/(0, _react.createContext)();
|
|
16
|
+
const {
|
|
17
|
+
Provider
|
|
18
|
+
} = Context;
|
|
19
|
+
function WorkflowProvider(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
baseURL,
|
|
22
|
+
embed,
|
|
23
|
+
didPayPrefix,
|
|
24
|
+
routerPrefix,
|
|
25
|
+
locale,
|
|
26
|
+
children
|
|
27
|
+
} = _ref;
|
|
28
|
+
const value = {
|
|
29
|
+
embed,
|
|
30
|
+
baseURL,
|
|
31
|
+
didPayPrefix,
|
|
32
|
+
routerPrefix
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
35
|
+
value: value,
|
|
36
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_locale.LocaleProvider, {
|
|
37
|
+
locale: locale,
|
|
38
|
+
translations: _locales.translations,
|
|
39
|
+
fallbackLocale: "en",
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_request.RequestProvider, {
|
|
41
|
+
baseURL: baseURL,
|
|
42
|
+
children: children
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
WorkflowProvider.propTypes = {
|
|
48
|
+
baseURL: _propTypes.default.string,
|
|
49
|
+
routerPrefix: _propTypes.default.string,
|
|
50
|
+
didPayPrefix: _propTypes.default.string,
|
|
51
|
+
locale: _propTypes.default.string,
|
|
52
|
+
embed: _propTypes.default.bool,
|
|
53
|
+
children: _propTypes.default.any.isRequired
|
|
54
|
+
};
|
|
55
|
+
WorkflowProvider.defaultProps = {
|
|
56
|
+
baseURL: '/',
|
|
57
|
+
routerPrefix: '/',
|
|
58
|
+
didPayPrefix: '/',
|
|
59
|
+
locale: 'en',
|
|
60
|
+
embed: true
|
|
61
|
+
};
|
|
62
|
+
function useWorkflowContext() {
|
|
63
|
+
const value = (0, _react.useContext)(Context);
|
|
64
|
+
return value;
|
|
65
|
+
}
|
package/lib/launch.js
CHANGED
|
@@ -3,15 +3,24 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
exports.default = Launch;
|
|
7
|
+
var _reactRouterDom = require("react-router-dom");
|
|
8
|
+
var _launchServerless = _interopRequireDefault(require("./components/launch-serverless"));
|
|
9
|
+
var _launchDedicated = _interopRequireDefault(require("./components/launch-dedicated"));
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
function Launch() {
|
|
13
|
+
const {
|
|
14
|
+
nftId
|
|
15
|
+
} = (0, _reactRouterDom.useParams)();
|
|
16
|
+
const [searchParams] = (0, _reactRouterDom.useSearchParams)();
|
|
17
|
+
const launchType = searchParams.get('launchType');
|
|
18
|
+
if (launchType === 'serverless') {
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_launchServerless.default, {
|
|
20
|
+
nftId: nftId
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_launchDedicated.default, {
|
|
24
|
+
nftId: nftId
|
|
16
25
|
});
|
|
17
26
|
}
|
package/lib/locales/en.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
common: {
|
|
5
|
+
agreeTo: 'Agree to the',
|
|
6
|
+
agreement: 'Agreement',
|
|
5
7
|
paymentMethod: 'Payment Method',
|
|
6
8
|
serverType: 'Blocklet Server Type',
|
|
7
9
|
paying: 'Paying',
|
|
@@ -17,11 +19,10 @@ module.exports = {
|
|
|
17
19
|
confirm: 'Confirm',
|
|
18
20
|
launching: 'Launching',
|
|
19
21
|
loadFailed: 'Failed to load the resource, please refresh the page and try again.',
|
|
20
|
-
payFailed: 'Payment failed'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
subTitle: 'Select payment method and plan'
|
|
22
|
+
payFailed: 'Payment failed',
|
|
23
|
+
details: 'Details',
|
|
24
|
+
pay: 'Pay',
|
|
25
|
+
space: 'Space'
|
|
25
26
|
},
|
|
26
27
|
license: {
|
|
27
28
|
title: 'End User License Agreement',
|
|
@@ -38,7 +39,7 @@ module.exports = {
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
launch: {
|
|
41
|
-
|
|
42
|
+
pageTitle: 'Launch',
|
|
42
43
|
invalidFftId: 'Invalid Purchase NFT ID',
|
|
43
44
|
launchApp: 'Launch Application',
|
|
44
45
|
launching: 'Your Blocklet Server is being baked, please be patient, it usually takes about 5 minutes',
|
|
@@ -94,6 +95,8 @@ module.exports = {
|
|
|
94
95
|
}
|
|
95
96
|
},
|
|
96
97
|
purchase: {
|
|
98
|
+
pageTitle: 'Purchase',
|
|
99
|
+
selectSpaceHint: 'Already have dedicated space? Click here to select >',
|
|
97
100
|
dialog: {
|
|
98
101
|
title: 'Purchase Blocklet Server NFT',
|
|
99
102
|
scan: 'Scan the QR code below with your DID wallet to complete purchase',
|
|
@@ -105,5 +108,13 @@ module.exports = {
|
|
|
105
108
|
redirectToStoreButton: 'Go to install the application →',
|
|
106
109
|
purchaseServerlessSuccess: 'The purchase of Running Space is successful and you can go ahead and install Blocklet.'
|
|
107
110
|
}
|
|
111
|
+
},
|
|
112
|
+
checkout: {
|
|
113
|
+
pageTitle: 'Checkout',
|
|
114
|
+
orderTotal: 'Order total',
|
|
115
|
+
paymentTotal: 'Payment Total',
|
|
116
|
+
paymentMethod: {
|
|
117
|
+
title: 'Select payment currency'
|
|
118
|
+
}
|
|
108
119
|
}
|
|
109
120
|
};
|
package/lib/locales/zh.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
common: {
|
|
5
|
-
|
|
5
|
+
agreeTo: '同意',
|
|
6
|
+
agreement: '用户协议',
|
|
7
|
+
paymentMethod: '支付方式',
|
|
6
8
|
serverType: '节点信息',
|
|
7
9
|
paying: '支付中',
|
|
8
10
|
name: '名称',
|
|
9
11
|
description: '描述',
|
|
10
12
|
retry: '重试',
|
|
11
13
|
launch: '启动',
|
|
12
|
-
next: '
|
|
14
|
+
next: '下一步',
|
|
13
15
|
redeem: '兑换',
|
|
14
16
|
purchase: '购买',
|
|
15
17
|
redirecting: '跳转中',
|
|
@@ -17,11 +19,10 @@ module.exports = {
|
|
|
17
19
|
confirm: '同意',
|
|
18
20
|
launching: '启动中',
|
|
19
21
|
payFailed: '支付失败',
|
|
20
|
-
loadFailed: '加载资源失败, 请刷新页面重试。'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
subTitle: '请选择支付方式和节点型号'
|
|
22
|
+
loadFailed: '加载资源失败, 请刷新页面重试。',
|
|
23
|
+
details: '明细',
|
|
24
|
+
pay: '支付',
|
|
25
|
+
space: '空间'
|
|
25
26
|
},
|
|
26
27
|
license: {
|
|
27
28
|
title: '节点用户协议',
|
|
@@ -38,7 +39,7 @@ module.exports = {
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
launch: {
|
|
41
|
-
|
|
42
|
+
pageTitle: '启动',
|
|
42
43
|
invalidFftId: '无效的购买凭证',
|
|
43
44
|
launchApp: '启动应用',
|
|
44
45
|
launching: '节点正在启动中, 大约需要 5 分钟',
|
|
@@ -94,6 +95,8 @@ module.exports = {
|
|
|
94
95
|
}
|
|
95
96
|
},
|
|
96
97
|
purchase: {
|
|
98
|
+
pageTitle: '选购',
|
|
99
|
+
selectSpaceHint: '已有专用空间?点击这里选择 >',
|
|
97
100
|
dialog: {
|
|
98
101
|
title: '购买 Blocklet Server NFT',
|
|
99
102
|
scan: '用您的 DID 钱包扫描下面的二维码完成购买',
|
|
@@ -105,5 +108,13 @@ module.exports = {
|
|
|
105
108
|
redirectToStoreButton: '去安装应用 →',
|
|
106
109
|
purchaseServerlessSuccess: '购买运行空间成功,您可以去安装应用.'
|
|
107
110
|
}
|
|
111
|
+
},
|
|
112
|
+
checkout: {
|
|
113
|
+
pageTitle: '结账',
|
|
114
|
+
orderTotal: '总计',
|
|
115
|
+
paymentTotal: '总支付',
|
|
116
|
+
paymentMethod: {
|
|
117
|
+
title: '选择支付货币'
|
|
118
|
+
}
|
|
108
119
|
}
|
|
109
120
|
};
|