@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
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = LaunchDedicated;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactRouterDom = require("react-router-dom");
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _lodash = _interopRequireDefault(require("lodash.get"));
|
|
11
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
11
12
|
var _useInterval = _interopRequireDefault(require("react-use/lib/useInterval"));
|
|
12
13
|
var _lodash2 = _interopRequireDefault(require("lodash.throttle"));
|
|
13
14
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
@@ -15,13 +16,13 @@ var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
|
15
16
|
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
16
17
|
var _AnimationWaiter = _interopRequireDefault(require("@arcblock/ux/lib/AnimationWaiter"));
|
|
17
18
|
var _constant = require("@blocklet/launcher-util/lib/constant");
|
|
19
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
18
20
|
var _pageHeader = _interopRequireDefault(require("@blocklet/launcher-layout/lib/page-header"));
|
|
19
21
|
var _launchResultMessage = _interopRequireDefault(require("@blocklet/launcher-layout/lib/launch-result-message"));
|
|
20
22
|
var _progressMessage = _interopRequireDefault(require("@blocklet/launcher-ux/lib/progress-message"));
|
|
21
23
|
var _util = require("../util");
|
|
22
24
|
var _query = _interopRequireDefault(require("../hooks/query"));
|
|
23
25
|
var _request = _interopRequireDefault(require("../contexts/request"));
|
|
24
|
-
var _router = _interopRequireDefault(require("../contexts/router"));
|
|
25
26
|
var _locale = require("../contexts/locale");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
28
|
var _templateObject, _templateObject2, _templateObject3;
|
|
@@ -42,7 +43,7 @@ const STATUS = {
|
|
|
42
43
|
notFoundError: 11,
|
|
43
44
|
launchFailedError: 12
|
|
44
45
|
};
|
|
45
|
-
function
|
|
46
|
+
function LaunchDedicated(_ref) {
|
|
46
47
|
let {
|
|
47
48
|
type,
|
|
48
49
|
routerPrefix
|
|
@@ -70,6 +71,56 @@ function OperationPage(_ref) {
|
|
|
70
71
|
createServerTime = Date.now();
|
|
71
72
|
sessionStorage.setItem("launcher-create-server-".concat(nftId, "-time"), createServerTime);
|
|
72
73
|
}
|
|
74
|
+
const handleInstance = instance => {
|
|
75
|
+
if (instance.status >= _constant.INSTANCE_STATUS.running) {
|
|
76
|
+
var _window$blocklet;
|
|
77
|
+
const url = (0, _util.getLaunchBlockletUrl)({
|
|
78
|
+
serverUrl: instance.serverUrl,
|
|
79
|
+
blockletMetaUrl,
|
|
80
|
+
locale,
|
|
81
|
+
chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST
|
|
82
|
+
});
|
|
83
|
+
setIsDone(true);
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
setLaunchState(pre => _objectSpread(_objectSpread({}, pre), {}, {
|
|
86
|
+
status: STATUS.success,
|
|
87
|
+
appUrl: url
|
|
88
|
+
}));
|
|
89
|
+
(0, _util.loadURL)(url).finally(() => {
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
window.location.href = url;
|
|
92
|
+
}, 1000);
|
|
93
|
+
});
|
|
94
|
+
}, 1000);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const launch = async () => {
|
|
98
|
+
try {
|
|
99
|
+
setLaunchState(pre => _objectSpread(_objectSpread({}, pre), {}, {
|
|
100
|
+
status: STATUS.launching
|
|
101
|
+
}));
|
|
102
|
+
const {
|
|
103
|
+
data: {
|
|
104
|
+
instance
|
|
105
|
+
}
|
|
106
|
+
} = await api.post('/instances/launch', {
|
|
107
|
+
nftId
|
|
108
|
+
}, {
|
|
109
|
+
params: {
|
|
110
|
+
launchType: query.get('launchType')
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
handleInstance(instance);
|
|
114
|
+
} catch (err) {
|
|
115
|
+
const errDesc = (0, _util.getAPIResponseError)(err);
|
|
116
|
+
if (errDesc === 'Unauthorized') {
|
|
117
|
+
// TODO: 如果没有授权,要求用户提供 NFT
|
|
118
|
+
_Toast.default.error(t('launchPrepare.error.loginFirst'));
|
|
119
|
+
} else {
|
|
120
|
+
_Toast.default.error(errDesc);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
73
124
|
const getInstanceStatus = async () => {
|
|
74
125
|
try {
|
|
75
126
|
const {
|
|
@@ -77,27 +128,7 @@ function OperationPage(_ref) {
|
|
|
77
128
|
instance
|
|
78
129
|
}
|
|
79
130
|
} = await api.get("/public/instances/".concat(nftId, "/status"));
|
|
80
|
-
|
|
81
|
-
var _window$blocklet;
|
|
82
|
-
const url = (0, _util.getLaunchBlockletUrl)({
|
|
83
|
-
serverUrl: instance.serverUrl,
|
|
84
|
-
blockletMetaUrl,
|
|
85
|
-
locale,
|
|
86
|
-
chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST
|
|
87
|
-
});
|
|
88
|
-
setIsDone(true);
|
|
89
|
-
setTimeout(() => {
|
|
90
|
-
setLaunchState(pre => _objectSpread(_objectSpread({}, pre), {}, {
|
|
91
|
-
status: STATUS.success,
|
|
92
|
-
appUrl: url
|
|
93
|
-
}));
|
|
94
|
-
(0, _util.loadURL)(url).finally(() => {
|
|
95
|
-
setTimeout(() => {
|
|
96
|
-
window.location.href = url;
|
|
97
|
-
}, 1000);
|
|
98
|
-
});
|
|
99
|
-
}, 1000);
|
|
100
|
-
}
|
|
131
|
+
handleInstance(instance);
|
|
101
132
|
} catch (error) {
|
|
102
133
|
sessionStorage.removeItem("launcher-create-server-".concat(nftId, "-time"));
|
|
103
134
|
if ((0, _lodash.default)(error, 'response.status') === 404 && launchState.status !== STATUS.launching) {
|
|
@@ -115,19 +146,6 @@ function OperationPage(_ref) {
|
|
|
115
146
|
};
|
|
116
147
|
const poll = (0, _lodash2.default)(getInstanceStatus, 5000);
|
|
117
148
|
(0, _useInterval.default)(poll, launchState.status === STATUS.launching && nftId ? 5000 : null);
|
|
118
|
-
(0, _react.useEffect)(() => {
|
|
119
|
-
if (!nftId) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
getInstanceStatus().then(() => {
|
|
123
|
-
if (launchState.status !== STATUS.success) {
|
|
124
|
-
setLaunchState(state => _objectSpread(_objectSpread({}, state), {}, {
|
|
125
|
-
status: STATUS.launching
|
|
126
|
-
}));
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}, [nftId]); // eslint-disable-line
|
|
130
|
-
|
|
131
149
|
const successful = launchState.status === STATUS.success;
|
|
132
150
|
const progressSteps = [t('launch.waiting.starting'), t('launch.waiting.securing'), t('launch.waiting.prepare'), t('launch.waiting.waiting'), t('launch.waiting.done')];
|
|
133
151
|
const messageDuration = 40000;
|
|
@@ -148,13 +166,15 @@ function OperationPage(_ref) {
|
|
|
148
166
|
const timer = setInterval(() => {
|
|
149
167
|
fixStepIndex();
|
|
150
168
|
}, 1000);
|
|
169
|
+
launch();
|
|
151
170
|
return () => clearInterval(timer);
|
|
152
171
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
153
172
|
}, []);
|
|
154
173
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Content, {
|
|
155
174
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_pageHeader.default, {
|
|
156
|
-
title: t(
|
|
157
|
-
className: "launch-page-header ".concat(successful ? 'header-hide' : '')
|
|
175
|
+
title: t('launch.pageTitle'),
|
|
176
|
+
className: "launch-page-header ".concat(successful ? 'header-hide' : ''),
|
|
177
|
+
disableBack: true
|
|
158
178
|
}), launchState.status === STATUS.waiting && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
159
179
|
className: "center",
|
|
160
180
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {})
|
|
@@ -198,7 +218,7 @@ function OperationPage(_ref) {
|
|
|
198
218
|
variant: "contained",
|
|
199
219
|
className: "button",
|
|
200
220
|
component: _reactRouterDom.Link,
|
|
201
|
-
to: (0,
|
|
221
|
+
to: (0, _urlJoin.default)(routerPrefix, "/prepare/".concat(nftId).concat(window.location.search)),
|
|
202
222
|
children: t('common.retry')
|
|
203
223
|
})
|
|
204
224
|
}), launchState.status === STATUS.notFoundError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_launchResultMessage.default, {
|
|
@@ -209,8 +229,7 @@ function OperationPage(_ref) {
|
|
|
209
229
|
color: "primary",
|
|
210
230
|
variant: "contained",
|
|
211
231
|
className: "button",
|
|
212
|
-
|
|
213
|
-
to: (0, _router.default)(routerPrefix, "/prepare/".concat(nftId).concat(window.location.search)),
|
|
232
|
+
onClick: launch,
|
|
214
233
|
children: t('common.launch')
|
|
215
234
|
})
|
|
216
235
|
})]
|
|
@@ -219,11 +238,11 @@ function OperationPage(_ref) {
|
|
|
219
238
|
const LinkEle = _styled.default.a(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 36px;\n color: ", ";\n"])), props => props.theme.palette.primary.main);
|
|
220
239
|
const WaiterContainer = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: #1dc1c7;\n"])));
|
|
221
240
|
const Content = _styled.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: auto;\n height: 100%;\n\n .link {\n color: ", ";\n }\n\n .link:hover {\n text-decoration: underline !important;\n }\n\n .status {\n color: ", ";\n display: flex;\n flex-direction: column;\n align-items: center;\n\n .status-spinner {\n color: inherit !important;\n }\n\n .status-text {\n display: inline-block;\n padding: 0 20px;\n max-width: 420px;\n margin-top: 24px;\n text-align: center;\n }\n }\n\n .button {\n min-width: 150px;\n margin-bottom: 100px;\n }\n .center {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n }\n .launch-page-header {\n transition: all ease 0.3s;\n &.header-hide {\n opacity: 0;\n }\n }\n"])), props => props.theme.palette.primary.main, props => props.theme.palette.primary.main);
|
|
222
|
-
|
|
241
|
+
LaunchDedicated.propTypes = {
|
|
223
242
|
type: _propTypes.default.oneOf(['launch', 'start']),
|
|
224
243
|
routerPrefix: _propTypes.default.string
|
|
225
244
|
};
|
|
226
|
-
|
|
245
|
+
LaunchDedicated.defaultProps = {
|
|
227
246
|
type: 'launch',
|
|
228
247
|
routerPrefix: ''
|
|
229
248
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = LaunchServerless;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactRouterDom = require("react-router-dom");
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -19,7 +19,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
var _templateObject;
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
22
|
-
function
|
|
22
|
+
function LaunchServerless(_ref) {
|
|
23
23
|
let {
|
|
24
24
|
nftId
|
|
25
25
|
} = _ref;
|
|
@@ -51,8 +51,8 @@ function PrepareServerless(_ref) {
|
|
|
51
51
|
});
|
|
52
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
53
53
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_pageHeader.default, {
|
|
54
|
-
title: t('
|
|
55
|
-
|
|
54
|
+
title: t('launch.pageTitle'),
|
|
55
|
+
disableBack: true
|
|
56
56
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
57
57
|
className: "page-body",
|
|
58
58
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -78,6 +78,6 @@ function PrepareServerless(_ref) {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n\n .page-logo {\n display: flex;\n justify-content: center;\n margin-top: 62px;\n ", " {\n margin-top: 48px;\n }\n }\n\n .page-body {\n .content {\n display: flex;\n align-items: center;\n flex-direction: column;\n text-align: center;\n margin-top: 64px;\n\n .loading-description {\n margin-top: 8px;\n }\n }\n }\n"])), props => props.theme.breakpoints.down('md'));
|
|
81
|
-
|
|
81
|
+
LaunchServerless.propTypes = {
|
|
82
82
|
nftId: _propTypes.default.string.isRequired
|
|
83
83
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Body;
|
|
7
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
var _templateObject;
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
|
+
function Body(_ref) {
|
|
14
|
+
let {
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
18
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
19
|
+
className: "page-body-article",
|
|
20
|
+
children: children
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
Body.propTypes = {
|
|
25
|
+
children: _propTypes.default.any.isRequired
|
|
26
|
+
};
|
|
27
|
+
const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1;\n margin-top: 32px;\n\n .page-body-article {\n width: 100%;\n height: 100%;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n }\n"])));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Footer;
|
|
7
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
var _templateObject;
|
|
11
|
+
const _excluded = ["children"];
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
+
function Footer(_ref) {
|
|
22
|
+
let {
|
|
23
|
+
children
|
|
24
|
+
} = _ref,
|
|
25
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, _objectSpread(_objectSpread({}, rest), {}, {
|
|
27
|
+
children: children
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
Footer.propTypes = {
|
|
31
|
+
children: _propTypes.default.any.isRequired
|
|
32
|
+
};
|
|
33
|
+
const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n margin-top: auto;\n width: 100%;\n"])));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Header;
|
|
7
|
+
var _reactRouterDom = require("react-router-dom");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _pageHeader = _interopRequireDefault(require("@blocklet/launcher-layout/lib/page-header"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function Header(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
title,
|
|
15
|
+
disableBack
|
|
16
|
+
} = _ref;
|
|
17
|
+
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
18
|
+
const clickBack = () => {
|
|
19
|
+
navigate(-1);
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_pageHeader.default, {
|
|
22
|
+
title: title,
|
|
23
|
+
onClickBack: clickBack,
|
|
24
|
+
disableBack: disableBack
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
Header.propTypes = {
|
|
28
|
+
title: _propTypes.default.any,
|
|
29
|
+
disableBack: _propTypes.default.bool
|
|
30
|
+
};
|
|
31
|
+
Header.defaultProps = {
|
|
32
|
+
title: '',
|
|
33
|
+
disableBack: false
|
|
34
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Layout;
|
|
7
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
var _templateObject;
|
|
11
|
+
const _excluded = ["children"];
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
+
function Layout(_ref) {
|
|
22
|
+
let {
|
|
23
|
+
children
|
|
24
|
+
} = _ref,
|
|
25
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
// layout-fix-container for compatibility with lower versions of safari, do not remove this className
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, _objectSpread(_objectSpread({
|
|
28
|
+
className: "layout-fix-container"
|
|
29
|
+
}, rest), {}, {
|
|
30
|
+
children: children
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
Layout.propTypes = {
|
|
34
|
+
children: _propTypes.default.any.isRequired
|
|
35
|
+
};
|
|
36
|
+
const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n width: 100%;\n height: 100%;\n padding: 0 32px 32px;\n\n @media (max-width: 768px) {\n padding: 0 16px 16px;\n }\n"])));
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _launcherUtil = require("@blocklet/launcher-util");
|
|
11
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
|
+
var _useMobile = _interopRequireDefault(require("@blocklet/launcher-ux/lib/use-mobile"));
|
|
13
|
+
var _util = require("../../lib/util");
|
|
14
|
+
var _locale = require("../contexts/locale");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _templateObject, _templateObject2;
|
|
17
|
+
const _excluded = ["plan", "productFeatures", "toc", "checked", "recommend"];
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
20
|
+
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; }
|
|
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
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
25
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
26
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
+
var CpuIcon = function CpuIcon(props) {
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", _objectSpread(_objectSpread({}, props), {}, {
|
|
29
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
30
|
+
width: "40",
|
|
31
|
+
height: "40",
|
|
32
|
+
rx: "20",
|
|
33
|
+
fill: "#FEAF49"
|
|
34
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
35
|
+
opacity: ".34",
|
|
36
|
+
fillRule: "evenodd",
|
|
37
|
+
clipRule: "evenodd",
|
|
38
|
+
d: "M20.15 23.6a.9.9 0 0 1 .9.9v2.1a.9.9 0 0 1-1.8 0v-2.1a.9.9 0 0 1 .9-.9Z",
|
|
39
|
+
fill: "#fff"
|
|
40
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
41
|
+
fillRule: "evenodd",
|
|
42
|
+
clipRule: "evenodd",
|
|
43
|
+
d: "M14.25 29c0-1.597 1.303-2.9 2.9-2.9h6c1.597 0 2.9 1.303 2.9 2.9v1.9h-11.8V29Zm2.9-1.1c-.603 0-1.1.497-1.1 1.1v.1h8.2V29c0-.603-.497-1.1-1.1-1.1h-6Z",
|
|
44
|
+
fill: "#fff"
|
|
45
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
46
|
+
fillRule: "evenodd",
|
|
47
|
+
clipRule: "evenodd",
|
|
48
|
+
d: "M13.25 30a.9.9 0 0 1 .9-.9h12a.9.9 0 0 1 0 1.8h-12a.9.9 0 0 1-.9-.9ZM17 10.9a3.099 3.099 0 0 0-3.1 3.1v3c0 3.373 2.727 6.1 6.1 6.1 3.373 0 6.1-2.727 6.1-6.1v-3c0-1.713-1.387-3.1-3.1-3.1h-6ZM12.1 14c0-2.707 2.193-4.9 4.9-4.9h6c2.707 0 4.9 2.193 4.9 4.9v3c0 4.367-3.533 7.9-7.9 7.9a7.895 7.895 0 0 1-7.9-7.9v-3Z",
|
|
49
|
+
fill: "#fff"
|
|
50
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
51
|
+
opacity: ".34",
|
|
52
|
+
fillRule: "evenodd",
|
|
53
|
+
clipRule: "evenodd",
|
|
54
|
+
d: "M12.016 13.333a1.572 1.572 0 0 0-1.077 1.517c0 1.035.405 1.96 1.09 2.79a7.935 7.935 0 0 1-.04-.79v-3c0-.173.009-.346.027-.517ZM9.139 14.85c0-1.897 1.503-3.4 3.4-3.4h.65a.9.9 0 0 1 .825 1.259 2.858 2.858 0 0 0-.225 1.141v3c0 .872.183 1.691.507 2.444a.9.9 0 0 1-1.101 1.213 5.76 5.76 0 0 1-2.325-1.455C9.863 17.934 9.14 16.528 9.14 14.85ZM26.057 11.857a.9.9 0 0 1 .752-.407h.65c1.897 0 3.4 1.503 3.4 3.4 0 1.678-.724 3.084-1.73 4.202l-.033.035a5.758 5.758 0 0 1-2.292 1.42.9.9 0 0 1-1.101-1.213 6.148 6.148 0 0 0 .506-2.444v-3c0-.417-.078-.804-.225-1.141a.9.9 0 0 1 .073-.852Zm1.926 1.476c.017.171.026.344.026.517v3c0 .267-.013.53-.039.79.685-.83 1.09-1.755 1.09-2.79 0-.718-.442-1.306-1.077-1.517Z",
|
|
55
|
+
fill: "#fff"
|
|
56
|
+
})]
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
CpuIcon.defaultProps = {
|
|
60
|
+
width: "40",
|
|
61
|
+
height: "40",
|
|
62
|
+
fill: "none",
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
64
|
+
};
|
|
65
|
+
var CheckIcon = function CheckIcon(props) {
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", _objectSpread(_objectSpread({}, props), {}, {
|
|
67
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
68
|
+
d: "M10 20c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z",
|
|
69
|
+
fill: "#1DC1C7"
|
|
70
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
71
|
+
d: "m5.474 10.646 2.586 2.586 6.465-6.465",
|
|
72
|
+
fill: "#1DC1C7"
|
|
73
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
74
|
+
fillRule: "evenodd",
|
|
75
|
+
clipRule: "evenodd",
|
|
76
|
+
d: "M15.233 6.06a1 1 0 0 1 0 1.415L8.768 13.94a1 1 0 0 1-1.415 0l-2.586-2.586a1 1 0 1 1 1.415-1.415l1.878 1.88 5.758-5.759a1 1 0 0 1 1.415 0Z",
|
|
77
|
+
fill: "#fff"
|
|
78
|
+
})]
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
CheckIcon.defaultProps = {
|
|
82
|
+
width: "20",
|
|
83
|
+
height: "20",
|
|
84
|
+
fill: "none",
|
|
85
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
86
|
+
};
|
|
87
|
+
var CheckReverseIcon = function CheckReverseIcon(props) {
|
|
88
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", _objectSpread(_objectSpread({}, props), {}, {
|
|
89
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
90
|
+
d: "M10.75 20c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10Z",
|
|
91
|
+
fill: "#fff"
|
|
92
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
93
|
+
d: "m6.224 10.646 2.586 2.586 6.465-6.465",
|
|
94
|
+
fill: "#fff"
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
96
|
+
d: "m6.224 10.646 2.586 2.586 6.465-6.465",
|
|
97
|
+
stroke: "#1DC1C7",
|
|
98
|
+
strokeWidth: "2",
|
|
99
|
+
strokeLinecap: "round",
|
|
100
|
+
strokeLinejoin: "round"
|
|
101
|
+
})]
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
CheckReverseIcon.defaultProps = {
|
|
105
|
+
width: "21",
|
|
106
|
+
height: "20",
|
|
107
|
+
fill: "none",
|
|
108
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
109
|
+
};
|
|
110
|
+
function Feature(_ref) {
|
|
111
|
+
let {
|
|
112
|
+
feature,
|
|
113
|
+
locale,
|
|
114
|
+
checked,
|
|
115
|
+
isMobile
|
|
116
|
+
} = _ref;
|
|
117
|
+
let valueEle = '';
|
|
118
|
+
if (feature.type === 'boolean') {
|
|
119
|
+
valueEle = checked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckReverseIcon, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckIcon, {});
|
|
120
|
+
}
|
|
121
|
+
if (feature.type === 'text') {
|
|
122
|
+
valueEle = feature.value[locale];
|
|
123
|
+
}
|
|
124
|
+
if (isMobile) {
|
|
125
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
126
|
+
style: {
|
|
127
|
+
display: 'flex',
|
|
128
|
+
alignItems: 'center'
|
|
129
|
+
},
|
|
130
|
+
children: [feature.type === 'boolean' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
131
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
132
|
+
component: "span",
|
|
133
|
+
style: {
|
|
134
|
+
display: 'flex',
|
|
135
|
+
alignItems: 'center'
|
|
136
|
+
},
|
|
137
|
+
children: valueEle
|
|
138
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
139
|
+
component: "span",
|
|
140
|
+
style: {
|
|
141
|
+
marginLeft: '8px'
|
|
142
|
+
},
|
|
143
|
+
children: feature.name[locale]
|
|
144
|
+
})]
|
|
145
|
+
}), feature.type === 'text' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
146
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
147
|
+
component: "span",
|
|
148
|
+
children: feature.name[locale]
|
|
149
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
150
|
+
component: "span",
|
|
151
|
+
style: {
|
|
152
|
+
display: 'flex',
|
|
153
|
+
alignItems: 'center'
|
|
154
|
+
},
|
|
155
|
+
children: valueEle
|
|
156
|
+
})]
|
|
157
|
+
})]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return valueEle;
|
|
161
|
+
}
|
|
162
|
+
Feature.propTypes = {
|
|
163
|
+
feature: _propTypes.default.object.isRequired,
|
|
164
|
+
locale: _propTypes.default.string.isRequired,
|
|
165
|
+
checked: _propTypes.default.bool,
|
|
166
|
+
isMobile: _propTypes.default.bool
|
|
167
|
+
};
|
|
168
|
+
Feature.defaultProps = {
|
|
169
|
+
checked: false,
|
|
170
|
+
isMobile: false
|
|
171
|
+
};
|
|
172
|
+
function Plan(_ref2) {
|
|
173
|
+
let {
|
|
174
|
+
plan,
|
|
175
|
+
productFeatures,
|
|
176
|
+
toc,
|
|
177
|
+
checked,
|
|
178
|
+
recommend
|
|
179
|
+
} = _ref2,
|
|
180
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
181
|
+
const {
|
|
182
|
+
locale,
|
|
183
|
+
t
|
|
184
|
+
} = (0, _locale.useLocaleContext)();
|
|
185
|
+
const {
|
|
186
|
+
isMobile
|
|
187
|
+
} = (0, _useMobile.default)();
|
|
188
|
+
if (toc) {
|
|
189
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
190
|
+
className: "toc",
|
|
191
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
192
|
+
className: "basic"
|
|
193
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
194
|
+
className: "features toc__title",
|
|
195
|
+
children: (productFeatures || []).map(_ref3 => {
|
|
196
|
+
let {
|
|
197
|
+
_id,
|
|
198
|
+
name
|
|
199
|
+
} = _ref3;
|
|
200
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
201
|
+
className: "feature",
|
|
202
|
+
children: name[locale]
|
|
203
|
+
}, _id);
|
|
204
|
+
})
|
|
205
|
+
})]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
let features = [];
|
|
209
|
+
try {
|
|
210
|
+
// TODO: Pricing Table: 临时做法
|
|
211
|
+
if (Array.isArray(plan.features) && plan.features.length > 0) {
|
|
212
|
+
features = JSON.parse(plan.features[0].en);
|
|
213
|
+
}
|
|
214
|
+
} catch (error) {
|
|
215
|
+
console.error('parse features failed:', error);
|
|
216
|
+
}
|
|
217
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Outer, _objectSpread(_objectSpread({
|
|
218
|
+
className: recommend ? 'card-recommend' : ''
|
|
219
|
+
}, rest), {}, {
|
|
220
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
221
|
+
className: "recommend-icon",
|
|
222
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CpuIcon, {})
|
|
223
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
224
|
+
checked: checked,
|
|
225
|
+
className: "card-container ".concat(checked ? 'checked' : ''),
|
|
226
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
227
|
+
className: "basic",
|
|
228
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
229
|
+
className: "header",
|
|
230
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
231
|
+
className: "header__title",
|
|
232
|
+
children: t('common.space')
|
|
233
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
234
|
+
className: "header__name",
|
|
235
|
+
children: plan === null || plan === void 0 ? void 0 : plan.name[locale]
|
|
236
|
+
})]
|
|
237
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
238
|
+
className: "price-info",
|
|
239
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
240
|
+
className: "price",
|
|
241
|
+
children: (0, _util.getPrice)(plan.prices, 'ocap')
|
|
242
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
243
|
+
className: "period",
|
|
244
|
+
children: (0, _launcherUtil.prettyDuration)(plan.duration, locale)
|
|
245
|
+
})]
|
|
246
|
+
})]
|
|
247
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
248
|
+
className: "features",
|
|
249
|
+
children: features.map(feature => {
|
|
250
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
251
|
+
className: "feature",
|
|
252
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Feature, {
|
|
253
|
+
feature: feature,
|
|
254
|
+
locale: locale,
|
|
255
|
+
checked: checked,
|
|
256
|
+
isMobile: isMobile
|
|
257
|
+
})
|
|
258
|
+
}, feature._id);
|
|
259
|
+
})
|
|
260
|
+
})]
|
|
261
|
+
})]
|
|
262
|
+
}));
|
|
263
|
+
}
|
|
264
|
+
const Outer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n .recommend-icon {\n display: none;\n }\n\n &.card-recommend {\n .recommend-icon {\n display: block;\n position: absolute;\n top: -8px;\n right: 0px;\n }\n"])));
|
|
265
|
+
const Container = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n flex-direction: column;\n border-radius: 12px;\n padding: 16px;\n overflow: hidden;\n white-space: nowrap;\n min-height: 400px;\n margin: 8px;\n\n .toc__title {\n font-weight: bolder;\n align-items: flex-start;\n }\n\n &:not(.toc) {\n color: #000;\n background-color: ", ";\n cursor: pointer;\n }\n\n &:not(.toc, .checked):hover {\n color: #000;\n background-color: #ddf6f8;\n cursor: pointer;\n }\n\n &.checked {\n color: #fff;\n background-color: ", ";\n cursor: pointer;\n }\n\n .basic {\n width: 100%;\n height: 8em;\n\n .header {\n text-align: center;\n .header__title {\n color: ", ";\n }\n\n .header__name {\n font-weight: bolder;\n }\n }\n\n .price-info {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n height: 6.5em;\n\n .price {\n font-size: 1.5em;\n font-weight: bolder;\n }\n\n .period {\n color: ", ";\n }\n }\n }\n\n .features {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-top: auto;\n\n .feature {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 48px;\n\n @media (min-width: ", "px) {\n margin-left: 28px;\n }\n\n @media (max-width: ", "px) {\n justify-content: flex-start;\n }\n\n &:not(:last-child) {\n border-bottom: 1px solid;\n border-bottom-color: ", ";\n }\n }\n }\n"])), props => props.theme.palette.secondary.main, props => props.theme.palette.primary.main, props => props.checked ? '#ffffff' : '#9397a1', props => props.checked ? '#ffffff' : '#9397a1', props => props.theme.breakpoints.values.md, props => props.theme.breakpoints.values.md, props => props.checked || props.hovered ? 'rgba(255, 255, 255, 0.2)' : '#f6f6f6');
|
|
266
|
+
Plan.propTypes = {
|
|
267
|
+
plan: _propTypes.default.object,
|
|
268
|
+
productFeatures: _propTypes.default.array,
|
|
269
|
+
checked: _propTypes.default.bool,
|
|
270
|
+
recommend: _propTypes.default.bool,
|
|
271
|
+
toc: _propTypes.default.bool
|
|
272
|
+
};
|
|
273
|
+
Plan.defaultProps = {
|
|
274
|
+
plan: null,
|
|
275
|
+
productFeatures: [],
|
|
276
|
+
checked: false,
|
|
277
|
+
recommend: false,
|
|
278
|
+
toc: false
|
|
279
|
+
};
|
|
280
|
+
var _default = Plan;
|
|
281
|
+
exports.default = _default;
|