@blocklet/launcher-workflow 1.7.44 → 1.7.47
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/components/confirm.js +27 -19
- package/lib/components/instance-operation.js +79 -61
- package/lib/components/payment-method.js +21 -11
- package/lib/components/plan.js +39 -25
- package/lib/components/stripe/checkout.js +43 -35
- package/lib/components/stripe/paying.js +11 -10
- package/lib/contexts/request.js +7 -8
- package/lib/contexts/router.js +7 -8
- package/lib/index.js +49 -40
- package/lib/launch.js +3 -3
- package/lib/locales/en.js +7 -5
- package/lib/locales/zh.js +7 -5
- package/lib/prepare.js +92 -76
- package/lib/purchase.js +100 -89
- package/lib/start.js +11 -8
- package/package.json +8 -8
package/lib/purchase.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _reactRouterDom = require("react-router-dom");
|
|
11
11
|
|
|
@@ -59,12 +59,14 @@ var _router = _interopRequireWildcard(require("./contexts/router"));
|
|
|
59
59
|
|
|
60
60
|
var _paymentMethod = _interopRequireDefault(require("./components/payment-method"));
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
63
63
|
|
|
64
64
|
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); }
|
|
65
65
|
|
|
66
66
|
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; }
|
|
67
67
|
|
|
68
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
69
|
+
|
|
68
70
|
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; }
|
|
69
71
|
|
|
70
72
|
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; }
|
|
@@ -106,12 +108,12 @@ function PurchasePage() {
|
|
|
106
108
|
|
|
107
109
|
}, [paymentMethod, userDid]);
|
|
108
110
|
const paymentTypes = [{
|
|
109
|
-
label: /*#__PURE__*/
|
|
111
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paymentMethod.default, {
|
|
110
112
|
type: _constant.CURRENCY_TYPE.crypto
|
|
111
113
|
}),
|
|
112
114
|
value: _constant.CURRENCY_TYPE.crypto
|
|
113
115
|
}, {
|
|
114
|
-
label: /*#__PURE__*/
|
|
116
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paymentMethod.default, {
|
|
115
117
|
type: _constant.CURRENCY_TYPE.fiat
|
|
116
118
|
}),
|
|
117
119
|
value: _constant.CURRENCY_TYPE.fiat
|
|
@@ -148,16 +150,18 @@ function PurchasePage() {
|
|
|
148
150
|
}, [plansState.loading, plansState.value]);
|
|
149
151
|
|
|
150
152
|
if (plansState.loading) {
|
|
151
|
-
return /*#__PURE__*/
|
|
152
|
-
relative: "parent"
|
|
153
|
-
|
|
153
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Center.default, {
|
|
154
|
+
relative: "parent",
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {})
|
|
156
|
+
});
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
if (plansState.error) {
|
|
157
160
|
console.error('load plans error', plansState.error);
|
|
158
|
-
return /*#__PURE__*/
|
|
159
|
-
type: "error"
|
|
160
|
-
|
|
161
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
162
|
+
type: "error",
|
|
163
|
+
children: t('plan.loadListFailed')
|
|
164
|
+
});
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
const {
|
|
@@ -248,24 +252,6 @@ function PurchasePage() {
|
|
|
248
252
|
});
|
|
249
253
|
};
|
|
250
254
|
|
|
251
|
-
const PayButton = () => /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
252
|
-
onClick: () => handlePay(paymentMethod),
|
|
253
|
-
disabled: paying,
|
|
254
|
-
variant: "contained",
|
|
255
|
-
color: "primary"
|
|
256
|
-
}, paying && /*#__PURE__*/_react.default.createElement(_Spinner.default, {
|
|
257
|
-
size: 14
|
|
258
|
-
}), paying ? t('common.paying') : t('common.purchase'));
|
|
259
|
-
|
|
260
|
-
const RedeemButton = () => /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
261
|
-
onClick: () => handleRedeem(),
|
|
262
|
-
variant: "outlined",
|
|
263
|
-
color: "primary",
|
|
264
|
-
style: {
|
|
265
|
-
marginRight: '24px'
|
|
266
|
-
}
|
|
267
|
-
}, t('common.redeem'));
|
|
268
|
-
|
|
269
255
|
const clickBack = () => {
|
|
270
256
|
if (history.length > 2) {
|
|
271
257
|
history.goBack();
|
|
@@ -277,67 +263,92 @@ function PurchasePage() {
|
|
|
277
263
|
return (
|
|
278
264
|
/*#__PURE__*/
|
|
279
265
|
// layout-fix-container for compatibility with lower versions of safari, do not remove this className
|
|
280
|
-
|
|
281
|
-
className: "layout-fix-container"
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
266
|
+
(0, _jsxRuntime.jsxs)(Container, {
|
|
267
|
+
className: "layout-fix-container",
|
|
268
|
+
children: [isEmbed && !isMobile && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pageHeader.default, {
|
|
269
|
+
title: t('plan.title'),
|
|
270
|
+
subTitle: t('plan.subTitle'),
|
|
271
|
+
onClickBack: disabledBack.includes('purchase') ? '' : clickBack
|
|
272
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
273
|
+
className: "page-body body",
|
|
274
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
275
|
+
className: "page-body-article",
|
|
276
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_compactLayout.default, {
|
|
277
|
+
onBottomFix: type => setButtonInFix(type === 'fix'),
|
|
278
|
+
bottom: plans.length ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
279
|
+
className: "button-container container-padding ".concat(buttonInFix ? 'has-shadow' : ''),
|
|
280
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
281
|
+
onClick: () => handleRedeem(),
|
|
282
|
+
variant: "outlined",
|
|
283
|
+
color: "primary",
|
|
284
|
+
style: {
|
|
285
|
+
marginRight: '24px'
|
|
286
|
+
},
|
|
287
|
+
children: t('common.redeem')
|
|
288
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
289
|
+
onClick: () => handlePay(paymentMethod),
|
|
290
|
+
disabled: paying,
|
|
291
|
+
variant: "contained",
|
|
292
|
+
color: "primary",
|
|
293
|
+
children: [paying && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
294
|
+
size: 14
|
|
295
|
+
}), paying ? t('common.paying') : t('common.purchase')]
|
|
296
|
+
})]
|
|
297
|
+
}) : '',
|
|
298
|
+
children: [(!isEmbed || isMobile) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pageHeader.default, {
|
|
299
|
+
title: t('plan.title'),
|
|
300
|
+
subTitle: t('plan.subTitle'),
|
|
301
|
+
onClickBack: disabledBack.includes('purchase') ? '' : clickBack
|
|
302
|
+
}), plans.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
303
|
+
className: "select-payment",
|
|
304
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tabs.default, {
|
|
305
|
+
tabs: paymentTypes,
|
|
306
|
+
current: paymentMethod,
|
|
307
|
+
onChange: e => setPaymentType(e)
|
|
308
|
+
})
|
|
309
|
+
}) : '', /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
310
|
+
className: "select-plan small-select-plan-".concat(plans.length),
|
|
311
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
312
|
+
className: "selector-container container-padding",
|
|
313
|
+
children: plans.length ? plans.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_plan.default, {
|
|
314
|
+
paymentMethod: paymentMethod,
|
|
315
|
+
onClick: () => selectPlan(item),
|
|
316
|
+
selected: plan && plan._id === item._id,
|
|
317
|
+
data: item
|
|
318
|
+
}, item._id)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
319
|
+
children: t('plan.noPlan')
|
|
320
|
+
})
|
|
321
|
+
})
|
|
322
|
+
})]
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
326
|
+
open: paying && paymentMethod === _constant.CURRENCY_TYPE.crypto,
|
|
327
|
+
popup: true,
|
|
328
|
+
action: "purchase",
|
|
329
|
+
checkFn: createRequest().get,
|
|
330
|
+
onSuccess: handlePaid,
|
|
331
|
+
onClose: handleCloseAuthDialog,
|
|
332
|
+
checkTimeout: 60 * 5000,
|
|
333
|
+
extraParams: getPurchaseParams(),
|
|
334
|
+
webWalletUrl: (0, _utils.getWebWalletUrl)(),
|
|
335
|
+
showDownload: false,
|
|
336
|
+
locale: locale,
|
|
337
|
+
messages: {
|
|
338
|
+
title: t('purchase.dialog.title'),
|
|
339
|
+
scan: t('purchase.dialog.scan'),
|
|
340
|
+
confirm: t('purchase.dialog.confirm'),
|
|
341
|
+
success: t('purchase.dialog.success')
|
|
342
|
+
}
|
|
343
|
+
}), paymentInfo && /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkout.default, {
|
|
344
|
+
clientSecret: paymentInfo.clientSecret,
|
|
345
|
+
paymentId: paymentInfo.paymentId,
|
|
346
|
+
userDid: userDid,
|
|
347
|
+
onComplete: handlePaid,
|
|
348
|
+
onCancel: handleCancelPay,
|
|
349
|
+
status: paymentInfo.status
|
|
350
|
+
})]
|
|
351
|
+
})
|
|
341
352
|
);
|
|
342
353
|
}
|
|
343
354
|
|
package/lib/start.js
CHANGED
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = StartPage;
|
|
7
7
|
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
9
|
|
|
12
10
|
var _locale = require("./contexts/locale");
|
|
@@ -17,18 +15,23 @@ var _locales = require("./locales");
|
|
|
17
15
|
|
|
18
16
|
var _request = require("./contexts/request");
|
|
19
17
|
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
22
|
function StartPage(_ref) {
|
|
23
23
|
let {
|
|
24
24
|
locale
|
|
25
25
|
} = _ref;
|
|
26
|
-
return /*#__PURE__*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_request.RequestProvider, {
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_locale.LocaleProvider, {
|
|
28
|
+
translations: _locales.translations,
|
|
29
|
+
locale: locale,
|
|
30
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_instanceOperation.default, {
|
|
31
|
+
type: "start"
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
});
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
StartPage.propTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/launcher-workflow",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.47",
|
|
4
4
|
"description": "Purchase components for Launcher UI",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"react": ">=18.1.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@arcblock/did-connect": "^2.1.
|
|
41
|
-
"@arcblock/icons": "^2.1.
|
|
42
|
-
"@arcblock/license": "^2.1.
|
|
43
|
-
"@arcblock/ux": "^2.1.
|
|
44
|
-
"@blocklet/launcher-layout": "1.7.
|
|
45
|
-
"@blocklet/launcher-util": "1.7.
|
|
40
|
+
"@arcblock/did-connect": "^2.1.47",
|
|
41
|
+
"@arcblock/icons": "^2.1.47",
|
|
42
|
+
"@arcblock/license": "^2.1.47",
|
|
43
|
+
"@arcblock/ux": "^2.1.47",
|
|
44
|
+
"@blocklet/launcher-layout": "1.7.47",
|
|
45
|
+
"@blocklet/launcher-util": "1.7.47",
|
|
46
46
|
"@emotion/react": "^11.9.0",
|
|
47
47
|
"@emotion/styled": "^11.8.1",
|
|
48
48
|
"@mui/icons-material": "^5.6.2",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"babel-plugin-inline-react-svg": "^2.0.1",
|
|
74
74
|
"babel-plugin-styled-components": "^1.10.7"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "c1a0eaf6bd4d1c2f82fd1c99b0c454b78c9904af"
|
|
77
77
|
}
|