@blocklet/launcher-workflow 1.7.25 → 1.7.28
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/{payment-type.js → payment-method.js} +25 -10
- package/lib/components/plan.js +7 -5
- package/lib/components/stripe/checkout.js +4 -7
- package/lib/components/stripe/paying.js +10 -12
- package/lib/index.js +24 -1
- package/lib/locales/en.js +4 -4
- package/lib/locales/zh.js +4 -4
- package/lib/purchase.js +33 -45
- package/package.json +4 -4
|
@@ -11,6 +11,12 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
14
|
+
var _Coins = require("@styled-icons/remix-fill/Coins");
|
|
15
|
+
|
|
16
|
+
var _constant = require("@blocklet/launcher-util/lib/constant");
|
|
17
|
+
|
|
18
|
+
var _CreditCard = _interopRequireDefault(require("@mui/icons-material/CreditCard"));
|
|
19
|
+
|
|
14
20
|
var _locale = require("../contexts/locale");
|
|
15
21
|
|
|
16
22
|
const _excluded = ["type"];
|
|
@@ -30,18 +36,27 @@ function PaymentType(_ref) {
|
|
|
30
36
|
const {
|
|
31
37
|
t
|
|
32
38
|
} = (0, _locale.useLocaleContext)();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
if (type === _constant.CURRENCY_TYPE.crypto) {
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(Container, props, /*#__PURE__*/_react.default.createElement(CryptoIcon, {
|
|
42
|
+
className: "payment-icon"
|
|
43
|
+
}), t('plan.useCrypto'));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(Container, props, /*#__PURE__*/_react.default.createElement(_CreditCard.default, {
|
|
47
|
+
className: "payment-icon"
|
|
48
|
+
}), t('plan.useFiat'));
|
|
38
49
|
}
|
|
39
50
|
|
|
40
51
|
const Container = _styledComponents.default.div.withConfig({
|
|
41
|
-
displayName: "payment-
|
|
42
|
-
componentId: "sc-
|
|
43
|
-
})(["
|
|
44
|
-
|
|
52
|
+
displayName: "payment-method__Container",
|
|
53
|
+
componentId: "sc-tig09z-0"
|
|
54
|
+
})(["display:flex;justify-content:center;align-items:center;.payment-icon{margin-right:4px;}"]);
|
|
55
|
+
|
|
56
|
+
const CryptoIcon = (0, _styledComponents.default)(_Coins.Coins).withConfig({
|
|
57
|
+
displayName: "payment-method__CryptoIcon",
|
|
58
|
+
componentId: "sc-tig09z-1"
|
|
59
|
+
})(["font-size:14px;height:22px;"]);
|
|
45
60
|
PaymentType.propTypes = {
|
|
46
|
-
type: _propTypes.default.oneOf([
|
|
61
|
+
type: _propTypes.default.oneOf([_constant.CURRENCY_TYPE.crypto, _constant.CURRENCY_TYPE.fiat]).isRequired
|
|
47
62
|
};
|
package/lib/components/plan.js
CHANGED
|
@@ -13,13 +13,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
|
|
14
14
|
var _lodash = _interopRequireDefault(require("lodash.get"));
|
|
15
15
|
|
|
16
|
+
var _constant = require("@blocklet/launcher-util/lib/constant");
|
|
17
|
+
|
|
16
18
|
var _material = require("@mui/material");
|
|
17
19
|
|
|
18
20
|
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
19
21
|
|
|
20
22
|
var _locale = require("../contexts/locale");
|
|
21
23
|
|
|
22
|
-
const _excluded = ["data", "selected", "
|
|
24
|
+
const _excluded = ["data", "selected", "paymentMethod"];
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
@@ -31,7 +33,7 @@ function NodeType(_ref) {
|
|
|
31
33
|
let {
|
|
32
34
|
data,
|
|
33
35
|
selected,
|
|
34
|
-
|
|
36
|
+
paymentMethod
|
|
35
37
|
} = _ref,
|
|
36
38
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
39
|
|
|
@@ -46,7 +48,7 @@ function NodeType(_ref) {
|
|
|
46
48
|
}, (0, _lodash.default)(data, "name.".concat(locale))), /*#__PURE__*/_react.default.createElement("div", {
|
|
47
49
|
className: "price",
|
|
48
50
|
component: "span"
|
|
49
|
-
}, data.prices[
|
|
51
|
+
}, data.prices[paymentMethod]), /*#__PURE__*/_react.default.createElement("div", {
|
|
50
52
|
className: "rights"
|
|
51
53
|
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
52
54
|
className: "rights-list"
|
|
@@ -65,12 +67,12 @@ function NodeType(_ref) {
|
|
|
65
67
|
|
|
66
68
|
NodeType.propTypes = {
|
|
67
69
|
data: _propTypes.default.object.isRequired,
|
|
68
|
-
|
|
70
|
+
paymentMethod: _propTypes.default.string,
|
|
69
71
|
selected: _propTypes.default.bool
|
|
70
72
|
};
|
|
71
73
|
NodeType.defaultProps = {
|
|
72
74
|
selected: false,
|
|
73
|
-
|
|
75
|
+
paymentMethod: _constant.CURRENCY_TYPE.crypto
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
const Container = _styledComponents.default.div.withConfig({
|
|
@@ -143,8 +143,7 @@ CheckoutForm.propTypes = {
|
|
|
143
143
|
function Checkout(_ref3) {
|
|
144
144
|
let {
|
|
145
145
|
clientSecret,
|
|
146
|
-
|
|
147
|
-
userDid,
|
|
146
|
+
paymentId,
|
|
148
147
|
onComplete,
|
|
149
148
|
onCancel,
|
|
150
149
|
status
|
|
@@ -154,7 +153,7 @@ function Checkout(_ref3) {
|
|
|
154
153
|
t
|
|
155
154
|
} = (0, _locale.useLocaleContext)();
|
|
156
155
|
const [showCloseButton, setShowCloseButton] = (0, _react.useState)(true);
|
|
157
|
-
const [waitingCompleted, setWaitingCompleted] = (0, _react.useState)(status === _constant.
|
|
156
|
+
const [waitingCompleted, setWaitingCompleted] = (0, _react.useState)(status === _constant.PAYMENT_STATUS.paid);
|
|
158
157
|
const stripePromise = (0, _stripeJs.loadStripe)(window.env.stripePublicKey);
|
|
159
158
|
const options = {
|
|
160
159
|
clientSecret,
|
|
@@ -183,8 +182,7 @@ function Checkout(_ref3) {
|
|
|
183
182
|
onClose: handleClose,
|
|
184
183
|
disableEscapeKeyDown: true
|
|
185
184
|
}, waitingCompleted && /*#__PURE__*/_react.default.createElement(_paying.default, {
|
|
186
|
-
|
|
187
|
-
userDid: userDid,
|
|
185
|
+
paymentId: paymentId,
|
|
188
186
|
onComplete: onComplete,
|
|
189
187
|
onPaid: handlePaid
|
|
190
188
|
}), !waitingCompleted && /*#__PURE__*/_react.default.createElement(_reactStripeJs.Elements, {
|
|
@@ -198,9 +196,8 @@ function Checkout(_ref3) {
|
|
|
198
196
|
|
|
199
197
|
Checkout.propTypes = {
|
|
200
198
|
clientSecret: _propTypes.default.string.isRequired,
|
|
201
|
-
|
|
199
|
+
paymentId: _propTypes.default.string.isRequired,
|
|
202
200
|
status: _propTypes.default.number.isRequired,
|
|
203
|
-
userDid: _propTypes.default.string.isRequired,
|
|
204
201
|
onComplete: _propTypes.default.func.isRequired,
|
|
205
202
|
onCancel: _propTypes.default.func
|
|
206
203
|
};
|
|
@@ -33,8 +33,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
function Paying(_ref) {
|
|
35
35
|
let {
|
|
36
|
-
|
|
37
|
-
userDid,
|
|
36
|
+
paymentId,
|
|
38
37
|
onPaid,
|
|
39
38
|
onComplete
|
|
40
39
|
} = _ref;
|
|
@@ -42,31 +41,31 @@ function Paying(_ref) {
|
|
|
42
41
|
t
|
|
43
42
|
} = (0, _locale.useLocaleContext)();
|
|
44
43
|
const [needFetchOrderStatus, setNeedFetchOrderStatus] = (0, _react.useState)(true);
|
|
45
|
-
const [status, setStatus] = (0, _react.useState)(_constant.
|
|
44
|
+
const [status, setStatus] = (0, _react.useState)(_constant.PAYMENT_STATUS.unpaid);
|
|
46
45
|
const {
|
|
47
46
|
api
|
|
48
47
|
} = (0, _request.default)();
|
|
49
48
|
const fetchOrder = (0, _lodash.default)(async () => {
|
|
50
49
|
const {
|
|
51
|
-
data:
|
|
52
|
-
} = await api.get("/
|
|
50
|
+
data: payment
|
|
51
|
+
} = await api.get("/payments/".concat(paymentId));
|
|
53
52
|
|
|
54
|
-
if (
|
|
53
|
+
if (payment.status === _constant.PAYMENT_STATUS.done) {
|
|
55
54
|
fetchOrder.cancel();
|
|
56
55
|
setNeedFetchOrderStatus(false);
|
|
57
56
|
setTimeout(() => onComplete({
|
|
58
|
-
nftId:
|
|
57
|
+
nftId: payment.nftId
|
|
59
58
|
}), 2000);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
if (
|
|
61
|
+
if (payment.status >= _constant.PAYMENT_STATUS.paid) {
|
|
63
62
|
onPaid();
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
setStatus(
|
|
65
|
+
setStatus(payment.status);
|
|
67
66
|
}, 3000);
|
|
68
67
|
(0, _useInterval.default)(fetchOrder, needFetchOrderStatus ? 3000 : null);
|
|
69
|
-
return /*#__PURE__*/_react.default.createElement(Content, null, status <= _constant.
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(Content, null, status <= _constant.PAYMENT_STATUS.paid && /*#__PURE__*/_react.default.createElement(_Spinner.default, null), status === _constant.PAYMENT_STATUS.done && /*#__PURE__*/_react.default.createElement(_Check.default, {
|
|
70
69
|
className: "status--succeed_icon"
|
|
71
70
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
72
71
|
className: "status"
|
|
@@ -74,8 +73,7 @@ function Paying(_ref) {
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
Paying.propTypes = {
|
|
77
|
-
|
|
78
|
-
userDid: _propTypes.default.string.isRequired,
|
|
76
|
+
paymentId: _propTypes.default.string.isRequired,
|
|
79
77
|
onPaid: _propTypes.default.func.isRequired,
|
|
80
78
|
onComplete: _propTypes.default.func.isRequired
|
|
81
79
|
};
|
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.PaymentType = PaymentType;
|
|
6
7
|
exports.Stripe = Stripe;
|
|
7
8
|
exports.default = Launcher;
|
|
8
9
|
|
|
@@ -20,6 +21,8 @@ var _prepare = _interopRequireDefault(require("./prepare"));
|
|
|
20
21
|
|
|
21
22
|
var _checkout = _interopRequireDefault(require("./components/stripe/checkout"));
|
|
22
23
|
|
|
24
|
+
var _paymentMethod = _interopRequireDefault(require("./components/payment-method"));
|
|
25
|
+
|
|
23
26
|
var _router = _interopRequireWildcard(require("./contexts/router"));
|
|
24
27
|
|
|
25
28
|
var _locales = require("./locales");
|
|
@@ -28,7 +31,8 @@ var _request = require("./contexts/request");
|
|
|
28
31
|
|
|
29
32
|
var _locale = require("./contexts/locale");
|
|
30
33
|
|
|
31
|
-
const _excluded = ["locale", "baseURL"]
|
|
34
|
+
const _excluded = ["locale", "baseURL"],
|
|
35
|
+
_excluded2 = ["locale"];
|
|
32
36
|
|
|
33
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
38
|
|
|
@@ -123,4 +127,23 @@ Launcher.defaultProps = {
|
|
|
123
127
|
routerPrefix: '/',
|
|
124
128
|
locale: 'en',
|
|
125
129
|
baseURL: '/'
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
function PaymentType(_ref4) {
|
|
133
|
+
let {
|
|
134
|
+
locale
|
|
135
|
+
} = _ref4,
|
|
136
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
137
|
+
|
|
138
|
+
return /*#__PURE__*/_react.default.createElement(_locale.LocaleProvider, {
|
|
139
|
+
translations: _locales.translations,
|
|
140
|
+
locale: locale
|
|
141
|
+
}, /*#__PURE__*/_react.default.createElement(_paymentMethod.default, props));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
PaymentType.propTypes = {
|
|
145
|
+
locale: _propTypes.default.string
|
|
146
|
+
};
|
|
147
|
+
PaymentType.defaultProps = {
|
|
148
|
+
locale: 'en'
|
|
126
149
|
};
|
package/lib/locales/en.js
CHANGED
|
@@ -26,10 +26,10 @@ module.exports = {
|
|
|
26
26
|
loadListFailed: 'Plan list load error',
|
|
27
27
|
paymentCredit: {
|
|
28
28
|
status: {
|
|
29
|
-
[_constant.
|
|
30
|
-
[_constant.
|
|
31
|
-
[_constant.
|
|
32
|
-
[_constant.
|
|
29
|
+
[_constant.PAYMENT_STATUS.unpaid]: 'Waiting for payment',
|
|
30
|
+
[_constant.PAYMENT_STATUS.paid]: 'Payment completed, waiting for order completion',
|
|
31
|
+
[_constant.PAYMENT_STATUS.done]: 'Completed!',
|
|
32
|
+
[_constant.PAYMENT_STATUS.expired]: 'Order has expired'
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
useCrypto: 'Crypto',
|
package/lib/locales/zh.js
CHANGED
|
@@ -26,10 +26,10 @@ module.exports = {
|
|
|
26
26
|
loadListFailed: '加载节点类型列表出错',
|
|
27
27
|
paymentCredit: {
|
|
28
28
|
status: {
|
|
29
|
-
[_constant.
|
|
30
|
-
[_constant.
|
|
31
|
-
[_constant.
|
|
32
|
-
[_constant.
|
|
29
|
+
[_constant.PAYMENT_STATUS.unpaid]: '支付中',
|
|
30
|
+
[_constant.PAYMENT_STATUS.paid]: '支付完成, 等待订单完成',
|
|
31
|
+
[_constant.PAYMENT_STATUS.done]: '已完成!',
|
|
32
|
+
[_constant.PAYMENT_STATUS.expired]: '订单已过期'
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
useCrypto: '数字货币支付',
|
package/lib/purchase.js
CHANGED
|
@@ -17,8 +17,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
17
17
|
|
|
18
18
|
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
19
19
|
|
|
20
|
-
var _Coins = require("@styled-icons/remix-fill/Coins");
|
|
21
|
-
|
|
22
20
|
var _util = require("@ocap/util");
|
|
23
21
|
|
|
24
22
|
var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
|
|
@@ -31,22 +29,20 @@ var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect
|
|
|
31
29
|
|
|
32
30
|
var _utils = require("@arcblock/did-connect/lib/utils");
|
|
33
31
|
|
|
34
|
-
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
35
|
-
|
|
36
|
-
var _compactLayout = _interopRequireDefault(require("@blocklet/launcher-layout/lib/compact-layout"));
|
|
37
|
-
|
|
38
32
|
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
39
33
|
|
|
40
34
|
var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
|
|
41
35
|
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
|
|
36
|
+
var _Alert = _interopRequireDefault(require("@arcblock/ux/lib/Alert"));
|
|
45
37
|
|
|
46
|
-
var
|
|
38
|
+
var _compactLayout = _interopRequireDefault(require("@blocklet/launcher-layout/lib/compact-layout"));
|
|
47
39
|
|
|
48
40
|
var _pageHeader = _interopRequireDefault(require("@blocklet/launcher-layout/lib/page-header"));
|
|
49
41
|
|
|
42
|
+
var _constant = require("@blocklet/launcher-util/lib/constant");
|
|
43
|
+
|
|
44
|
+
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
45
|
+
|
|
50
46
|
var _plan = _interopRequireDefault(require("./components/plan"));
|
|
51
47
|
|
|
52
48
|
var _checkout = _interopRequireDefault(require("./components/stripe/checkout"));
|
|
@@ -61,6 +57,8 @@ var _request = _interopRequireDefault(require("./contexts/request"));
|
|
|
61
57
|
|
|
62
58
|
var _router = _interopRequireWildcard(require("./contexts/router"));
|
|
63
59
|
|
|
60
|
+
var _paymentMethod = _interopRequireDefault(require("./components/payment-method"));
|
|
61
|
+
|
|
64
62
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
65
63
|
|
|
66
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); }
|
|
@@ -95,27 +93,27 @@ function PurchasePage() {
|
|
|
95
93
|
const [paying, setPaying] = (0, _react.useState)(false);
|
|
96
94
|
const [paymentInfo, setPaymentInfo] = (0, _react.useState)(null);
|
|
97
95
|
const [buttonInFix, setButtonInFix] = (0, _react.useState)(false);
|
|
98
|
-
const [
|
|
96
|
+
const [paymentMethod, setPaymentType] = (0, _react.useState)(_constant.CURRENCY_TYPE.crypto);
|
|
99
97
|
const routerPrefix = (0, _router.usePrefix)();
|
|
100
98
|
const isMobile = (0, _useMediaQuery.default)(theme => theme.breakpoints.down('md'));
|
|
101
99
|
const userDid = query.get('userDid') || (0, _lodash.default)(session, 'user.did');
|
|
102
100
|
const isEmbed = !!query.get('blocklet_meta_url');
|
|
103
101
|
(0, _react.useEffect)(() => {
|
|
104
|
-
if (!session.loading &&
|
|
102
|
+
if (!session.loading && paymentMethod === _constant.CURRENCY_TYPE.fiat && !userDid) {
|
|
105
103
|
session.login();
|
|
106
104
|
} // eslint-disable-next-line
|
|
107
105
|
|
|
108
|
-
}, [
|
|
106
|
+
}, [paymentMethod, userDid]);
|
|
109
107
|
const paymentTypes = [{
|
|
110
|
-
label: /*#__PURE__*/_react.default.createElement(
|
|
111
|
-
|
|
112
|
-
}),
|
|
113
|
-
value:
|
|
108
|
+
label: /*#__PURE__*/_react.default.createElement(_paymentMethod.default, {
|
|
109
|
+
type: _constant.CURRENCY_TYPE.crypto
|
|
110
|
+
}),
|
|
111
|
+
value: _constant.CURRENCY_TYPE.crypto
|
|
114
112
|
}, {
|
|
115
|
-
label: /*#__PURE__*/_react.default.createElement(
|
|
116
|
-
|
|
117
|
-
}),
|
|
118
|
-
value:
|
|
113
|
+
label: /*#__PURE__*/_react.default.createElement(_paymentMethod.default, {
|
|
114
|
+
type: _constant.CURRENCY_TYPE.fiat
|
|
115
|
+
}),
|
|
116
|
+
value: _constant.CURRENCY_TYPE.fiat
|
|
119
117
|
}];
|
|
120
118
|
const plansState = (0, _reactUse.useAsync)(async () => {
|
|
121
119
|
const {
|
|
@@ -134,7 +132,7 @@ function PurchasePage() {
|
|
|
134
132
|
});
|
|
135
133
|
(0, _react.useEffect)(() => {
|
|
136
134
|
if (plansState.loading === false) {
|
|
137
|
-
setPaymentType(
|
|
135
|
+
setPaymentType(_constant.CURRENCY_TYPE.crypto);
|
|
138
136
|
|
|
139
137
|
if (plansState.value) {
|
|
140
138
|
const {
|
|
@@ -157,7 +155,7 @@ function PurchasePage() {
|
|
|
157
155
|
if (plansState.error) {
|
|
158
156
|
console.error('load plans error', plansState.error);
|
|
159
157
|
return /*#__PURE__*/_react.default.createElement(_Alert.default, {
|
|
160
|
-
|
|
158
|
+
type: "error"
|
|
161
159
|
}, t('plan.loadListFailed'));
|
|
162
160
|
}
|
|
163
161
|
|
|
@@ -189,7 +187,7 @@ function PurchasePage() {
|
|
|
189
187
|
|
|
190
188
|
const getPurchaseParams = () => {
|
|
191
189
|
const obj = {
|
|
192
|
-
|
|
190
|
+
productId: plan ? plan._id : null,
|
|
193
191
|
userDid
|
|
194
192
|
};
|
|
195
193
|
const params = {};
|
|
@@ -207,24 +205,24 @@ function PurchasePage() {
|
|
|
207
205
|
};
|
|
208
206
|
|
|
209
207
|
const handlePay = async payment => {
|
|
210
|
-
if (payment ===
|
|
208
|
+
if (payment === _constant.CURRENCY_TYPE.fiat && !userDid) {
|
|
211
209
|
session.login();
|
|
212
210
|
return;
|
|
213
211
|
}
|
|
214
212
|
|
|
215
213
|
const params = getPurchaseParams();
|
|
216
214
|
|
|
217
|
-
if (!params.
|
|
215
|
+
if (!params.productId) {
|
|
218
216
|
return;
|
|
219
217
|
}
|
|
220
218
|
|
|
221
219
|
setPaying(true);
|
|
222
220
|
|
|
223
|
-
if (payment ===
|
|
221
|
+
if (payment === _constant.CURRENCY_TYPE.crypto) {
|
|
224
222
|
return;
|
|
225
223
|
}
|
|
226
224
|
|
|
227
|
-
if (payment ===
|
|
225
|
+
if (payment === _constant.CURRENCY_TYPE.fiat) {
|
|
228
226
|
try {
|
|
229
227
|
const {
|
|
230
228
|
data
|
|
@@ -232,7 +230,7 @@ function PurchasePage() {
|
|
|
232
230
|
userDid
|
|
233
231
|
}));
|
|
234
232
|
setPaymentInfo({
|
|
235
|
-
|
|
233
|
+
paymentId: data.paymentId,
|
|
236
234
|
clientSecret: data.clientSecret,
|
|
237
235
|
status: data.status
|
|
238
236
|
});
|
|
@@ -250,7 +248,7 @@ function PurchasePage() {
|
|
|
250
248
|
};
|
|
251
249
|
|
|
252
250
|
const PayButton = () => /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
253
|
-
onClick: () => handlePay(
|
|
251
|
+
onClick: () => handlePay(paymentMethod),
|
|
254
252
|
disabled: paying,
|
|
255
253
|
variant: "contained",
|
|
256
254
|
color: "primary"
|
|
@@ -269,7 +267,7 @@ function PurchasePage() {
|
|
|
269
267
|
|
|
270
268
|
return (
|
|
271
269
|
/*#__PURE__*/
|
|
272
|
-
// layout-fix-container for compatibility with lower versions of safari, do not remove this
|
|
270
|
+
// layout-fix-container for compatibility with lower versions of safari, do not remove this className
|
|
273
271
|
_react.default.createElement(Container, {
|
|
274
272
|
className: "layout-fix-container"
|
|
275
273
|
}, isEmbed && !isMobile && /*#__PURE__*/_react.default.createElement(_pageHeader.default, {
|
|
@@ -291,7 +289,7 @@ function PurchasePage() {
|
|
|
291
289
|
className: "select-payment"
|
|
292
290
|
}, /*#__PURE__*/_react.default.createElement(_Tabs.default, {
|
|
293
291
|
tabs: paymentTypes,
|
|
294
|
-
current:
|
|
292
|
+
current: paymentMethod,
|
|
295
293
|
onChange: e => setPaymentType(e)
|
|
296
294
|
})) : '', /*#__PURE__*/_react.default.createElement("div", {
|
|
297
295
|
className: "select-plan small-select-plan-".concat(plans.length)
|
|
@@ -299,12 +297,12 @@ function PurchasePage() {
|
|
|
299
297
|
className: "selector-container container-padding"
|
|
300
298
|
}, plans.length ? plans.map(item => /*#__PURE__*/_react.default.createElement(_plan.default, {
|
|
301
299
|
key: item._id,
|
|
302
|
-
|
|
300
|
+
paymentMethod: paymentMethod,
|
|
303
301
|
onClick: () => selectPlan(item),
|
|
304
302
|
selected: plan && plan._id === item._id,
|
|
305
303
|
data: item
|
|
306
304
|
})) : /*#__PURE__*/_react.default.createElement(_Empty.default, null, t('plan.noPlan'))))))), /*#__PURE__*/_react.default.createElement(_Connect.default, {
|
|
307
|
-
open: paying &&
|
|
305
|
+
open: paying && paymentMethod === _constant.CURRENCY_TYPE.crypto,
|
|
308
306
|
popup: true,
|
|
309
307
|
action: "purchase",
|
|
310
308
|
checkFn: createRequest().get,
|
|
@@ -323,7 +321,7 @@ function PurchasePage() {
|
|
|
323
321
|
}
|
|
324
322
|
}), paymentInfo && /*#__PURE__*/_react.default.createElement(_checkout.default, {
|
|
325
323
|
clientSecret: paymentInfo.clientSecret,
|
|
326
|
-
|
|
324
|
+
paymentId: paymentInfo.paymentId,
|
|
327
325
|
userDid: userDid,
|
|
328
326
|
onComplete: handlePaid,
|
|
329
327
|
onCancel: handleCancelPay,
|
|
@@ -337,16 +335,6 @@ const Container = _styledComponents.default.div.withConfig({
|
|
|
337
335
|
componentId: "sc-1knmtel-0"
|
|
338
336
|
})(["display:flex;flex-direction:column;width:100%;height:100%;.select-payment{display:flex;justify-content:center;align-items:center;padding-top:30px;}.select-plan{margin:48px auto 33px;", "{margin:30px auto;}&.small-select-plan-2{max-width:780px;}&.small-select-plan-0,&.small-select-plan-1{max-width:460px;}}.page-body{position:relative;flex:1;margin-top:0;}.page-body-article{position:absolute;left:0;top:0;width:100%;height:100%;overflow-y:auto;}.selector-container{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:24px;margin-top:18px;}.button-container{display:flex;justify-content:center;align-items:center;padding-bottom:15px;padding-top:15px;> button{width:200px;}&.has-shadow{box-shadow:0px -1px 1px 0px rgba(168,180,197,0.12);}}.container-padding{padding-left:24px;padding-right:24px;}"], props => props.theme.breakpoints.down('md'));
|
|
339
337
|
|
|
340
|
-
const PaymentLabel = _styledComponents.default.div.withConfig({
|
|
341
|
-
displayName: "purchase__PaymentLabel",
|
|
342
|
-
componentId: "sc-1knmtel-1"
|
|
343
|
-
})(["display:flex;justify-content:center;align-items:center;.payment-icon{margin-right:4px;}"]);
|
|
344
|
-
|
|
345
|
-
const CryptoIcon = (0, _styledComponents.default)(_Coins.Coins).withConfig({
|
|
346
|
-
displayName: "purchase__CryptoIcon",
|
|
347
|
-
componentId: "sc-1knmtel-2"
|
|
348
|
-
})(["font-size:14px;height:22px;"]);
|
|
349
|
-
|
|
350
338
|
var _default = (0, _reactRouterDom.withRouter)(PurchasePage);
|
|
351
339
|
|
|
352
340
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/launcher-workflow",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.28",
|
|
4
4
|
"description": "Purchase components for Launcher UI",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@arcblock/icons": "^2.1.36",
|
|
42
42
|
"@arcblock/license": "^2.1.36",
|
|
43
43
|
"@arcblock/ux": "^2.1.36",
|
|
44
|
-
"@blocklet/launcher-layout": "1.7.
|
|
45
|
-
"@blocklet/launcher-util": "1.7.
|
|
44
|
+
"@blocklet/launcher-layout": "1.7.28",
|
|
45
|
+
"@blocklet/launcher-util": "1.7.28",
|
|
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": "fdea3d3fd6e2290bd8dac9a5e5b42e7fee564f16"
|
|
77
77
|
}
|