@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,41 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const Body = /*#__PURE__*/forwardRef(function Body({
|
|
6
|
+
children,
|
|
7
|
+
...rest
|
|
8
|
+
}, ref) {
|
|
9
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
10
|
+
ref: ref,
|
|
11
|
+
...rest,
|
|
12
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
13
|
+
className: "page-body-article",
|
|
14
|
+
children: children
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
Body.propTypes = {
|
|
19
|
+
children: PropTypes.any.isRequired
|
|
20
|
+
};
|
|
21
|
+
const Container = styled.div`
|
|
22
|
+
flex: 1;
|
|
23
|
+
|
|
24
|
+
@media (min-width: 960px) {
|
|
25
|
+
margin-top: 32px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media (max-width: 960px) {
|
|
29
|
+
margin-top: 16px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.page-body-article {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 16px;
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
export default Body;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function Footer({
|
|
5
|
+
children,
|
|
6
|
+
...rest
|
|
7
|
+
}) {
|
|
8
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
9
|
+
...rest,
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
Footer.propTypes = {
|
|
14
|
+
children: PropTypes.any.isRequired
|
|
15
|
+
};
|
|
16
|
+
const Container = styled.div`
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: flex-end;
|
|
19
|
+
margin-top: auto;
|
|
20
|
+
width: 100%;
|
|
21
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useNavigate } from 'react-router-dom';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import PageHeader from '@blocklet/launcher-layout/lib/page-header';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export default function Header({
|
|
6
|
+
title,
|
|
7
|
+
disableBack
|
|
8
|
+
}) {
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
const clickBack = () => {
|
|
11
|
+
navigate(-1);
|
|
12
|
+
};
|
|
13
|
+
return /*#__PURE__*/_jsx(PageHeader, {
|
|
14
|
+
title: title,
|
|
15
|
+
onClickBack: disableBack ? undefined : clickBack
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
Header.propTypes = {
|
|
19
|
+
title: PropTypes.any,
|
|
20
|
+
disableBack: PropTypes.bool
|
|
21
|
+
};
|
|
22
|
+
Header.defaultProps = {
|
|
23
|
+
title: '',
|
|
24
|
+
disableBack: false
|
|
25
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function Layout({
|
|
5
|
+
children,
|
|
6
|
+
...rest
|
|
7
|
+
}) {
|
|
8
|
+
// layout-fix-container for compatibility with lower versions of safari, do not remove this className
|
|
9
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
10
|
+
className: "layout-fix-container",
|
|
11
|
+
...rest,
|
|
12
|
+
children: children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
Layout.propTypes = {
|
|
16
|
+
children: PropTypes.any.isRequired
|
|
17
|
+
};
|
|
18
|
+
const Container = styled.div`
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
justify-content: flex-start;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
`;
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { prettyDuration } from '@blocklet/launcher-util/es/util';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
7
|
+
import FormControl from '@mui/material/FormControl';
|
|
8
|
+
import Select from '@mui/material/Select';
|
|
9
|
+
import useMobile from '@blocklet/launcher-ux/lib/use-mobile';
|
|
10
|
+
import noop from 'lodash.noop';
|
|
11
|
+
import { Tooltip } from '@mui/material';
|
|
12
|
+
var CheckIcon = function CheckIcon(props) {
|
|
13
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
14
|
+
...props,
|
|
15
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
16
|
+
d: "M10 20c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z",
|
|
17
|
+
fill: "#1DC1C7"
|
|
18
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
19
|
+
d: "m5.474 10.646 2.586 2.586 6.465-6.465",
|
|
20
|
+
fill: "#1DC1C7"
|
|
21
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
22
|
+
fillRule: "evenodd",
|
|
23
|
+
clipRule: "evenodd",
|
|
24
|
+
d: "M15.233 6.06a1 1 0 0 1 0 1.415L8.768 13.94a1 1 0 0 1-1.415 0l-2.586-2.586a1 1 0 1 1 1.415-1.415l1.878 1.88 5.758-5.759a1 1 0 0 1 1.415 0Z",
|
|
25
|
+
fill: "#fff"
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
CheckIcon.defaultProps = {
|
|
30
|
+
width: "20",
|
|
31
|
+
height: "20",
|
|
32
|
+
fill: "none",
|
|
33
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
34
|
+
};
|
|
35
|
+
var CheckReverseIcon = function CheckReverseIcon(props) {
|
|
36
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
37
|
+
...props,
|
|
38
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
39
|
+
d: "M10.75 20c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10Z",
|
|
40
|
+
fill: "#fff"
|
|
41
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
42
|
+
d: "m6.224 10.646 2.586 2.586 6.465-6.465",
|
|
43
|
+
fill: "#fff"
|
|
44
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
45
|
+
d: "m6.224 10.646 2.586 2.586 6.465-6.465",
|
|
46
|
+
stroke: "#1DC1C7",
|
|
47
|
+
strokeWidth: "2",
|
|
48
|
+
strokeLinecap: "round",
|
|
49
|
+
strokeLinejoin: "round"
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
CheckReverseIcon.defaultProps = {
|
|
54
|
+
width: "21",
|
|
55
|
+
height: "20",
|
|
56
|
+
fill: "none",
|
|
57
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
58
|
+
};
|
|
59
|
+
var UnCheckIcon = function UnCheckIcon(props) {
|
|
60
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
61
|
+
...props,
|
|
62
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
63
|
+
d: "M10.25 20c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10Z",
|
|
64
|
+
fill: "#1DC1C7"
|
|
65
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
66
|
+
fillRule: "evenodd",
|
|
67
|
+
clipRule: "evenodd",
|
|
68
|
+
d: "M14.6 5.029a.872.872 0 0 0-.846.233L10.25 8.769 6.746 5.262A.872.872 0 1 0 5.51 6.497l3.505 3.508-3.506 3.509-.002.002a.874.874 0 0 0 1.235 1.235l3.507-3.51 3.505 3.508.002.002a.872.872 0 0 0 1.235-1.235l-3.508-3.511 3.504-3.508a.874.874 0 0 0-.388-1.468Z",
|
|
69
|
+
fill: "#fff"
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
UnCheckIcon.defaultProps = {
|
|
74
|
+
width: "21",
|
|
75
|
+
height: "20",
|
|
76
|
+
fill: "none",
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
78
|
+
};
|
|
79
|
+
var UnCheckReverseIcon = function UnCheckReverseIcon(props) {
|
|
80
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
81
|
+
...props,
|
|
82
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
83
|
+
d: "M10.75 20c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10Z",
|
|
84
|
+
fill: "#fff"
|
|
85
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
86
|
+
fillRule: "evenodd",
|
|
87
|
+
clipRule: "evenodd",
|
|
88
|
+
d: "M15.1 5.029a.872.872 0 0 0-.846.233L10.75 8.769 7.246 5.262A.872.872 0 1 0 6.01 6.497l3.505 3.508-3.506 3.509-.002.002a.874.874 0 0 0 1.235 1.235l3.507-3.51 3.505 3.508.002.002a.872.872 0 0 0 1.235-1.235l-3.508-3.511 3.504-3.508a.874.874 0 0 0-.388-1.468Z",
|
|
89
|
+
fill: "#1DC1C7"
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
UnCheckReverseIcon.defaultProps = {
|
|
94
|
+
width: "21",
|
|
95
|
+
height: "20",
|
|
96
|
+
fill: "none",
|
|
97
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
98
|
+
};
|
|
99
|
+
import { getPrice } from '../util';
|
|
100
|
+
import { useLocaleContext } from '../contexts/locale';
|
|
101
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
102
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
103
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
104
|
+
function Feature({
|
|
105
|
+
feature,
|
|
106
|
+
locale,
|
|
107
|
+
checked,
|
|
108
|
+
isMobile
|
|
109
|
+
}) {
|
|
110
|
+
let valueEle = '';
|
|
111
|
+
if (feature.type === 'boolean') {
|
|
112
|
+
if (feature.value === true) {
|
|
113
|
+
valueEle = checked ? /*#__PURE__*/_jsx(CheckReverseIcon, {}) : /*#__PURE__*/_jsx(CheckIcon, {});
|
|
114
|
+
} else {
|
|
115
|
+
valueEle = checked ? /*#__PURE__*/_jsx(UnCheckReverseIcon, {}) : /*#__PURE__*/_jsx(UnCheckIcon, {});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (feature.type === 'text') {
|
|
119
|
+
valueEle = feature.value[locale];
|
|
120
|
+
}
|
|
121
|
+
if (isMobile) {
|
|
122
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
123
|
+
children: [feature.type === 'boolean' && /*#__PURE__*/_jsxs(MobileBooleanItem, {
|
|
124
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
125
|
+
component: "span",
|
|
126
|
+
style: {
|
|
127
|
+
display: 'flex'
|
|
128
|
+
},
|
|
129
|
+
children: valueEle
|
|
130
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
131
|
+
component: "span",
|
|
132
|
+
style: {
|
|
133
|
+
marginLeft: '8px'
|
|
134
|
+
},
|
|
135
|
+
children: feature.name[locale]
|
|
136
|
+
})]
|
|
137
|
+
}), feature.type === 'text' && /*#__PURE__*/_jsx(TextItem, {
|
|
138
|
+
children: `${feature.name[locale]}: ${valueEle}`
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return feature.type === 'text' ? /*#__PURE__*/_jsx(TextItem, {
|
|
143
|
+
children: valueEle
|
|
144
|
+
}) : valueEle;
|
|
145
|
+
}
|
|
146
|
+
const MobileBooleanItem = styled.div`
|
|
147
|
+
display: flex;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
`;
|
|
150
|
+
const TextItem = styled.div`
|
|
151
|
+
display: -webkit-box;
|
|
152
|
+
white-space: normal;
|
|
153
|
+
-webkit-line-clamp: 2;
|
|
154
|
+
-webkit-box-orient: vertical;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
`;
|
|
157
|
+
Feature.propTypes = {
|
|
158
|
+
feature: PropTypes.object.isRequired,
|
|
159
|
+
locale: PropTypes.string.isRequired,
|
|
160
|
+
checked: PropTypes.bool,
|
|
161
|
+
isMobile: PropTypes.bool
|
|
162
|
+
};
|
|
163
|
+
Feature.defaultProps = {
|
|
164
|
+
checked: false,
|
|
165
|
+
isMobile: false
|
|
166
|
+
};
|
|
167
|
+
function Plan({
|
|
168
|
+
plan,
|
|
169
|
+
productFeatures,
|
|
170
|
+
toc,
|
|
171
|
+
checked,
|
|
172
|
+
recommend,
|
|
173
|
+
paymentMethods,
|
|
174
|
+
paymentMethod,
|
|
175
|
+
onChangeMethod,
|
|
176
|
+
...rest
|
|
177
|
+
}) {
|
|
178
|
+
const {
|
|
179
|
+
locale,
|
|
180
|
+
t
|
|
181
|
+
} = useLocaleContext();
|
|
182
|
+
const {
|
|
183
|
+
isMobile
|
|
184
|
+
} = useMobile();
|
|
185
|
+
if (toc) {
|
|
186
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
187
|
+
className: "toc",
|
|
188
|
+
available: true,
|
|
189
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
190
|
+
className: "basic-toc",
|
|
191
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
192
|
+
className: "payment-methods",
|
|
193
|
+
component: "div",
|
|
194
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
195
|
+
style: {
|
|
196
|
+
minWidth: 180
|
|
197
|
+
},
|
|
198
|
+
size: "small",
|
|
199
|
+
children: /*#__PURE__*/_jsx(Select, {
|
|
200
|
+
id: "payment-method",
|
|
201
|
+
value: paymentMethod,
|
|
202
|
+
onChange: e => onChangeMethod(e.target.value),
|
|
203
|
+
children: paymentMethods.map(({
|
|
204
|
+
_id,
|
|
205
|
+
currency
|
|
206
|
+
}) => /*#__PURE__*/_jsx(MenuItem, {
|
|
207
|
+
value: _id,
|
|
208
|
+
children: t('common.payWith', {
|
|
209
|
+
currency: currency.displayName[locale] || currency.displayName.en
|
|
210
|
+
})
|
|
211
|
+
}, _id))
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
216
|
+
className: "features toc__title",
|
|
217
|
+
children: (productFeatures || []).map(({
|
|
218
|
+
_id,
|
|
219
|
+
name
|
|
220
|
+
}) => {
|
|
221
|
+
return /*#__PURE__*/_jsx("div", {
|
|
222
|
+
className: "feature",
|
|
223
|
+
children: name[locale]
|
|
224
|
+
}, _id);
|
|
225
|
+
})
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
let features = [];
|
|
230
|
+
try {
|
|
231
|
+
// TODO: Pricing Table: 临时做法
|
|
232
|
+
if (Array.isArray(plan.features) && plan.features.length > 0) {
|
|
233
|
+
features = JSON.parse(plan.features[0].en);
|
|
234
|
+
}
|
|
235
|
+
} catch (error) {
|
|
236
|
+
console.error('parse features failed:', error);
|
|
237
|
+
}
|
|
238
|
+
const providerName = paymentMethods.find(x => x._id === paymentMethod)?.provider.name;
|
|
239
|
+
const content = /*#__PURE__*/_jsxs(Container, {
|
|
240
|
+
checked: checked,
|
|
241
|
+
className: `card-container ${checked ? 'checked' : ''}`,
|
|
242
|
+
available: !!plan.available,
|
|
243
|
+
...rest,
|
|
244
|
+
children: [recommend && /*#__PURE__*/_jsx("div", {
|
|
245
|
+
className: "recommend-tag",
|
|
246
|
+
children: t('common.popular')
|
|
247
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
248
|
+
className: "basic",
|
|
249
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
250
|
+
className: "header",
|
|
251
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
252
|
+
className: "header__title",
|
|
253
|
+
children: t('common.space')
|
|
254
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
255
|
+
className: "header__name",
|
|
256
|
+
children: plan?.name[locale]
|
|
257
|
+
})]
|
|
258
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
259
|
+
className: "price-info",
|
|
260
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
261
|
+
className: "price",
|
|
262
|
+
children: getPrice(plan.prices, providerName)
|
|
263
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
264
|
+
className: "period",
|
|
265
|
+
children: prettyDuration(plan.duration, locale)
|
|
266
|
+
})]
|
|
267
|
+
})]
|
|
268
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
269
|
+
className: "features",
|
|
270
|
+
children: features.map(feature => {
|
|
271
|
+
return /*#__PURE__*/_jsx("div", {
|
|
272
|
+
className: "feature",
|
|
273
|
+
children: /*#__PURE__*/_jsx(Feature, {
|
|
274
|
+
feature: feature,
|
|
275
|
+
locale: locale,
|
|
276
|
+
checked: checked,
|
|
277
|
+
isMobile: isMobile
|
|
278
|
+
})
|
|
279
|
+
}, feature._id);
|
|
280
|
+
})
|
|
281
|
+
})]
|
|
282
|
+
});
|
|
283
|
+
if (plan.available) {
|
|
284
|
+
return content;
|
|
285
|
+
}
|
|
286
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
287
|
+
title: plan.reason,
|
|
288
|
+
style: {
|
|
289
|
+
cursor: 'not-allowed'
|
|
290
|
+
},
|
|
291
|
+
children: content
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
const Container = styled.div`
|
|
295
|
+
display: flex;
|
|
296
|
+
position: relative;
|
|
297
|
+
align-items: center;
|
|
298
|
+
flex-direction: column;
|
|
299
|
+
border-radius: 12px;
|
|
300
|
+
overflow: hidden;
|
|
301
|
+
min-height: 400px;
|
|
302
|
+
white-space: nowrap;
|
|
303
|
+
padding: 16px;
|
|
304
|
+
filter: grayscale(${props => props.available ? 0 : 1});
|
|
305
|
+
opacity: ${props => props.available ? 1 : 0.4};
|
|
306
|
+
|
|
307
|
+
.recommend-tag {
|
|
308
|
+
display: block;
|
|
309
|
+
position: absolute;
|
|
310
|
+
top: 4px;
|
|
311
|
+
right: 32px;
|
|
312
|
+
color: #fff;
|
|
313
|
+
padding: 4px 100px;
|
|
314
|
+
position: absolute;
|
|
315
|
+
transform: translate(50%, 50%) rotate(45deg);
|
|
316
|
+
white-space: nowrap;
|
|
317
|
+
background-color: #fe9344;
|
|
318
|
+
transform-origin: center;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.toc__title {
|
|
322
|
+
font-weight: bolder;
|
|
323
|
+
align-items: flex-start;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&:not(.toc) {
|
|
327
|
+
width: 280px;
|
|
328
|
+
color: #000;
|
|
329
|
+
background-color: #f0fdff;
|
|
330
|
+
cursor: pointer;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
&:not(.toc, .checked):hover {
|
|
334
|
+
color: #000;
|
|
335
|
+
background-color: #ddf6f8;
|
|
336
|
+
cursor: pointer;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&.checked {
|
|
340
|
+
color: #fff;
|
|
341
|
+
background-color: ${props => props.theme.palette.primary.main};
|
|
342
|
+
cursor: pointer;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.basic-toc {
|
|
346
|
+
width: 100%;
|
|
347
|
+
height: 8em;
|
|
348
|
+
display: flex;
|
|
349
|
+
flex-direction: column;
|
|
350
|
+
justify-content: center;
|
|
351
|
+
align-items: flex-start;
|
|
352
|
+
|
|
353
|
+
.payment-methods {
|
|
354
|
+
padding-top: 3em;
|
|
355
|
+
font-size: 1.1em;
|
|
356
|
+
font-weight: bolder;
|
|
357
|
+
|
|
358
|
+
select {
|
|
359
|
+
margin-left: 1em;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.basic {
|
|
365
|
+
width: 100%;
|
|
366
|
+
height: 8em;
|
|
367
|
+
|
|
368
|
+
.header {
|
|
369
|
+
text-align: center;
|
|
370
|
+
.header__title {
|
|
371
|
+
color: ${props => props.checked ? '#ffffff' : '#9397a1'};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.header__name {
|
|
375
|
+
font-weight: bolder;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.price-info {
|
|
380
|
+
display: flex;
|
|
381
|
+
flex-direction: column;
|
|
382
|
+
justify-content: center;
|
|
383
|
+
align-items: center;
|
|
384
|
+
height: 6.5em;
|
|
385
|
+
|
|
386
|
+
.price {
|
|
387
|
+
font-size: 1.5em;
|
|
388
|
+
font-weight: bolder;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.period {
|
|
392
|
+
color: ${props => props.checked ? '#ffffff' : '#9397a1'};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.features {
|
|
398
|
+
display: flex;
|
|
399
|
+
flex-direction: column;
|
|
400
|
+
width: 100%;
|
|
401
|
+
margin-top: auto;
|
|
402
|
+
|
|
403
|
+
.feature {
|
|
404
|
+
display: flex;
|
|
405
|
+
align-items: center;
|
|
406
|
+
justify-content: center;
|
|
407
|
+
height: 48px;
|
|
408
|
+
text-align: center;
|
|
409
|
+
|
|
410
|
+
// 移动端不减小
|
|
411
|
+
@media (max-height: 960px) and (min-width: 640px) {
|
|
412
|
+
height: 36px;
|
|
413
|
+
font-size: 0.9rem;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@media (max-width: 900px) {
|
|
417
|
+
justify-content: flex-start;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
&:not(:last-child) {
|
|
421
|
+
border-bottom: 1px solid;
|
|
422
|
+
border-bottom-color: ${props => props.checked || props.hovered ? 'rgba(255, 255, 255, 0.2)' : '#f6f6f6'};
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
`;
|
|
427
|
+
Plan.propTypes = {
|
|
428
|
+
plan: PropTypes.object.isRequired,
|
|
429
|
+
paymentMethod: PropTypes.string.isRequired,
|
|
430
|
+
paymentMethods: PropTypes.array,
|
|
431
|
+
onChangeMethod: PropTypes.func,
|
|
432
|
+
productFeatures: PropTypes.array,
|
|
433
|
+
checked: PropTypes.bool,
|
|
434
|
+
recommend: PropTypes.bool,
|
|
435
|
+
toc: PropTypes.bool
|
|
436
|
+
};
|
|
437
|
+
Plan.defaultProps = {
|
|
438
|
+
paymentMethods: [],
|
|
439
|
+
productFeatures: [],
|
|
440
|
+
onChangeMethod: noop,
|
|
441
|
+
checked: false,
|
|
442
|
+
recommend: false,
|
|
443
|
+
toc: false
|
|
444
|
+
};
|
|
445
|
+
export default Plan;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import get from 'lodash.get';
|
|
5
|
+
import joinUrl from 'url-join';
|
|
6
|
+
import { useSessionContext } from './session';
|
|
7
|
+
import { useLocaleContext } from './locale';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
axios.defaults.timeout = 200000;
|
|
10
|
+
const RequestContext = /*#__PURE__*/createContext();
|
|
11
|
+
const {
|
|
12
|
+
Provider
|
|
13
|
+
} = RequestContext;
|
|
14
|
+
export function RequestProvider({
|
|
15
|
+
baseURL,
|
|
16
|
+
children
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
session
|
|
20
|
+
} = useSessionContext();
|
|
21
|
+
const {
|
|
22
|
+
locale
|
|
23
|
+
} = useLocaleContext();
|
|
24
|
+
const configRequest = r => {
|
|
25
|
+
r.interceptors.request.use(config => {
|
|
26
|
+
config.url = joinUrl('/api', config.url);
|
|
27
|
+
if (!config.params) {
|
|
28
|
+
config.params = {};
|
|
29
|
+
}
|
|
30
|
+
// Check if `locale` doesn't exist in search params before adding it
|
|
31
|
+
const searchParams = new URLSearchParams(config.url.split('?')[1]);
|
|
32
|
+
if (!searchParams.has('locale')) {
|
|
33
|
+
config.params.locale = locale;
|
|
34
|
+
}
|
|
35
|
+
return config;
|
|
36
|
+
});
|
|
37
|
+
r.interceptors.response.use(response => response, err => {
|
|
38
|
+
if (get(err, 'response.status') === 401) {
|
|
39
|
+
session.login();
|
|
40
|
+
}
|
|
41
|
+
return Promise.reject(err);
|
|
42
|
+
});
|
|
43
|
+
return r;
|
|
44
|
+
};
|
|
45
|
+
const request = axios.create({
|
|
46
|
+
baseURL
|
|
47
|
+
});
|
|
48
|
+
const create = configs => configRequest(axios.create({
|
|
49
|
+
baseURL,
|
|
50
|
+
...(configs || {})
|
|
51
|
+
}));
|
|
52
|
+
return /*#__PURE__*/_jsx(Provider, {
|
|
53
|
+
value: {
|
|
54
|
+
api: configRequest(request),
|
|
55
|
+
create
|
|
56
|
+
},
|
|
57
|
+
children: children
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
RequestProvider.propTypes = {
|
|
61
|
+
baseURL: PropTypes.string,
|
|
62
|
+
children: PropTypes.any.isRequired
|
|
63
|
+
};
|
|
64
|
+
RequestProvider.defaultProps = {
|
|
65
|
+
baseURL: '/'
|
|
66
|
+
};
|
|
67
|
+
RequestProvider.defaultProps = {};
|
|
68
|
+
export default function useRequest() {
|
|
69
|
+
const value = useContext(RequestContext);
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { createAuthServiceSessionContext } from '@arcblock/did-connect/lib/Session';
|
|
3
|
+
const {
|
|
4
|
+
SessionProvider,
|
|
5
|
+
SessionContext,
|
|
6
|
+
SessionConsumer,
|
|
7
|
+
withSession
|
|
8
|
+
} = createAuthServiceSessionContext();
|
|
9
|
+
function useSessionContext() {
|
|
10
|
+
const info = useContext(SessionContext);
|
|
11
|
+
return info;
|
|
12
|
+
}
|
|
13
|
+
export { SessionProvider, SessionContext, SessionConsumer, useSessionContext, withSession };
|