@blocklet/launcher-workflow 2.2.53 → 2.2.55
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/es/checkout.js +3 -5
- package/es/components/checkbox.js +1 -2
- package/es/components/confirm.js +1 -2
- package/es/components/in-progress-session.js +1 -2
- package/es/components/launch-dedicated.js +38 -40
- package/es/components/launch-serverless.js +7 -7
- package/es/components/plan.js +1 -3
- package/es/launch.js +3 -3
- package/es/locales/en.js +17 -2
- package/es/locales/index.js +4 -2
- package/es/locales/zh.js +18 -3
- package/es/paid.js +51 -0
- package/es/prepare.js +290 -0
- package/es/purchase.js +1 -3
- package/lib/checkout.js +3 -3
- package/lib/components/checkbox.js +1 -1
- package/lib/components/launch-dedicated.js +36 -38
- package/lib/components/launch-serverless.js +6 -5
- package/lib/components/layout/body.js +1 -1
- package/lib/components/layout/footer.js +1 -1
- package/lib/components/layout/index.js +1 -1
- package/lib/components/plan.js +1 -1
- package/lib/contexts/request.js +1 -1
- package/lib/launch.js +3 -3
- package/lib/locales/en.js +17 -2
- package/lib/locales/index.js +4 -2
- package/lib/locales/zh.js +18 -3
- package/lib/paid.js +61 -0
- package/lib/prepare.js +299 -0
- package/lib/purchase.js +2 -2
- package/package.json +25 -20
package/lib/locales/en.js
CHANGED
|
@@ -31,7 +31,11 @@ var _default = exports.default = {
|
|
|
31
31
|
pay: 'Pay',
|
|
32
32
|
payWith: 'Pay with {currency}',
|
|
33
33
|
popular: 'Popular',
|
|
34
|
-
|
|
34
|
+
serviceError: 'Service Failed',
|
|
35
|
+
space: 'Space',
|
|
36
|
+
subscription: 'Subscription',
|
|
37
|
+
price: 'Pricing',
|
|
38
|
+
unitPrice: 'Unit'
|
|
35
39
|
},
|
|
36
40
|
license: {
|
|
37
41
|
title: 'End User License Agreement',
|
|
@@ -111,6 +115,8 @@ var _default = exports.default = {
|
|
|
111
115
|
redeem: 'Select purchased space',
|
|
112
116
|
noProducts: 'No products available for purchase, please check your payment-kit config',
|
|
113
117
|
serverlessNotSupported: 'This app is not allowed in sigular and on-demand space, please select dedicated space',
|
|
118
|
+
componentCount: '{count} Component Included',
|
|
119
|
+
componentsCount: '{count} Components Included',
|
|
114
120
|
dialog: {
|
|
115
121
|
title: 'Purchase Blocklet Space NFT',
|
|
116
122
|
scan: 'Scan the QR code below with your DID wallet to complete purchase',
|
|
@@ -127,6 +133,13 @@ var _default = exports.default = {
|
|
|
127
133
|
continue: 'Continue',
|
|
128
134
|
content: 'You have an incomplete order {blockletName}, Continue this order?',
|
|
129
135
|
notRemind: 'No more reminders'
|
|
136
|
+
},
|
|
137
|
+
productType: {
|
|
138
|
+
'on-demand': 'On Demand Space',
|
|
139
|
+
dedicated: 'Dedicated Space'
|
|
140
|
+
},
|
|
141
|
+
paid: {
|
|
142
|
+
redirecting: 'Payment success, redirecting...'
|
|
130
143
|
}
|
|
131
144
|
},
|
|
132
145
|
checkout: {
|
|
@@ -136,6 +149,8 @@ var _default = exports.default = {
|
|
|
136
149
|
paymentMethod: {
|
|
137
150
|
title: 'Select payment currency'
|
|
138
151
|
},
|
|
139
|
-
agreement: '{name} User Agreement'
|
|
152
|
+
agreement: '{name} User Agreement',
|
|
153
|
+
estimatedCost: 'Estimated Cost',
|
|
154
|
+
estimatedCostHint: 'The total cost will vary depending on the actual number and duration of components used in the application. The calculation method is: Unit price of component * Number of components * Duration.'
|
|
140
155
|
}
|
|
141
156
|
};
|
package/lib/locales/index.js
CHANGED
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.translations = void 0;
|
|
7
|
+
var _paymentReact = require("@blocklet/payment-react");
|
|
7
8
|
var _flat = _interopRequireDefault(require("flat"));
|
|
9
|
+
var _lodash = _interopRequireDefault(require("lodash.merge"));
|
|
8
10
|
var _en = _interopRequireDefault(require("./en"));
|
|
9
11
|
var _zh = _interopRequireDefault(require("./zh"));
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
/* eslint-disable import/prefer-default-export */
|
|
12
14
|
|
|
13
|
-
const translations = exports.translations = {
|
|
15
|
+
const translations = exports.translations = (0, _lodash.default)({
|
|
14
16
|
en: (0, _flat.default)(_en.default),
|
|
15
17
|
zh: (0, _flat.default)(_zh.default)
|
|
16
|
-
};
|
|
18
|
+
}, _paymentReact.translations);
|
package/lib/locales/zh.js
CHANGED
|
@@ -30,8 +30,12 @@ var _default = exports.default = {
|
|
|
30
30
|
pay: '支付',
|
|
31
31
|
previous: '上一步',
|
|
32
32
|
popular: '推荐',
|
|
33
|
+
price: '价格',
|
|
34
|
+
serviceError: '服务出错',
|
|
33
35
|
space: '空间',
|
|
34
|
-
|
|
36
|
+
subscription: '订阅',
|
|
37
|
+
payWith: '用{currency}支付',
|
|
38
|
+
unitPrice: '单价'
|
|
35
39
|
},
|
|
36
40
|
license: {
|
|
37
41
|
title: '空间用户协议',
|
|
@@ -69,7 +73,7 @@ var _default = exports.default = {
|
|
|
69
73
|
success: '正在启动'
|
|
70
74
|
},
|
|
71
75
|
error: {
|
|
72
|
-
launchFailed: '
|
|
76
|
+
launchFailed: '启动空间失败',
|
|
73
77
|
launchFailedDescription: '您可以点击下面按钮重试',
|
|
74
78
|
notFound: '没有正在启动的空间',
|
|
75
79
|
notFoundDescription: '您可以点击下面按钮启动空间'
|
|
@@ -110,6 +114,8 @@ var _default = exports.default = {
|
|
|
110
114
|
hasPlan: '选用{name}',
|
|
111
115
|
noProducts: '没有可购买的商品,请检查 PaymentKit 的配置',
|
|
112
116
|
serverlessNotSupported: '该应用被禁止能在单应用或者按需空间中运行,请选择专用空间',
|
|
117
|
+
componentCount: '共 {count} 个组件',
|
|
118
|
+
componentsCount: '共 {count} 个组件',
|
|
113
119
|
dialog: {
|
|
114
120
|
title: '购买 Blocklet Server NFT',
|
|
115
121
|
scan: '用您的 DID 钱包扫描下面的二维码完成购买',
|
|
@@ -126,6 +132,13 @@ var _default = exports.default = {
|
|
|
126
132
|
continue: '继续',
|
|
127
133
|
content: '您有一个未完成的订单: {blockletName},继续该订单?',
|
|
128
134
|
notRemind: '不再提醒'
|
|
135
|
+
},
|
|
136
|
+
productType: {
|
|
137
|
+
'on-demand': '按需空间',
|
|
138
|
+
dedicated: '专用空间'
|
|
139
|
+
},
|
|
140
|
+
paid: {
|
|
141
|
+
redirecting: '支付成功,正在跳转...'
|
|
129
142
|
}
|
|
130
143
|
},
|
|
131
144
|
checkout: {
|
|
@@ -135,6 +148,8 @@ var _default = exports.default = {
|
|
|
135
148
|
paymentMethod: {
|
|
136
149
|
title: '选择支付货币'
|
|
137
150
|
},
|
|
138
|
-
agreement: '{name} 用户协议'
|
|
151
|
+
agreement: '{name} 用户协议',
|
|
152
|
+
estimatedCost: '估算成本',
|
|
153
|
+
estimatedCostHint: '总成本会根据应用实际使用的组件数量和时长而变化,计算方式为: 组件单价*组件数量*时长'
|
|
139
154
|
}
|
|
140
155
|
};
|
package/lib/paid.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = PurchaseSuccess;
|
|
7
|
+
var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
|
|
8
|
+
var _constant = require("@blocklet/launcher-util/lib/constant");
|
|
9
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
10
|
+
var _ahooks = require("ahooks");
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _reactRouterDom = require("react-router-dom");
|
|
13
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
14
|
+
var _locale = require("./contexts/locale");
|
|
15
|
+
var _request = _interopRequireDefault(require("./contexts/request"));
|
|
16
|
+
var _workflow = require("./contexts/workflow");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function PurchaseSuccess() {
|
|
20
|
+
const [params, setParams] = (0, _reactRouterDom.useSearchParams)();
|
|
21
|
+
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
22
|
+
const {
|
|
23
|
+
routerPrefix
|
|
24
|
+
} = (0, _workflow.useWorkflowContext)();
|
|
25
|
+
const {
|
|
26
|
+
t
|
|
27
|
+
} = (0, _locale.useLocaleContext)();
|
|
28
|
+
const {
|
|
29
|
+
api
|
|
30
|
+
} = (0, _request.default)();
|
|
31
|
+
const sessionId = params.get('sessionId');
|
|
32
|
+
const {
|
|
33
|
+
loading,
|
|
34
|
+
data,
|
|
35
|
+
cancel
|
|
36
|
+
} = (0, _ahooks.useRequest)(() => api.get("/launches/".concat(sessionId)).then(res => {
|
|
37
|
+
var _res$data;
|
|
38
|
+
return (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.launch;
|
|
39
|
+
}), {
|
|
40
|
+
pollingInterval: 2000
|
|
41
|
+
});
|
|
42
|
+
(0, _react.useEffect)(() => {
|
|
43
|
+
if ((data === null || data === void 0 ? void 0 : data.status) >= _constant.LAUNCH_STATUS.nftMinted) {
|
|
44
|
+
cancel();
|
|
45
|
+
}
|
|
46
|
+
}, [data, cancel]);
|
|
47
|
+
(0, _react.useEffect)(() => {
|
|
48
|
+
if ((data === null || data === void 0 ? void 0 : data.status) >= _constant.LAUNCH_STATUS.nftMinted) {
|
|
49
|
+
params.set('launchType', data.type);
|
|
50
|
+
navigate({
|
|
51
|
+
pathname: (0, _urlJoin.default)(routerPrefix, "/launch/".concat(data._id)),
|
|
52
|
+
search: params.toString()
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, [data, params, navigate, sessionId, routerPrefix, setParams]);
|
|
56
|
+
const completed = !loading && (data === null || data === void 0 ? void 0 : data.status) >= _constant.LAUNCH_STATUS.nftMinted;
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Center.default, {
|
|
58
|
+
relative: "parent",
|
|
59
|
+
children: [!completed && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {}), completed && t('purchase.paid.redirecting')]
|
|
60
|
+
});
|
|
61
|
+
}
|
package/lib/prepare.js
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
|
|
8
|
+
var _util = require("@blocklet/launcher-util/es/util");
|
|
9
|
+
var _onDemand = _interopRequireDefault(require("@blocklet/launcher-ux/lib/payment/checkout/on-demand"));
|
|
10
|
+
var _paymentReact = require("@blocklet/payment-react");
|
|
11
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
12
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
14
|
+
var _Stack = _interopRequireDefault(require("@mui/material/Stack"));
|
|
15
|
+
var _ToggleButton = _interopRequireDefault(require("@mui/material/ToggleButton"));
|
|
16
|
+
var _ToggleButtonGroup = _interopRequireDefault(require("@mui/material/ToggleButtonGroup"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _react = require("react");
|
|
19
|
+
var _reactRouterDom = require("react-router-dom");
|
|
20
|
+
var _useAsync = _interopRequireDefault(require("react-use/lib/useAsync"));
|
|
21
|
+
var _useSetState = _interopRequireDefault(require("react-use/lib/useSetState"));
|
|
22
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
23
|
+
var _body = _interopRequireDefault(require("./components/layout/body"));
|
|
24
|
+
var _header = _interopRequireDefault(require("./components/layout/header"));
|
|
25
|
+
var _locale = require("./contexts/locale");
|
|
26
|
+
var _request = _interopRequireDefault(require("./contexts/request"));
|
|
27
|
+
var _session = require("./contexts/session");
|
|
28
|
+
var _workflow = require("./contexts/workflow");
|
|
29
|
+
var _util2 = require("./util");
|
|
30
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
+
var _templateObject;
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
34
|
+
const Root = (0, _styled.default)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n padding-top: 0;\n\n @media (max-width: 960px) {\n width: 100%;\n }\n"])));
|
|
35
|
+
function Content(_ref) {
|
|
36
|
+
var _window$blocklet, _window$blocklet2, _window$blocklet3, _window$blocklet4;
|
|
37
|
+
let {
|
|
38
|
+
blocklet
|
|
39
|
+
} = _ref;
|
|
40
|
+
const [state, setState] = (0, _useSetState.default)({
|
|
41
|
+
productType: 'on-demand'
|
|
42
|
+
});
|
|
43
|
+
const [params, setParams] = (0, _reactRouterDom.useSearchParams)();
|
|
44
|
+
const {
|
|
45
|
+
session,
|
|
46
|
+
connectApi
|
|
47
|
+
} = (0, _session.useSessionContext)();
|
|
48
|
+
const {
|
|
49
|
+
api: launchSessionAPI
|
|
50
|
+
} = (0, _request.default)();
|
|
51
|
+
const {
|
|
52
|
+
routerPrefix
|
|
53
|
+
} = (0, _workflow.useWorkflowContext)();
|
|
54
|
+
const {
|
|
55
|
+
t,
|
|
56
|
+
locale
|
|
57
|
+
} = (0, _locale.useLocaleContext)();
|
|
58
|
+
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
59
|
+
const sessionId = params.get('sessionId');
|
|
60
|
+
const blockletMetaUrl = params.get('blocklet_meta_url');
|
|
61
|
+
const defaultProductType = params.get('product_type');
|
|
62
|
+
const productTypes = ['on-demand'];
|
|
63
|
+
if ((_window$blocklet = window.blocklet) !== null && _window$blocklet !== void 0 && (_window$blocklet = _window$blocklet.preferences) !== null && _window$blocklet !== void 0 && _window$blocklet.dedicatedPricingTableId) {
|
|
64
|
+
productTypes.push('dedicated');
|
|
65
|
+
}
|
|
66
|
+
(0, _react.useEffect)(() => {
|
|
67
|
+
if (defaultProductType) {
|
|
68
|
+
setState({
|
|
69
|
+
productType: defaultProductType
|
|
70
|
+
});
|
|
71
|
+
params.set('product_type', defaultProductType);
|
|
72
|
+
setParams(params, {
|
|
73
|
+
replace: true
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}, [defaultProductType, params, setParams, setState]);
|
|
77
|
+
const getLaunchState = (0, _useAsync.default)(async () => {
|
|
78
|
+
const createPromiseFn = function createPromiseFn(fn) {
|
|
79
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
80
|
+
args[_key - 1] = arguments[_key];
|
|
81
|
+
}
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
fn(...args, (err, value) => {
|
|
84
|
+
if (err) {
|
|
85
|
+
reject(err);
|
|
86
|
+
} else {
|
|
87
|
+
resolve(value);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
if (sessionId) {
|
|
93
|
+
const launch = await createPromiseFn(_util2.launchSession.load, launchSessionAPI, routerPrefix, sessionId, blockletMetaUrl);
|
|
94
|
+
return launch;
|
|
95
|
+
}
|
|
96
|
+
const launch = await createPromiseFn(_util2.launchSession.create, launchSessionAPI, routerPrefix, blockletMetaUrl);
|
|
97
|
+
return launch;
|
|
98
|
+
});
|
|
99
|
+
(0, _react.useEffect)(() => {
|
|
100
|
+
const tmpLaunch = getLaunchState.value;
|
|
101
|
+
if (!tmpLaunch) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (tmpLaunch._id !== params.get('sessionId')) {
|
|
105
|
+
params.set('sessionId', tmpLaunch._id);
|
|
106
|
+
setParams(params, {
|
|
107
|
+
replace: true
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, [getLaunchState.value, params, setParams]);
|
|
111
|
+
if (getLaunchState.loading || blocklet.loading) {
|
|
112
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Center.default, {
|
|
113
|
+
relative: "parent",
|
|
114
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {})
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (getLaunchState.error) {
|
|
118
|
+
return t('common.serviceError');
|
|
119
|
+
}
|
|
120
|
+
const handlePaid = () => {
|
|
121
|
+
navigate("/paid?&sessionId=".concat(launch._id, "&blocklet_meta_url=").concat(launch.blockletMetaUrl));
|
|
122
|
+
};
|
|
123
|
+
const handleChangeProductType = (a, newProductType) => {
|
|
124
|
+
if (!newProductType) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setState({
|
|
128
|
+
productType: newProductType
|
|
129
|
+
});
|
|
130
|
+
params.set('product_type', newProductType);
|
|
131
|
+
setParams(params, {
|
|
132
|
+
replace: true
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// TODO: PaymentKitV2 处理支付失败的情况
|
|
137
|
+
|
|
138
|
+
const launch = getLaunchState.value;
|
|
139
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
|
|
140
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Stack.default, {
|
|
141
|
+
direction: "column",
|
|
142
|
+
sx: {
|
|
143
|
+
width: '100%',
|
|
144
|
+
height: '100%',
|
|
145
|
+
alignItems: 'center'
|
|
146
|
+
},
|
|
147
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButtonGroup.default, {
|
|
148
|
+
orientation: "horizontal",
|
|
149
|
+
color: "primary",
|
|
150
|
+
value: state.productType,
|
|
151
|
+
size: "small",
|
|
152
|
+
onChange: handleChangeProductType,
|
|
153
|
+
exclusive: true,
|
|
154
|
+
children: productTypes.map(type => {
|
|
155
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToggleButton.default, {
|
|
156
|
+
value: type,
|
|
157
|
+
sx: {
|
|
158
|
+
textTransform: 'capitalize'
|
|
159
|
+
},
|
|
160
|
+
children: t("purchase.productType.".concat(type))
|
|
161
|
+
}, type);
|
|
162
|
+
})
|
|
163
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
164
|
+
sx: {
|
|
165
|
+
width: '100%',
|
|
166
|
+
height: '100%',
|
|
167
|
+
marginTop: '24px',
|
|
168
|
+
'@media (min-width: 1200px)': {
|
|
169
|
+
maxWidth: '960px'
|
|
170
|
+
},
|
|
171
|
+
'@media (max-width: 1200px)': {
|
|
172
|
+
maxWidth: '100%'
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
children: [state.productType === 'on-demand' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_onDemand.default, {
|
|
176
|
+
launchSessionId: sessionId,
|
|
177
|
+
handlePaid: handlePaid,
|
|
178
|
+
components: (blocklet.components || []).map(x => ({
|
|
179
|
+
did: x.meta.did,
|
|
180
|
+
title: x.meta.title,
|
|
181
|
+
description: x.meta.description,
|
|
182
|
+
logo: (0, _util.getBlockletLogoUrl)({
|
|
183
|
+
did: x.meta.did,
|
|
184
|
+
baseUrl: blocklet.registryUrl,
|
|
185
|
+
logoPath: x.meta.logo
|
|
186
|
+
})
|
|
187
|
+
})),
|
|
188
|
+
blockletStoreURL: blocklet.registryUrl,
|
|
189
|
+
connectApi: connectApi,
|
|
190
|
+
session: session,
|
|
191
|
+
t: t,
|
|
192
|
+
locale: locale,
|
|
193
|
+
api: launchSessionAPI,
|
|
194
|
+
checkoutPath: "/payment/checkout"
|
|
195
|
+
}), state.productType === 'dedicated' && ((_window$blocklet2 = window.blocklet) === null || _window$blocklet2 === void 0 || (_window$blocklet2 = _window$blocklet2.preferences) === null || _window$blocklet2 === void 0 ? void 0 : _window$blocklet2.dedicatedPricingTableId) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
196
|
+
sx: {
|
|
197
|
+
display: 'flex',
|
|
198
|
+
width: '100%',
|
|
199
|
+
justifyContent: 'center',
|
|
200
|
+
'& .cko-container': {
|
|
201
|
+
justifyContent: 'center !important'
|
|
202
|
+
},
|
|
203
|
+
'& .cko-payment': {
|
|
204
|
+
gap: '8px'
|
|
205
|
+
},
|
|
206
|
+
'& >div>div': {
|
|
207
|
+
paddingTop: 0
|
|
208
|
+
},
|
|
209
|
+
'& .price-table-item': {
|
|
210
|
+
boxShadow: 'none'
|
|
211
|
+
},
|
|
212
|
+
'& .cko-payment-methods': {
|
|
213
|
+
marginTop: 0,
|
|
214
|
+
'&>p': {
|
|
215
|
+
marginBottom: 0
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
'& .cko-payment-submit': {
|
|
219
|
+
marginTop: 0,
|
|
220
|
+
'& button': {
|
|
221
|
+
fontSize: '1rem !important'
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paymentReact.PaymentProvider, {
|
|
226
|
+
session: session,
|
|
227
|
+
connect: connectApi,
|
|
228
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paymentReact.CheckoutTable, {
|
|
229
|
+
id: (_window$blocklet3 = window.blocklet) === null || _window$blocklet3 === void 0 || (_window$blocklet3 = _window$blocklet3.preferences) === null || _window$blocklet3 === void 0 ? void 0 : _window$blocklet3.dedicatedPricingTableId,
|
|
230
|
+
mode: "inline",
|
|
231
|
+
extraParams: {
|
|
232
|
+
'metadata.session_id': launch._id,
|
|
233
|
+
'subscription_data.trial_end': (0, _util.getDefaultTrialEnd)(),
|
|
234
|
+
'subscription_data.days_until_due': 0,
|
|
235
|
+
'subscription_data.days_until_cancel': ((_window$blocklet4 = window.blocklet) === null || _window$blocklet4 === void 0 || (_window$blocklet4 = _window$blocklet4.preferences) === null || _window$blocklet4 === void 0 ? void 0 : _window$blocklet4.daysUntilCancel) || 30
|
|
236
|
+
},
|
|
237
|
+
onPaid: handlePaid
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
})]
|
|
241
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
242
|
+
sx: {
|
|
243
|
+
display: 'flex',
|
|
244
|
+
justifyContent: 'space-between'
|
|
245
|
+
},
|
|
246
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
247
|
+
component: _reactRouterDom.Link,
|
|
248
|
+
sx: {
|
|
249
|
+
color: 'text.secondary',
|
|
250
|
+
marginTop: '24px',
|
|
251
|
+
marginBottom: '12px',
|
|
252
|
+
'&:hover': {
|
|
253
|
+
textDecoration: 'underline !important'
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
to: (0, _urlJoin.default)(routerPrefix, "/purchase/select".concat(window.location.search)),
|
|
257
|
+
children: t('purchase.selectSpaceHint')
|
|
258
|
+
})
|
|
259
|
+
})]
|
|
260
|
+
})
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function PreparePage(_ref2) {
|
|
264
|
+
let {
|
|
265
|
+
blocklet
|
|
266
|
+
} = _ref2;
|
|
267
|
+
const {
|
|
268
|
+
t
|
|
269
|
+
} = (0, _locale.useLocaleContext)();
|
|
270
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
271
|
+
sx: {
|
|
272
|
+
display: 'flex',
|
|
273
|
+
flexDirection: 'column',
|
|
274
|
+
width: '100%',
|
|
275
|
+
height: '100%'
|
|
276
|
+
},
|
|
277
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_header.default, {
|
|
278
|
+
title: t('purchase.pageTitle'),
|
|
279
|
+
disableBack: true
|
|
280
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_body.default, {
|
|
281
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
282
|
+
sx: {
|
|
283
|
+
display: 'flex',
|
|
284
|
+
justifyContent: 'center',
|
|
285
|
+
height: '100%'
|
|
286
|
+
},
|
|
287
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Content, {
|
|
288
|
+
blocklet: blocklet
|
|
289
|
+
})
|
|
290
|
+
})
|
|
291
|
+
})]
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
const propTypes = {
|
|
295
|
+
blocklet: _propTypes.default.object.isRequired
|
|
296
|
+
};
|
|
297
|
+
PreparePage.propTypes = propTypes;
|
|
298
|
+
Content.propTypes = propTypes;
|
|
299
|
+
var _default = exports.default = PreparePage;
|
package/lib/purchase.js
CHANGED
|
@@ -42,12 +42,12 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
42
42
|
var _templateObject;
|
|
43
43
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
44
44
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
45
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
45
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
46
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
47
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
48
48
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
49
49
|
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; }
|
|
50
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
50
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
51
51
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
52
52
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
53
53
|
var NextIcon = function NextIcon(props) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/launcher-workflow",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.55",
|
|
4
4
|
"description": "Purchase components for Launcher UI",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -41,44 +41,49 @@
|
|
|
41
41
|
"react": ">=18.1.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@arcblock/did-connect": "^2.9.
|
|
45
|
-
"@arcblock/icons": "^2.9.
|
|
46
|
-
"@arcblock/license": "^2.9.
|
|
47
|
-
"@arcblock/react-hooks": "^2.9.
|
|
48
|
-
"@arcblock/ux": "^2.9.
|
|
49
|
-
"@blocklet/launcher-layout": "2.2.
|
|
50
|
-
"@blocklet/launcher-util": "2.2.
|
|
51
|
-
"@blocklet/launcher-ux": "2.2.
|
|
52
|
-
"@blocklet/payment": "^1.13.
|
|
53
|
-
"@
|
|
44
|
+
"@arcblock/did-connect": "^2.9.57",
|
|
45
|
+
"@arcblock/icons": "^2.9.57",
|
|
46
|
+
"@arcblock/license": "^2.9.57",
|
|
47
|
+
"@arcblock/react-hooks": "^2.9.57",
|
|
48
|
+
"@arcblock/ux": "^2.9.57",
|
|
49
|
+
"@blocklet/launcher-layout": "2.2.55",
|
|
50
|
+
"@blocklet/launcher-util": "2.2.55",
|
|
51
|
+
"@blocklet/launcher-ux": "2.2.55",
|
|
52
|
+
"@blocklet/payment": "^1.13.190",
|
|
53
|
+
"@blocklet/payment-react": "^1.13.190",
|
|
54
|
+
"@emotion/react": "^11.11.4",
|
|
54
55
|
"@emotion/styled": "^11.11.0",
|
|
55
|
-
"@mui/icons-material": "^5.15.
|
|
56
|
-
"@mui/
|
|
57
|
-
"@
|
|
56
|
+
"@mui/icons-material": "^5.15.14",
|
|
57
|
+
"@mui/lab": "^5.0.0-alpha.169",
|
|
58
|
+
"@mui/material": "^5.15.14",
|
|
59
|
+
"@ocap/util": "^1.18.113",
|
|
58
60
|
"@splidejs/react-splide": "^0.7.12",
|
|
59
61
|
"@splidejs/splide": "^4.1.4",
|
|
60
62
|
"@splidejs/splide-extension-grid": "^0.4.1",
|
|
61
63
|
"@stripe/react-stripe-js": "^1.16.5",
|
|
62
64
|
"@stripe/stripe-js": "^1.54.2",
|
|
65
|
+
"ahooks": "^3.7.10",
|
|
63
66
|
"axios": "^0.27.2",
|
|
64
67
|
"dsbridge": "^3.1.4",
|
|
65
68
|
"flat": "^5.0.2",
|
|
66
69
|
"js-cookie": "^3.0.5",
|
|
67
70
|
"lodash.get": "^4.4.2",
|
|
71
|
+
"lodash.merge": "^4.6.2",
|
|
68
72
|
"lodash.noop": "^3.0.1",
|
|
69
73
|
"lodash.pick": "^4.4.0",
|
|
70
74
|
"lodash.throttle": "^4.1.1",
|
|
75
|
+
"moment": "^2.30.1",
|
|
71
76
|
"prop-types": "^15.8.1",
|
|
72
77
|
"react-lottie-player": "^1.5.6",
|
|
73
|
-
"react-router-dom": "^6.22.
|
|
78
|
+
"react-router-dom": "^6.22.3",
|
|
74
79
|
"react-use": "^17.5.0",
|
|
75
80
|
"url-join": "^4.0.1"
|
|
76
81
|
},
|
|
77
82
|
"devDependencies": {
|
|
78
|
-
"@babel/cli": "^7.
|
|
79
|
-
"@babel/core": "^7.
|
|
80
|
-
"@babel/preset-env": "^7.
|
|
81
|
-
"@babel/preset-react": "^7.
|
|
83
|
+
"@babel/cli": "^7.24.1",
|
|
84
|
+
"@babel/core": "^7.24.3",
|
|
85
|
+
"@babel/preset-env": "^7.24.3",
|
|
86
|
+
"@babel/preset-react": "^7.24.1",
|
|
82
87
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
83
88
|
"glob": "^10.3.10",
|
|
84
89
|
"jest": "^27.5.1"
|
|
@@ -101,5 +106,5 @@
|
|
|
101
106
|
"require": "./lib/locales/index.js"
|
|
102
107
|
}
|
|
103
108
|
},
|
|
104
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "83daa20f7a51626f804cc9e4f54cdcd90d51e2d8"
|
|
105
110
|
}
|