@blocklet/launcher-workflow 2.0.5 → 2.0.6

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.
@@ -0,0 +1,8 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ viewBox="0 0 40 40"
4
+ width="40"
5
+ height="40"
6
+ focusable="false">
7
+ <path d="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z"></path>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ viewBox="0 0 40 40"
4
+ width="40"
5
+ height="40"
6
+ focusable="false">
7
+ <path d="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z"></path>
8
+ </svg>
package/lib/checkout.js CHANGED
@@ -93,7 +93,8 @@ function CheckoutPage() {
93
93
  const query = (0, _query.default)();
94
94
  const [searchParams] = (0, _reactRouterDom.useSearchParams)();
95
95
  const {
96
- mobileSize
96
+ mobileSize,
97
+ isMobile
97
98
  } = (0, _useMobile.default)();
98
99
  const {
99
100
  routerPrefix,
@@ -202,12 +203,15 @@ function CheckoutPage() {
202
203
  className: "space details",
203
204
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
204
205
  className: "basic",
205
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SpaceIcon, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
206
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SpaceIcon, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
206
207
  className: "basic-info",
207
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
208
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
208
209
  className: "title",
209
210
  children: plan.name[locale]
210
- })
211
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
212
+ className: "sub-title",
213
+ children: t('common.space')
214
+ })]
211
215
  })]
212
216
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
213
217
  className: "price",
@@ -275,13 +279,13 @@ function CheckoutPage() {
275
279
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_footer.default, {
276
280
  className: "footer",
277
281
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
278
- className: "left",
282
+ className: "agreement",
279
283
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.default, {
280
284
  checked: agree,
281
285
  onClick: () => toggleAgreement(),
282
286
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
283
287
  children: [t('common.agreeTo'), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
284
- className: "agreement",
288
+ className: "agreement-label",
285
289
  onClick: e => {
286
290
  e.stopPropagation();
287
291
  setShowAgreement(true);
@@ -290,16 +294,22 @@ function CheckoutPage() {
290
294
  })]
291
295
  })
292
296
  })
293
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
294
- className: "right",
295
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
297
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
298
+ className: "actions",
299
+ children: [isMobile && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
300
+ loading: paying,
301
+ className: "button-previous",
302
+ variant: "outlined",
303
+ onClick: () => navigate(-1),
304
+ children: t('common.previous')
305
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
296
306
  loading: paying,
297
307
  className: "button-pay",
298
308
  disabled: paying || showPayment || !planId || !paymentMethod || !agree,
299
309
  variant: "contained",
300
310
  onClick: handlePay,
301
311
  children: t('common.pay')
302
- })
312
+ })]
303
313
  })]
304
314
  }), showPayment && /*#__PURE__*/(0, _jsxRuntime.jsx)(_payment.default, {
305
315
  baseURL: didPayPrefix,
@@ -317,6 +327,6 @@ function CheckoutPage() {
317
327
  })]
318
328
  });
319
329
  }
320
- const Container = (0, _styled.default)(_layout.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .header {\n font-weight: bolder;\n font-size: 1.2em;\n }\n\n .divider {\n margin-top: 20px;\n border: 1.2px solid #f6f6f6;\n }\n\n .skeleton {\n height: 64px;\n }\n\n .space {\n margin-top: 18px;\n }\n\n .total-order {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-weight: bolder;\n }\n\n .total-payment {\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: ", ";\n font-size: 22px;\n font-weight: bolder;\n }\n\n .details {\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 40px;\n\n .basic {\n display: flex;\n height: 40px;\n\n .basic-info {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n margin-left: 8px;\n\n .title {\n font-weight: bolder;\n }\n\n .sub-title {\n color: grey;\n font-size: 0.8em;\n }\n }\n }\n\n .period {\n display: flex;\n align-items: center;\n\n .info-icon {\n color: grey;\n margin-left: 8px;\n }\n }\n }\n\n .payment-method {\n background-color: #fbfbfb;\n padding: 18px;\n\n .payment-method__title {\n color: #9397a1;\n }\n\n .payment-method__list {\n margin-top: 8px;\n }\n }\n\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n .left {\n .agreement {\n margin-left: 5px;\n color: ", ";\n }\n }\n\n .right {\n .button-pay {\n width: 200px;\n }\n }\n\n @media (max-width: ", ") {\n flex-direction: column;\n align-items: center;\n\n .right {\n width: 100%;\n\n .button-pay {\n width: 100%;\n margin-top: 18px;\n }\n }\n }\n }\n"])), props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.mobileSize);
330
+ const Container = (0, _styled.default)(_layout.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .header {\n font-weight: bolder;\n font-size: 1.2em;\n }\n\n .divider {\n margin-top: 20px;\n border: 1.2px solid #f6f6f6;\n }\n\n .skeleton {\n height: 64px;\n }\n\n .space {\n margin-top: 18px;\n }\n\n .total-order {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-weight: bolder;\n }\n\n .total-payment {\n display: flex;\n justify-content: space-between;\n align-items: center;\n color: ", ";\n font-size: 22px;\n font-weight: bolder;\n }\n\n .details {\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 40px;\n\n .basic {\n display: flex;\n height: 40px;\n\n .basic-info {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n margin-left: 8px;\n\n .title {\n font-weight: bolder;\n }\n\n .sub-title {\n color: grey;\n font-size: 0.8em;\n }\n }\n }\n\n .period {\n display: flex;\n align-items: center;\n\n .info-icon {\n color: grey;\n margin-left: 8px;\n }\n }\n }\n\n .payment-method {\n background-color: #fbfbfb;\n padding: 18px;\n\n .payment-method__title {\n color: #9397a1;\n }\n\n .payment-method__list {\n margin-top: 8px;\n }\n }\n\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n .agreement {\n .agreement-label {\n margin-left: 4px;\n color: ", ";\n }\n }\n\n @media (min-width: ", ") {\n .actions {\n .button-pay {\n width: 200px;\n }\n }\n }\n\n @media (max-width: ", ") {\n flex-direction: column;\n align-items: center;\n\n .actions {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-top: 20px;\n\n & > button {\n width: 48%;\n }\n }\n }\n }\n"])), props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.mobileSize, props => props.mobileSize);
321
331
  var _default = CheckoutPage;
322
332
  exports.default = _default;
@@ -8,7 +8,6 @@ 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"));
12
11
  var _useInterval = _interopRequireDefault(require("react-use/lib/useInterval"));
13
12
  var _lodash2 = _interopRequireDefault(require("lodash.throttle"));
14
13
  var _styled = _interopRequireDefault(require("@emotion/styled"));
@@ -45,8 +44,7 @@ const STATUS = {
45
44
  };
46
45
  function LaunchDedicated(_ref) {
47
46
  let {
48
- type,
49
- routerPrefix
47
+ type
50
48
  } = _ref;
51
49
  const query = (0, _query.default)();
52
50
  const blockletMetaUrl = query.get('blocklet_meta_url');
@@ -66,6 +64,7 @@ function LaunchDedicated(_ref) {
66
64
  } = (0, _request.default)();
67
65
  const [progressStepIndex, setProgressStepIndex] = (0, _react.useState)(0);
68
66
  const [isDone, setIsDone] = (0, _react.useState)(false);
67
+ const navigate = (0, _reactRouterDom.useNavigate)();
69
68
  let createServerTime = sessionStorage.getItem("launcher-create-server-".concat(nftId, "-time"));
70
69
  if (!createServerTime) {
71
70
  createServerTime = Date.now();
@@ -78,7 +77,8 @@ function LaunchDedicated(_ref) {
78
77
  serverUrl: instance.serverUrl,
79
78
  blockletMetaUrl,
80
79
  locale,
81
- chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST
80
+ chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST,
81
+ from: query.get('from')
82
82
  });
83
83
  setIsDone(true);
84
84
  setTimeout(() => {
@@ -217,8 +217,7 @@ function LaunchDedicated(_ref) {
217
217
  color: "primary",
218
218
  variant: "contained",
219
219
  className: "button",
220
- component: _reactRouterDom.Link,
221
- to: (0, _urlJoin.default)(routerPrefix, "/prepare/".concat(nftId).concat(window.location.search)),
220
+ onClick: () => navigate(0),
222
221
  children: t('common.retry')
223
222
  })
224
223
  }), launchState.status === STATUS.notFoundError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_launchResultMessage.default, {
@@ -239,10 +238,8 @@ const LinkEle = _styled.default.a(_templateObject || (_templateObject = _taggedT
239
238
  const WaiterContainer = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: #1dc1c7;\n"])));
240
239
  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);
241
240
  LaunchDedicated.propTypes = {
242
- type: _propTypes.default.oneOf(['launch', 'start']),
243
- routerPrefix: _propTypes.default.string
241
+ type: _propTypes.default.oneOf(['launch', 'start'])
244
242
  };
245
243
  LaunchDedicated.defaultProps = {
246
- type: 'launch',
247
- routerPrefix: ''
244
+ type: 'launch'
248
245
  };
@@ -15,6 +15,7 @@ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularPr
15
15
  var _locale = require("../contexts/locale");
16
16
  var _util = require("../util");
17
17
  var _request = _interopRequireDefault(require("../contexts/request"));
18
+ var _query = _interopRequireDefault(require("../hooks/query"));
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
20
  var _templateObject;
20
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -31,6 +32,7 @@ function LaunchServerless(_ref) {
31
32
  api
32
33
  } = (0, _request.default)();
33
34
  const [searchParams] = (0, _reactRouterDom.useSearchParams)();
35
+ const query = (0, _query.default)();
34
36
  const state = (0, _useAsync.default)(async () => {
35
37
  const {
36
38
  data: {
@@ -45,7 +47,8 @@ function LaunchServerless(_ref) {
45
47
  locale,
46
48
  launchType: 'serverless',
47
49
  nftId,
48
- chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST
50
+ chainHost: (_window$blocklet = window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.CHAIN_HOST,
51
+ from: query.get('from')
49
52
  });
50
53
  }, 3000);
51
54
  });
package/lib/locales/en.js CHANGED
@@ -21,6 +21,7 @@ module.exports = {
21
21
  loadFailed: 'Failed to load the resource, please refresh the page and try again.',
22
22
  payFailed: 'Payment failed',
23
23
  details: 'Details',
24
+ previous: 'Previous',
24
25
  pay: 'Pay',
25
26
  space: 'Space'
26
27
  },
@@ -62,24 +63,24 @@ module.exports = {
62
63
  success: 'Launching'
63
64
  },
64
65
  error: {
65
- launchFailed: 'Blocklet Server Launch Failed',
66
+ launchFailed: 'Launch Space Failed',
66
67
  launchFailedDescription: 'You can retry by clicking the button below',
67
68
  notFound: 'No Blocklet Server being started',
68
- notFoundDescription: 'You can launch the Blocklet Server by clicking the button below'
69
+ notFoundDescription: 'You can launch the Space by clicking the button below'
69
70
  }
70
71
  },
71
72
  start: {
72
- title: 'Starting Blocklet Server',
73
+ title: 'Starting Space',
73
74
  error: {
74
- launchFailed: 'Blocklet Server Launch Failed',
75
- notFound: 'No Blocklet Server being started'
75
+ launchFailed: 'Start Space Failed',
76
+ notFound: 'No Spacebeing started'
76
77
  }
77
78
  },
78
79
  redeem: {
79
- title: 'Redeem Blocklet Server',
80
+ title: 'Redeem Space',
80
81
  subTitle: 'Name the blocklet server you are going to redeem, the name will exist on server passport',
81
82
  dialog: {
82
- title: 'Redeem Blocklet Server',
83
+ title: 'Redeem Space',
83
84
  scan: 'Scan the QR code below with your DID wallet to complete redeem',
84
85
  confirm: 'Confirm on your DID Wallet',
85
86
  success: 'Your redeem request is being processing'
@@ -97,6 +98,7 @@ module.exports = {
97
98
  purchase: {
98
99
  pageTitle: 'Purchase Space',
99
100
  selectSpaceHint: 'Already have dedicated space? Click here to select >',
101
+ morePlanPrompt: 'Flip the page to see more plans',
100
102
  dialog: {
101
103
  title: 'Purchase Blocklet Server NFT',
102
104
  scan: 'Scan the QR code below with your DID wallet to complete purchase',
package/lib/locales/zh.js CHANGED
@@ -22,6 +22,7 @@ module.exports = {
22
22
  loadFailed: '加载资源失败, 请刷新页面重试。',
23
23
  details: '明细',
24
24
  pay: '支付',
25
+ previous: '上一步',
25
26
  space: '空间'
26
27
  },
27
28
  license: {
@@ -62,17 +63,17 @@ module.exports = {
62
63
  success: '正在启动'
63
64
  },
64
65
  error: {
65
- launchFailed: '节点启动失败',
66
+ launchFailed: '节点空间失败',
66
67
  launchFailedDescription: '您可以点击下面按钮重试',
67
- notFound: '没有正在启动的节点',
68
+ notFound: '没有正在启动的空间',
68
69
  notFoundDescription: '您可以点击下面按钮启动节点'
69
70
  }
70
71
  },
71
72
  start: {
72
- title: '启动节点',
73
+ title: '启动空间',
73
74
  error: {
74
- launchFailed: '节点启动失败',
75
- notFound: '没有正在启动的节点'
75
+ launchFailed: '启动空间失败',
76
+ notFound: '没有正在启动的空间'
76
77
  }
77
78
  },
78
79
  redeem: {
@@ -97,6 +98,7 @@ module.exports = {
97
98
  purchase: {
98
99
  pageTitle: '选购空间',
99
100
  selectSpaceHint: '已有专用空间?点击这里选择 >',
101
+ morePlanPrompt: '翻页看更多方案',
100
102
  dialog: {
101
103
  title: '购买 Blocklet Server NFT',
102
104
  scan: '用您的 DID 钱包扫描下面的二维码完成购买',
package/lib/purchase.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactRouterDom = require("react-router-dom");
10
10
  var _useAsync = _interopRequireDefault(require("react-use/lib/useAsync"));
@@ -17,6 +17,7 @@ var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
17
17
  var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
18
18
  var _useMobile = _interopRequireDefault(require("@blocklet/launcher-ux/lib/use-mobile"));
19
19
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
20
+ var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
20
21
  require("@splidejs/splide/dist/css/splide.min.css");
21
22
  var _body = _interopRequireDefault(require("./components/layout/body"));
22
23
  var _plan = _interopRequireDefault(require("./components/plan"));
@@ -29,9 +30,40 @@ var _workflow = require("./contexts/workflow");
29
30
  var _jsxRuntime = require("react/jsx-runtime");
30
31
  var _templateObject;
31
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+ 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; }
36
+ 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; }
37
+ 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; }
38
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
39
+ 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); }
32
40
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
41
+ var PrevIcon = function PrevIcon(props) {
42
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread(_objectSpread({}, props), {}, {
43
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
44
+ d: "m15.5.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4L15.5.912z"
45
+ })
46
+ }));
47
+ };
48
+ PrevIcon.defaultProps = {
49
+ xmlns: "http://www.w3.org/2000/svg",
50
+ width: "40",
51
+ height: "40"
52
+ };
53
+ var NextIcon = function NextIcon(props) {
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread(_objectSpread({}, props), {}, {
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
56
+ d: "m15.5.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4L15.5.912z"
57
+ })
58
+ }));
59
+ };
60
+ NextIcon.defaultProps = {
61
+ xmlns: "http://www.w3.org/2000/svg",
62
+ width: "40",
63
+ height: "40"
64
+ };
33
65
  function PurchasePage(_ref) {
34
- var _planState$value;
66
+ var _planState$value, _planState$value2;
35
67
  let {
36
68
  disableBack
37
69
  } = _ref;
@@ -48,6 +80,7 @@ function PurchasePage(_ref) {
48
80
  search
49
81
  } = (0, _reactRouterDom.useLocation)();
50
82
  const [selectedPlanId, setSelectedPlanId] = (0, _react.useState)();
83
+ const [openMorePlanPrompt, setOpenMorePlanPrompt] = (0, _react.useState)(true);
51
84
  const [splideConfig, setSplideConfig] = (0, _useSetState.default)({
52
85
  arrows: false
53
86
  });
@@ -59,13 +92,18 @@ function PurchasePage(_ref) {
59
92
  const api = create({
60
93
  baseURL: didPayPrefix
61
94
  });
95
+ (0, _react.useEffect)(() => {
96
+ // 3s 后隐藏
97
+ setTimeout(() => setOpenMorePlanPrompt(false), 3000);
98
+ }, []);
62
99
  const planState = (0, _useAsync.default)(async () => {
63
100
  const {
64
101
  data
65
102
  } = await api.get('/plans');
66
- const plans = (data || []).sort((itemX, itemY) => itemX.weight - itemY.weight);
103
+ const plans = (data || []).sort((itemX, itemY) => itemY.weight - itemX.weight);
67
104
  if (plans.length > 0) {
68
- setSelectedPlanId(plans[0]._id);
105
+ const recommendPlan = plans.find(x => !!x.isRecommended) || plans[0];
106
+ setSelectedPlanId(recommendPlan._id);
69
107
  }
70
108
  return plans;
71
109
  });
@@ -111,7 +149,7 @@ function PurchasePage(_ref) {
111
149
  toc: true,
112
150
  productFeatures: productFeatures,
113
151
  className: "toc"
114
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSplide.Splide, {
152
+ }), ((_planState$value2 = planState.value) === null || _planState$value2 === void 0 ? void 0 : _planState$value2.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactSplide.Splide, {
115
153
  className: "plan-splide",
116
154
  extensions: {
117
155
  Grid: _splideExtensionGrid.Grid
@@ -124,12 +162,7 @@ function PurchasePage(_ref) {
124
162
  arrows: items.length > 1
125
163
  });
126
164
  },
127
- onActive: (_, _ref3) => {
128
- let {
129
- index
130
- } = _ref3;
131
- handleSelect(planState.value[index]._id);
132
- },
165
+ hasTrack: false,
133
166
  options: {
134
167
  pagination: true,
135
168
  arrows: splideConfig.arrows,
@@ -155,14 +188,39 @@ function PurchasePage(_ref) {
155
188
  }
156
189
  }
157
190
  },
158
- children: (planState.value || []).map((plan, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSplide.SplideSlide, {
159
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_plan.default, {
160
- recommend: index === 0,
161
- checked: plan._id === selectedPlanId,
162
- plan: plan,
163
- onClick: () => handleSelect(plan._id)
164
- })
165
- }, plan._id))
191
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
192
+ className: "splide__arrows",
193
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
194
+ className: "splide__arrow splide__arrow--prev",
195
+ type: "button",
196
+ disabled: "",
197
+ "aria-label": "Previous slide",
198
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PrevIcon, {
199
+ viewBox: "0 0 40 40"
200
+ })
201
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
202
+ open: openMorePlanPrompt,
203
+ title: t('purchase.morePlanPrompt'),
204
+ placement: "top",
205
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
206
+ className: "splide__arrow splide__arrow--next",
207
+ type: "button",
208
+ "aria-label": "Next slide",
209
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NextIcon, {
210
+ viewBox: "0 0 40 40"
211
+ })
212
+ })
213
+ })]
214
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSplide.SplideTrack, {
215
+ children: planState.value.map(plan => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSplide.SplideSlide, {
216
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_plan.default, {
217
+ recommend: !!plan.isRecommended,
218
+ checked: plan._id === selectedPlanId,
219
+ plan: plan,
220
+ onClick: () => handleSelect(plan._id)
221
+ })
222
+ }, plan._id))
223
+ })]
166
224
  })]
167
225
  })
168
226
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_footer.default, {
package/lib/util.js CHANGED
@@ -22,12 +22,16 @@ const getLaunchBlockletUrl = _ref => {
22
22
  locale,
23
23
  launchType,
24
24
  nftId,
25
- chainHost
25
+ chainHost,
26
+ from
26
27
  } = _ref;
27
28
  if (!blockletMetaUrl) {
28
29
  return serverUrl;
29
30
  }
30
- let result = (0, _urlJoin.default)(serverUrl, "/launch-blocklet/install?blocklet_meta_url=".concat(encodeURIComponent(blockletMetaUrl), "&fromLauncher=true&from=").concat(encodeURIComponent(window.location.href)));
31
+ const serverPath = from === 'did-spaces' ? '/blocklets/restore/verify-ownership' : '/launch-blocklet/install';
32
+
33
+ // TODO: 废除 fromLauncher
34
+ let result = (0, _urlJoin.default)(serverUrl, serverPath, "?blocklet_meta_url=".concat(encodeURIComponent(blockletMetaUrl), "&fromLauncher=true&from=launcher"));
31
35
  if (launchType) {
32
36
  result += "&launchType=".concat(launchType);
33
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -36,24 +36,24 @@
36
36
  "react": ">=18.1.0"
37
37
  },
38
38
  "dependencies": {
39
- "@arcblock/did-connect": "^2.5.10",
40
- "@arcblock/icons": "^2.5.10",
41
- "@arcblock/license": "^2.5.10",
42
- "@arcblock/ux": "^2.5.10",
43
- "@blocklet/launcher-layout": "2.0.5",
44
- "@blocklet/launcher-util": "2.0.5",
45
- "@blocklet/launcher-ux": "2.0.5",
46
- "@did-pay/react": "^1.9.41",
39
+ "@arcblock/did-connect": "^2.5.14",
40
+ "@arcblock/icons": "^2.5.14",
41
+ "@arcblock/license": "^2.5.14",
42
+ "@arcblock/ux": "^2.5.14",
43
+ "@blocklet/launcher-layout": "2.0.6",
44
+ "@blocklet/launcher-util": "2.0.6",
45
+ "@blocklet/launcher-ux": "2.0.6",
46
+ "@did-pay/react": "^1.9.44",
47
47
  "@emotion/react": "^11.10.6",
48
48
  "@emotion/styled": "^11.10.6",
49
49
  "@mui/icons-material": "^5.11.11",
50
50
  "@mui/material": "^5.11.13",
51
- "@ocap/util": "^1.18.58",
51
+ "@ocap/util": "^1.18.62",
52
52
  "@splidejs/react-splide": "^0.7.12",
53
53
  "@splidejs/splide": "^4.1.4",
54
54
  "@splidejs/splide-extension-grid": "^0.4.1",
55
55
  "@stripe/react-stripe-js": "^1.16.5",
56
- "@stripe/stripe-js": "^1.49.0",
56
+ "@stripe/stripe-js": "^1.50.0",
57
57
  "axios": "^0.26.1",
58
58
  "flat": "^5.0.2",
59
59
  "js-cookie": "^3.0.1",
@@ -72,5 +72,5 @@
72
72
  "@babel/preset-react": "^7.18.6",
73
73
  "babel-plugin-inline-react-svg": "^2.0.2"
74
74
  },
75
- "gitHead": "e8dfa1e5aa7384efbd60c38a73fdec4e5bdbdc25"
75
+ "gitHead": "f79a79117418142d7a4805950de4e62e80d2d032"
76
76
  }