@blocklet/launcher-workflow 2.1.108 → 2.2.0
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/assets/images/blocklet-server.svg +10 -0
- package/es/assets/images/check-reverse.svg +5 -0
- package/es/assets/images/check.svg +5 -0
- package/es/assets/images/checkbox-checked.svg +5 -0
- package/es/assets/images/checkbox-unchecked.svg +3 -0
- package/es/assets/images/next.svg +8 -0
- package/es/assets/images/prev.svg +8 -0
- package/es/assets/images/space.svg +9 -0
- package/es/assets/images/uncheck-reverse.svg +4 -0
- package/es/assets/images/uncheck.svg +4 -0
- package/es/checkout.js +573 -0
- package/es/components/agreement.js +5 -0
- package/es/components/checkbox.js +94 -0
- package/es/components/confirm.js +95 -0
- package/es/components/in-progress-session.js +96 -0
- package/es/components/launch-dedicated.js +290 -0
- package/es/components/launch-serverless.js +113 -0
- package/es/components/layout/body.js +41 -0
- package/es/components/layout/footer.js +21 -0
- package/es/components/layout/header.js +25 -0
- package/es/components/layout/index.js +24 -0
- package/es/components/plan.js +445 -0
- package/es/contexts/locale.js +2 -0
- package/es/contexts/request.js +71 -0
- package/es/contexts/session.js +13 -0
- package/es/contexts/workflow.js +64 -0
- package/es/hooks/query.js +4 -0
- package/es/launch.js +36 -0
- package/es/locales/en.js +135 -0
- package/es/locales/index.js +8 -0
- package/es/locales/zh.js +134 -0
- package/es/purchase.js +631 -0
- package/es/util.js +165 -0
- package/lib/checkout.js +5 -5
- package/lib/components/checkbox.js +2 -2
- package/lib/components/in-progress-session.js +4 -4
- package/lib/components/launch-dedicated.js +3 -3
- package/lib/components/launch-serverless.js +1 -1
- package/lib/components/layout/body.js +2 -2
- package/lib/components/layout/footer.js +2 -2
- package/lib/components/layout/index.js +2 -2
- package/lib/components/plan.js +6 -6
- package/lib/contexts/request.js +2 -2
- package/lib/locales/en.js +7 -2
- package/lib/locales/index.js +15 -9
- package/lib/locales/zh.js +7 -2
- package/lib/purchase.js +4 -4
- package/package.json +32 -7
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useSearchParams } from 'react-router-dom';
|
|
4
|
+
import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
|
5
|
+
import { LocaleProvider } from './locale';
|
|
6
|
+
import { RequestProvider } from './request';
|
|
7
|
+
import { translations } from '../locales';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const Context = /*#__PURE__*/createContext();
|
|
10
|
+
const {
|
|
11
|
+
Provider
|
|
12
|
+
} = Context;
|
|
13
|
+
function WorkflowProvider({
|
|
14
|
+
baseURL,
|
|
15
|
+
embed,
|
|
16
|
+
didPayPrefix,
|
|
17
|
+
routerPrefix,
|
|
18
|
+
locale,
|
|
19
|
+
children
|
|
20
|
+
}) {
|
|
21
|
+
const [params] = useSearchParams();
|
|
22
|
+
const browser = useBrowser();
|
|
23
|
+
// FIXME: @wangshijun this is not working in android wallet
|
|
24
|
+
const isPurchaseOnly = browser.wallet && params.get('source') === 'acquireUrl' || !params.get('blocklet_meta_url');
|
|
25
|
+
const value = {
|
|
26
|
+
embed,
|
|
27
|
+
baseURL,
|
|
28
|
+
didPayPrefix,
|
|
29
|
+
routerPrefix,
|
|
30
|
+
isPurchaseOnly
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/_jsx(LocaleProvider, {
|
|
33
|
+
locale: locale,
|
|
34
|
+
translations: translations,
|
|
35
|
+
fallbackLocale: "en",
|
|
36
|
+
children: /*#__PURE__*/_jsx(RequestProvider, {
|
|
37
|
+
baseURL: baseURL,
|
|
38
|
+
children: /*#__PURE__*/_jsx(Provider, {
|
|
39
|
+
value: value,
|
|
40
|
+
children: children
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
WorkflowProvider.propTypes = {
|
|
46
|
+
baseURL: PropTypes.string,
|
|
47
|
+
routerPrefix: PropTypes.string,
|
|
48
|
+
didPayPrefix: PropTypes.string,
|
|
49
|
+
locale: PropTypes.string,
|
|
50
|
+
embed: PropTypes.bool,
|
|
51
|
+
children: PropTypes.any.isRequired
|
|
52
|
+
};
|
|
53
|
+
WorkflowProvider.defaultProps = {
|
|
54
|
+
baseURL: '/',
|
|
55
|
+
routerPrefix: '/',
|
|
56
|
+
didPayPrefix: '/',
|
|
57
|
+
locale: 'en',
|
|
58
|
+
embed: true
|
|
59
|
+
};
|
|
60
|
+
function useWorkflowContext() {
|
|
61
|
+
const value = useContext(Context);
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
export { useWorkflowContext, WorkflowProvider };
|
package/es/launch.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useParams, useSearchParams } from 'react-router-dom';
|
|
3
|
+
import LaunchServerless from './components/launch-serverless';
|
|
4
|
+
import LaunchDedicated from './components/launch-dedicated';
|
|
5
|
+
import { useSessionContext } from './contexts/session';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export default function Launch() {
|
|
8
|
+
const {
|
|
9
|
+
nftId
|
|
10
|
+
} = useParams();
|
|
11
|
+
const [searchParams] = useSearchParams();
|
|
12
|
+
const {
|
|
13
|
+
session
|
|
14
|
+
} = useSessionContext();
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!session.user) {
|
|
17
|
+
return session.login(() => {
|
|
18
|
+
session.refresh();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return () => {};
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
}, [session.user]);
|
|
24
|
+
if (!session.user) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
const launchType = searchParams.get('launchType');
|
|
28
|
+
if (launchType === 'serverless') {
|
|
29
|
+
return /*#__PURE__*/_jsx(LaunchServerless, {
|
|
30
|
+
nftId: nftId
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return /*#__PURE__*/_jsx(LaunchDedicated, {
|
|
34
|
+
nftId: nftId
|
|
35
|
+
});
|
|
36
|
+
}
|
package/es/locales/en.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
common: {
|
|
3
|
+
error: 'Oops',
|
|
4
|
+
agreeTo: 'Agree to the',
|
|
5
|
+
agreement: 'Agreement',
|
|
6
|
+
paymentMethod: 'Payment Method',
|
|
7
|
+
agreementHint: 'Please check the box to agree to the user agreement and continue',
|
|
8
|
+
serverType: 'Blocklet Space Type',
|
|
9
|
+
paying: 'Paying',
|
|
10
|
+
name: 'Name',
|
|
11
|
+
description: 'Description',
|
|
12
|
+
retry: 'Retry',
|
|
13
|
+
launch: 'Launch',
|
|
14
|
+
next: 'Next',
|
|
15
|
+
purchase: 'Purchase',
|
|
16
|
+
redeem: 'Redeem',
|
|
17
|
+
redirecting: 'Redirecting',
|
|
18
|
+
cancel: 'Cancel',
|
|
19
|
+
confirm: 'Confirm',
|
|
20
|
+
launching: 'Launching',
|
|
21
|
+
loadFailed: 'Failed to load the resource, please refresh the page and try again.',
|
|
22
|
+
payFailed: 'Payment failed',
|
|
23
|
+
details: 'Details',
|
|
24
|
+
previous: 'Previous',
|
|
25
|
+
pay: 'Pay',
|
|
26
|
+
payWith: 'Pay with {currency}',
|
|
27
|
+
popular: 'Popular',
|
|
28
|
+
space: 'Space'
|
|
29
|
+
},
|
|
30
|
+
license: {
|
|
31
|
+
title: 'End User License Agreement',
|
|
32
|
+
footer: 'Agree to the EULA and continue'
|
|
33
|
+
},
|
|
34
|
+
prepare: {
|
|
35
|
+
serverless: {
|
|
36
|
+
allocate: 'Waiting for space',
|
|
37
|
+
allocated: 'Blocklet space ready',
|
|
38
|
+
preparing: 'Preparing blocklet space for you launch request...',
|
|
39
|
+
prepared: 'Blocklet space is ready for you, redirecting...',
|
|
40
|
+
prepareFailed: 'Failed to prepare space! {error}'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
launch: {
|
|
44
|
+
pageTitle: 'Prepare Space',
|
|
45
|
+
invalidFftId: 'Invalid Purchase NFT ID',
|
|
46
|
+
launchApp: 'Launch App',
|
|
47
|
+
launching: 'Your Blocklet Space is being baked, please be patient, it usually takes about 5 minutes',
|
|
48
|
+
launched: 'Your Blocklet Space is up and running',
|
|
49
|
+
launchSuccess: 'Blocklet Space is successfully launched',
|
|
50
|
+
loadStatusFailed: 'Failed to load Blocklet Space status',
|
|
51
|
+
waitingForLaunching: 'Your Blocklet Space launch request is being processed, please be patient, it usually takes about 5 minutes',
|
|
52
|
+
accessServer: 'Access Blocklet Space',
|
|
53
|
+
waiting: {
|
|
54
|
+
starting: 'Starting Blocklet Space',
|
|
55
|
+
securing: 'Securing Network',
|
|
56
|
+
prepare: 'Prepare Storage',
|
|
57
|
+
waiting: 'Waiting for Ready',
|
|
58
|
+
done: 'Blocklet Space is Ready'
|
|
59
|
+
},
|
|
60
|
+
dialog: {
|
|
61
|
+
title: 'Launch Blocklet Space',
|
|
62
|
+
scan: 'Scan following QRCode with your DID Wallet',
|
|
63
|
+
confirm: 'Confirm on your DID Wallet',
|
|
64
|
+
success: 'Launching'
|
|
65
|
+
},
|
|
66
|
+
error: {
|
|
67
|
+
launchFailed: 'Launch Space Failed',
|
|
68
|
+
launchFailedDescription: 'You can retry by clicking the button below',
|
|
69
|
+
notFound: 'No Blocklet Space being started',
|
|
70
|
+
notFoundDescription: 'You can launch the Space by clicking the button below'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
start: {
|
|
74
|
+
title: 'Starting Space',
|
|
75
|
+
error: {
|
|
76
|
+
launchFailed: 'Start Space Failed',
|
|
77
|
+
notFound: 'No Space being started'
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
redeem: {
|
|
81
|
+
title: 'Redeem Space',
|
|
82
|
+
subTitle: 'Name the Blocklet Space you are going to redeem, the name will exist on server passport',
|
|
83
|
+
dialog: {
|
|
84
|
+
title: 'Redeem Space',
|
|
85
|
+
scan: 'Scan the QR code below with your DID wallet to complete redeem',
|
|
86
|
+
confirm: 'Confirm on your DID Wallet',
|
|
87
|
+
success: 'Your redeem request is being processing'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
launchPrepare: {
|
|
91
|
+
formError: {
|
|
92
|
+
nameExceed: 'Blocklet Space name cannot exceed {length}',
|
|
93
|
+
descriptionExceed: 'Blocklet Space description cannot exceed {length}'
|
|
94
|
+
},
|
|
95
|
+
error: {
|
|
96
|
+
loginFirst: 'Please login first'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
purchase: {
|
|
100
|
+
pageTitle: 'Purchase Space',
|
|
101
|
+
noPlan: 'Select space to continue',
|
|
102
|
+
hasPlan: 'Continue with {name}',
|
|
103
|
+
selectSpaceHint: 'Already have dedicated space? Click here to select >',
|
|
104
|
+
morePlanPrompt: 'Flip the page to see more plans',
|
|
105
|
+
redeem: 'Select purchased space',
|
|
106
|
+
noProducts: 'No products available for purchase, please check your payment-kit config',
|
|
107
|
+
serverlessNotSupported: 'This app is not allowed in sigular and on-demand space, please select dedicated space',
|
|
108
|
+
dialog: {
|
|
109
|
+
title: 'Purchase Blocklet Space NFT',
|
|
110
|
+
scan: 'Scan the QR code below with your DID wallet to complete purchase',
|
|
111
|
+
confirm: 'Confirm on your DID Wallet',
|
|
112
|
+
success: 'Purchase Success'
|
|
113
|
+
},
|
|
114
|
+
serverlessDialog: {
|
|
115
|
+
title: 'Purchase successfully',
|
|
116
|
+
redirectToStoreButton: 'Go to install the application →',
|
|
117
|
+
purchaseServerlessSuccess: 'The purchase of Running Space is successful and you can go ahead and install Blocklet.'
|
|
118
|
+
},
|
|
119
|
+
inProgress: {
|
|
120
|
+
title: 'Unfinished Order',
|
|
121
|
+
continue: 'Continue',
|
|
122
|
+
content: 'You have an incomplete order {blockletName}, Continue this order?',
|
|
123
|
+
notRemind: 'No more reminders'
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
checkout: {
|
|
127
|
+
pageTitle: 'Checkout',
|
|
128
|
+
orderTotal: 'Order total',
|
|
129
|
+
paymentTotal: 'Payment Total',
|
|
130
|
+
paymentMethod: {
|
|
131
|
+
title: 'Select payment currency'
|
|
132
|
+
},
|
|
133
|
+
agreement: '{name} User Agreement'
|
|
134
|
+
}
|
|
135
|
+
};
|
package/es/locales/zh.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
common: {
|
|
3
|
+
error: '哎呀',
|
|
4
|
+
agreeTo: '同意',
|
|
5
|
+
agreement: '用户协议',
|
|
6
|
+
agreementHint: '请勾选同意用户协议后继续',
|
|
7
|
+
paymentMethod: '支付方式',
|
|
8
|
+
serverType: '空间信息',
|
|
9
|
+
paying: '支付中',
|
|
10
|
+
name: '名称',
|
|
11
|
+
description: '描述',
|
|
12
|
+
retry: '重试',
|
|
13
|
+
launch: '启动',
|
|
14
|
+
next: '下一步',
|
|
15
|
+
redeem: '兑换',
|
|
16
|
+
purchase: '购买',
|
|
17
|
+
redirecting: '跳转中',
|
|
18
|
+
cancel: '取消',
|
|
19
|
+
confirm: '同意',
|
|
20
|
+
launching: '启动中',
|
|
21
|
+
payFailed: '支付失败',
|
|
22
|
+
loadFailed: '加载资源失败, 请刷新页面重试。',
|
|
23
|
+
details: '明细',
|
|
24
|
+
pay: '支付',
|
|
25
|
+
previous: '上一步',
|
|
26
|
+
popular: '推荐',
|
|
27
|
+
space: '空间',
|
|
28
|
+
payWith: '用{currency}支付'
|
|
29
|
+
},
|
|
30
|
+
license: {
|
|
31
|
+
title: '空间用户协议',
|
|
32
|
+
footer: '同意协议并继续'
|
|
33
|
+
},
|
|
34
|
+
prepare: {
|
|
35
|
+
serverless: {
|
|
36
|
+
allocate: '等待空间就绪',
|
|
37
|
+
preparing: '正在为应用启动准备空间...',
|
|
38
|
+
prepared: '已准备好应用空间,跳转中...',
|
|
39
|
+
prepareFailed: '准备空间失败! {error}'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
launch: {
|
|
43
|
+
pageTitle: '准备空间',
|
|
44
|
+
invalidFftId: '无效的购买凭证',
|
|
45
|
+
launchApp: '启动应用',
|
|
46
|
+
launching: '空间正在启动中, 大约需要 5 分钟',
|
|
47
|
+
launched: '空间已启动',
|
|
48
|
+
launchSuccess: '创建空间成功',
|
|
49
|
+
loadStatusFailed: '加载空间状态失败',
|
|
50
|
+
waitingForLaunching: '空间正在启动中,大约需要 5 分钟',
|
|
51
|
+
accessServer: '访问空间',
|
|
52
|
+
waiting: {
|
|
53
|
+
starting: '启动空间',
|
|
54
|
+
securing: '确保空间的网络安全',
|
|
55
|
+
prepare: '准备好空间存储',
|
|
56
|
+
waiting: '等待空间就绪',
|
|
57
|
+
done: '空间已准备就绪'
|
|
58
|
+
},
|
|
59
|
+
dialog: {
|
|
60
|
+
title: '创建空间',
|
|
61
|
+
scan: '用您的 DID 钱包扫描下面的二维码',
|
|
62
|
+
confirm: '在您的 DID 钱包上确认',
|
|
63
|
+
success: '正在启动'
|
|
64
|
+
},
|
|
65
|
+
error: {
|
|
66
|
+
launchFailed: '空间空间失败',
|
|
67
|
+
launchFailedDescription: '您可以点击下面按钮重试',
|
|
68
|
+
notFound: '没有正在启动的空间',
|
|
69
|
+
notFoundDescription: '您可以点击下面按钮启动空间'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
start: {
|
|
73
|
+
title: '启动空间',
|
|
74
|
+
error: {
|
|
75
|
+
launchFailed: '启动空间失败',
|
|
76
|
+
notFound: '没有正在启动的空间'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
redeem: {
|
|
80
|
+
title: '启动空间',
|
|
81
|
+
subTitle: '为你的空间起个名字吧,空间名字将会打印在空间通行证上',
|
|
82
|
+
dialog: {
|
|
83
|
+
title: '兑换空间',
|
|
84
|
+
scan: '用您的 DID 钱包扫描下面的二维码,提供 NFT',
|
|
85
|
+
confirm: '在您的 DID 钱包上确认',
|
|
86
|
+
success: '兑换成功'
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
launchPrepare: {
|
|
90
|
+
formError: {
|
|
91
|
+
nameExceed: '空间名称不能超过 {length}',
|
|
92
|
+
descriptionExceed: '空间描述不能超过 {length}'
|
|
93
|
+
},
|
|
94
|
+
error: {
|
|
95
|
+
loginFirst: '请先登录'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
purchase: {
|
|
99
|
+
pageTitle: '选购空间',
|
|
100
|
+
selectSpaceHint: '已有专用空间?点击这里选择 >',
|
|
101
|
+
morePlanPrompt: '翻页看更多方案',
|
|
102
|
+
redeem: '我已购买空间',
|
|
103
|
+
noPlan: '选择套餐以继续',
|
|
104
|
+
hasPlan: '选用{name}',
|
|
105
|
+
noProducts: '没有可购买的商品,请检查 PaymentKit 的配置',
|
|
106
|
+
serverlessNotSupported: '该应用被禁止能在单应用或者按需空间中运行,请选择专用空间',
|
|
107
|
+
dialog: {
|
|
108
|
+
title: '购买 Blocklet Server NFT',
|
|
109
|
+
scan: '用您的 DID 钱包扫描下面的二维码完成购买',
|
|
110
|
+
confirm: '在您的 DID 钱包上确认',
|
|
111
|
+
success: '支付成功'
|
|
112
|
+
},
|
|
113
|
+
serverlessDialog: {
|
|
114
|
+
title: '购买成功',
|
|
115
|
+
redirectToStoreButton: '去安装应用 →',
|
|
116
|
+
purchaseServerlessSuccess: '购买运行空间成功,您可以去安装应用.'
|
|
117
|
+
},
|
|
118
|
+
inProgress: {
|
|
119
|
+
title: '未完成的订单',
|
|
120
|
+
continue: '继续',
|
|
121
|
+
content: '您有一个未完成的订单: {blockletName},继续该订单?',
|
|
122
|
+
notRemind: '不再提醒'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
checkout: {
|
|
126
|
+
pageTitle: '结账',
|
|
127
|
+
orderTotal: '总计',
|
|
128
|
+
paymentTotal: '总支付',
|
|
129
|
+
paymentMethod: {
|
|
130
|
+
title: '选择支付货币'
|
|
131
|
+
},
|
|
132
|
+
agreement: '{name} 用户协议'
|
|
133
|
+
}
|
|
134
|
+
};
|