@blocklet/launcher-workflow 1.9.36 → 1.9.37

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/locales/en.js CHANGED
@@ -100,6 +100,10 @@ module.exports = {
100
100
  confirm: 'Confirm on your DID Wallet',
101
101
  success: 'Purchase Success'
102
102
  },
103
- purchaseServerlessSuccess: 'The purchase of no service is successful and you can go ahead and install Blocklet'
103
+ serverlessDialog: {
104
+ title: 'Purchase successfully',
105
+ redirectToStoreButton: 'Go to install the application →',
106
+ purchaseServerlessSuccess: 'The purchase of Running Space is successful and you can go ahead and install Blocklet.'
107
+ }
104
108
  }
105
109
  };
package/lib/locales/zh.js CHANGED
@@ -100,6 +100,10 @@ module.exports = {
100
100
  confirm: '在您的 DID 钱包上确认',
101
101
  success: '支付成功'
102
102
  },
103
- purchaseServerlessSuccess: '购买无服务成功,您可以去安装 Blocklet'
103
+ serverlessDialog: {
104
+ title: '购买成功',
105
+ redirectToStoreButton: '去安装应用 →',
106
+ purchaseServerlessSuccess: '购买运行空间成功,您可以去安装应用.'
107
+ }
104
108
  }
105
109
  };
package/lib/purchase.js CHANGED
@@ -19,6 +19,7 @@ var _pageHeader = _interopRequireDefault(require("@blocklet/launcher-layout/lib/
19
19
  var _constant = require("@blocklet/launcher-util/lib/constant");
20
20
  var _submit = _interopRequireDefault(require("@blocklet/launcher-ux/lib/hot-key/submit"));
21
21
  var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
22
+ var _Dialog = require("@arcblock/ux/lib/Dialog");
22
23
  var _payment = _interopRequireDefault(require("@did-pay/react/lib/payment"));
23
24
  var _list = _interopRequireDefault(require("@did-pay/react/lib/payment-method/list"));
24
25
  var _list2 = _interopRequireDefault(require("@did-pay/react/lib/plan/list"));
@@ -56,6 +57,7 @@ function PurchasePage(_ref) {
56
57
  const [planLoaded, setPlanLoaded] = (0, _react.useState)(false);
57
58
  const isMobile = (0, _useMediaQuery.default)(theme => theme.breakpoints.down('md'));
58
59
  const [searchParams] = (0, _reactRouterDom.useSearchParams)();
60
+ const [openDialog, setOpenDialog] = (0, _react.useState)(false);
59
61
  const userDid = query.get('userDid') || (0, _lodash.default)(session, 'user.did');
60
62
  const isEmbed = !!query.get('blocklet_meta_url');
61
63
  const handlePaid = async (_ref2, decrypt) => {
@@ -70,7 +72,7 @@ function PurchasePage(_ref) {
70
72
  const nftState = await (0, _util.getAsset)(window.blocklet.CHAIN_HOST, nftId);
71
73
  if ((nftState.tags || []).includes(_constant.NFT_TYPE_SERVERLESS)) {
72
74
  if (!isEmbed) {
73
- _Toast.default.success(t('purchase.purchaseServerlessSuccess'));
75
+ setOpenDialog(true);
74
76
  setPaying(false);
75
77
  return;
76
78
  }
@@ -194,6 +196,31 @@ function PurchasePage(_ref) {
194
196
  })
195
197
  })
196
198
  })
199
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.Confirm, {
200
+ open: openDialog,
201
+ disableEscapeKeyDown: true,
202
+ title: t('purchase.serverlessDialog.title'),
203
+ confirmButton: {
204
+ text: t('purchase.serverlessDialog.redirectToStoreButton'),
205
+ props: {
206
+ variant: 'contained',
207
+ color: 'secondary'
208
+ }
209
+ },
210
+ PaperProps: {
211
+ style: {
212
+ maxWidth: 1200,
213
+ minWidth: isMobile ? undefined : 600
214
+ }
215
+ },
216
+ onCancel: () => setOpenDialog(false),
217
+ showCancelButton: false,
218
+ onConfirm: () => {
219
+ window.location = _util.BLOCKLET_STORE_URL;
220
+ },
221
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
222
+ children: t('purchase.serverlessDialog.purchaseServerlessSuccess')
223
+ })
197
224
  }), paying && /*#__PURE__*/(0, _jsxRuntime.jsx)(_payment.default, {
198
225
  baseURL: (0, _urlJoin.default)(window.location.origin, baseURL),
199
226
  method: paymentMethod,
package/lib/util.js CHANGED
@@ -3,13 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getAsset = exports.getAPIResponseError = void 0;
6
+ exports.getAsset = exports.getAPIResponseError = exports.BLOCKLET_STORE_URL = void 0;
7
7
  exports.getBlockletMetaUrl = getBlockletMetaUrl;
8
8
  exports.loadURL = exports.getLaunchBlockletUrl = void 0;
9
9
  var _urlJoin = _interopRequireDefault(require("url-join"));
10
10
  var _lodash = _interopRequireDefault(require("lodash.get"));
11
11
  var _axios = _interopRequireDefault(require("axios"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ const BLOCKLET_STORE_URL = 'https://store.blocklet.dev';
14
+ exports.BLOCKLET_STORE_URL = BLOCKLET_STORE_URL;
13
15
  function getBlockletMetaUrl(registry, did) {
14
16
  return (0, _urlJoin.default)(registry, "/api/blocklets/".concat(did, "/blocklet.json?source=webapp"));
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "1.9.36",
3
+ "version": "1.9.37",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -40,9 +40,9 @@
40
40
  "@arcblock/icons": "^2.4.65",
41
41
  "@arcblock/license": "^2.4.65",
42
42
  "@arcblock/ux": "^2.4.65",
43
- "@blocklet/launcher-layout": "1.9.36",
44
- "@blocklet/launcher-util": "1.9.36",
45
- "@blocklet/launcher-ux": "1.9.36",
43
+ "@blocklet/launcher-layout": "1.9.37",
44
+ "@blocklet/launcher-util": "1.9.37",
45
+ "@blocklet/launcher-ux": "1.9.37",
46
46
  "@did-pay/react": "^1.9.34",
47
47
  "@emotion/react": "^11.10.5",
48
48
  "@emotion/styled": "^11.10.5",
@@ -69,5 +69,5 @@
69
69
  "@babel/preset-react": "^7.18.6",
70
70
  "babel-plugin-inline-react-svg": "^2.0.1"
71
71
  },
72
- "gitHead": "f57fe62381a27bb83e3ea95a8082d569c5e3c398"
72
+ "gitHead": "ab0e835a3d65e2d6a3ea867734801fe3573d8798"
73
73
  }