@blocklet/launcher-ux 2.3.48 → 2.3.50
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.
|
@@ -93,6 +93,10 @@ function Component({
|
|
|
93
93
|
minStakeAmount,
|
|
94
94
|
isResume
|
|
95
95
|
}) {
|
|
96
|
+
const theme = useTheme();
|
|
97
|
+
const {
|
|
98
|
+
isMobile
|
|
99
|
+
} = useMobile();
|
|
96
100
|
const {
|
|
97
101
|
getCurrency,
|
|
98
102
|
getMethod
|
|
@@ -101,16 +105,9 @@ function Component({
|
|
|
101
105
|
unitPrice: '',
|
|
102
106
|
totalPrice: '',
|
|
103
107
|
minStakeAmount: '',
|
|
104
|
-
shouldStake: true
|
|
108
|
+
shouldStake: true,
|
|
109
|
+
freeTrial: null
|
|
105
110
|
});
|
|
106
|
-
const {
|
|
107
|
-
isMobile
|
|
108
|
-
} = useMobile();
|
|
109
|
-
const theme = useTheme();
|
|
110
|
-
const {
|
|
111
|
-
isFreeTrial,
|
|
112
|
-
duration: freeTrialDurationSeconds
|
|
113
|
-
} = getProductFreeTrial('serverless', freeTrialProducts);
|
|
114
111
|
const minimumWidth = useMediaQuery(theme.breakpoints.down(540));
|
|
115
112
|
const components = (tempComponents || []).reduce((acc, x) => {
|
|
116
113
|
if (acc.findIndex(y => y.did === x.did) === -1) {
|
|
@@ -164,11 +161,17 @@ function Component({
|
|
|
164
161
|
let unitPrice = formatPrice(price, currency, UNIT_LABEL_PLACEHOLDER, 1, true, locale);
|
|
165
162
|
unitPrice = unitPrice?.replace(new RegExp(`${UNIT_LABEL_PLACEHOLDER}\\s+\\/*`), '');
|
|
166
163
|
const paymentMethod = getMethod(paymentMethodId);
|
|
164
|
+
const freeTrial = getProductFreeTrial({
|
|
165
|
+
typeName: 'serverless',
|
|
166
|
+
freeTrialProducts,
|
|
167
|
+
currencyId: currency.id
|
|
168
|
+
});
|
|
167
169
|
setState({
|
|
168
170
|
unitPrice,
|
|
169
171
|
totalPrice,
|
|
170
172
|
minStakeAmount: `${minStakeAmount} ${currency.symbol}`,
|
|
171
|
-
shouldStake: paymentMethod?.type === 'arcblock'
|
|
173
|
+
shouldStake: paymentMethod?.type === 'arcblock',
|
|
174
|
+
freeTrial
|
|
172
175
|
});
|
|
173
176
|
} catch (error) {
|
|
174
177
|
console.error('calculate failed error', error);
|
|
@@ -181,7 +184,7 @@ function Component({
|
|
|
181
184
|
width: '100%',
|
|
182
185
|
height: '100%'
|
|
183
186
|
},
|
|
184
|
-
children: [
|
|
187
|
+
children: [state.freeTrial && /*#__PURE__*/_jsx(Box, {
|
|
185
188
|
sx: {
|
|
186
189
|
display: 'flex',
|
|
187
190
|
justifyContent: 'flex-start'
|
|
@@ -189,7 +192,7 @@ function Component({
|
|
|
189
192
|
children: /*#__PURE__*/_jsx(Chip, {
|
|
190
193
|
icon: /*#__PURE__*/_jsx(RocketLaunchIcon, {}),
|
|
191
194
|
label: t('checkout.freeTrialHint', {
|
|
192
|
-
duration: prettyMs(
|
|
195
|
+
duration: prettyMs(state.freeTrial.duration * 1000, {
|
|
193
196
|
locale: locale === 'zh' ? 'zh_CN' : 'en_US',
|
|
194
197
|
compact: true,
|
|
195
198
|
verbose: true,
|
|
@@ -336,10 +339,10 @@ function Component({
|
|
|
336
339
|
value: state.minStakeAmount,
|
|
337
340
|
highlight: false
|
|
338
341
|
}, {
|
|
339
|
-
label: isFreeTrial ? t('checkout.estimatedCostFreeTrial') : t('checkout.estimatedCost'),
|
|
342
|
+
label: state.isFreeTrial ? t('checkout.estimatedCostFreeTrial') : t('checkout.estimatedCost'),
|
|
340
343
|
value: state.totalPrice,
|
|
341
344
|
hint: t('checkout.estimatedCostHint'),
|
|
342
|
-
highlight: isFreeTrial
|
|
345
|
+
highlight: state.isFreeTrial
|
|
343
346
|
}].map(item => {
|
|
344
347
|
if (!item) {
|
|
345
348
|
return null;
|
|
@@ -422,19 +425,29 @@ function Component({
|
|
|
422
425
|
width: '100%',
|
|
423
426
|
'& .cko-container': {
|
|
424
427
|
minWidth: '100% !important',
|
|
425
|
-
maxWidth: '100% !important'
|
|
428
|
+
maxWidth: '100% !important',
|
|
429
|
+
'&>div': {
|
|
430
|
+
padding: 0
|
|
431
|
+
}
|
|
426
432
|
},
|
|
427
433
|
'& .cko-payment': {
|
|
428
|
-
gap: '24px'
|
|
434
|
+
gap: '24px',
|
|
435
|
+
'&>hr': {
|
|
436
|
+
display: 'none'
|
|
437
|
+
}
|
|
429
438
|
},
|
|
430
439
|
'& .cko-payment-contact': {
|
|
431
440
|
gap: '12px',
|
|
432
|
-
|
|
441
|
+
lineHeight: '1.5rem',
|
|
442
|
+
'&>*': {
|
|
433
443
|
marginBottom: 0
|
|
444
|
+
},
|
|
445
|
+
'&>p': {
|
|
446
|
+
fontSize: '1rem'
|
|
434
447
|
}
|
|
435
448
|
},
|
|
436
449
|
'& .cko-payment-form': {
|
|
437
|
-
|
|
450
|
+
gap: '12px'
|
|
438
451
|
},
|
|
439
452
|
'& .cko-payment-methods': {
|
|
440
453
|
gap: '12px',
|
|
@@ -455,7 +468,7 @@ function Component({
|
|
|
455
468
|
mode: "inline-minimal",
|
|
456
469
|
onPaid: handlePaid,
|
|
457
470
|
onChange: handleChange,
|
|
458
|
-
|
|
471
|
+
theme: "inherit"
|
|
459
472
|
})
|
|
460
473
|
})]
|
|
461
474
|
})]
|
|
@@ -106,6 +106,10 @@ function Component(_ref2) {
|
|
|
106
106
|
minStakeAmount,
|
|
107
107
|
isResume
|
|
108
108
|
} = _ref2;
|
|
109
|
+
const theme = (0, _styles.useTheme)();
|
|
110
|
+
const {
|
|
111
|
+
isMobile
|
|
112
|
+
} = (0, _useMobile.default)();
|
|
109
113
|
const {
|
|
110
114
|
getCurrency,
|
|
111
115
|
getMethod
|
|
@@ -114,16 +118,9 @@ function Component(_ref2) {
|
|
|
114
118
|
unitPrice: '',
|
|
115
119
|
totalPrice: '',
|
|
116
120
|
minStakeAmount: '',
|
|
117
|
-
shouldStake: true
|
|
121
|
+
shouldStake: true,
|
|
122
|
+
freeTrial: null
|
|
118
123
|
});
|
|
119
|
-
const {
|
|
120
|
-
isMobile
|
|
121
|
-
} = (0, _useMobile.default)();
|
|
122
|
-
const theme = (0, _styles.useTheme)();
|
|
123
|
-
const {
|
|
124
|
-
isFreeTrial,
|
|
125
|
-
duration: freeTrialDurationSeconds
|
|
126
|
-
} = (0, _util.getProductFreeTrial)('serverless', freeTrialProducts);
|
|
127
124
|
const minimumWidth = (0, _useMediaQuery.default)(theme.breakpoints.down(540));
|
|
128
125
|
const components = (tempComponents || []).reduce((acc, x) => {
|
|
129
126
|
if (acc.findIndex(y => y.did === x.did) === -1) {
|
|
@@ -179,11 +176,17 @@ function Component(_ref2) {
|
|
|
179
176
|
let unitPrice = (0, _paymentReact.formatPrice)(price, currency, UNIT_LABEL_PLACEHOLDER, 1, true, locale);
|
|
180
177
|
unitPrice = (_unitPrice = unitPrice) === null || _unitPrice === void 0 ? void 0 : _unitPrice.replace(new RegExp("".concat(UNIT_LABEL_PLACEHOLDER, "\\s+\\/*")), '');
|
|
181
178
|
const paymentMethod = getMethod(paymentMethodId);
|
|
179
|
+
const freeTrial = (0, _util.getProductFreeTrial)({
|
|
180
|
+
typeName: 'serverless',
|
|
181
|
+
freeTrialProducts,
|
|
182
|
+
currencyId: currency.id
|
|
183
|
+
});
|
|
182
184
|
setState({
|
|
183
185
|
unitPrice,
|
|
184
186
|
totalPrice,
|
|
185
187
|
minStakeAmount: "".concat(minStakeAmount, " ").concat(currency.symbol),
|
|
186
|
-
shouldStake: (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.type) === 'arcblock'
|
|
188
|
+
shouldStake: (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.type) === 'arcblock',
|
|
189
|
+
freeTrial
|
|
187
190
|
});
|
|
188
191
|
} catch (error) {
|
|
189
192
|
console.error('calculate failed error', error);
|
|
@@ -196,7 +199,7 @@ function Component(_ref2) {
|
|
|
196
199
|
width: '100%',
|
|
197
200
|
height: '100%'
|
|
198
201
|
},
|
|
199
|
-
children: [
|
|
202
|
+
children: [state.freeTrial && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
200
203
|
sx: {
|
|
201
204
|
display: 'flex',
|
|
202
205
|
justifyContent: 'flex-start'
|
|
@@ -204,7 +207,7 @@ function Component(_ref2) {
|
|
|
204
207
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
|
|
205
208
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RocketLaunch.default, {}),
|
|
206
209
|
label: t('checkout.freeTrialHint', {
|
|
207
|
-
duration: (0, _prettyMsI18n.default)(
|
|
210
|
+
duration: (0, _prettyMsI18n.default)(state.freeTrial.duration * 1000, {
|
|
208
211
|
locale: locale === 'zh' ? 'zh_CN' : 'en_US',
|
|
209
212
|
compact: true,
|
|
210
213
|
verbose: true,
|
|
@@ -352,10 +355,10 @@ function Component(_ref2) {
|
|
|
352
355
|
value: state.minStakeAmount,
|
|
353
356
|
highlight: false
|
|
354
357
|
}, {
|
|
355
|
-
label: isFreeTrial ? t('checkout.estimatedCostFreeTrial') : t('checkout.estimatedCost'),
|
|
358
|
+
label: state.isFreeTrial ? t('checkout.estimatedCostFreeTrial') : t('checkout.estimatedCost'),
|
|
356
359
|
value: state.totalPrice,
|
|
357
360
|
hint: t('checkout.estimatedCostHint'),
|
|
358
|
-
highlight: isFreeTrial
|
|
361
|
+
highlight: state.isFreeTrial
|
|
359
362
|
}].map(item => {
|
|
360
363
|
if (!item) {
|
|
361
364
|
return null;
|
|
@@ -438,19 +441,29 @@ function Component(_ref2) {
|
|
|
438
441
|
width: '100%',
|
|
439
442
|
'& .cko-container': {
|
|
440
443
|
minWidth: '100% !important',
|
|
441
|
-
maxWidth: '100% !important'
|
|
444
|
+
maxWidth: '100% !important',
|
|
445
|
+
'&>div': {
|
|
446
|
+
padding: 0
|
|
447
|
+
}
|
|
442
448
|
},
|
|
443
449
|
'& .cko-payment': {
|
|
444
|
-
gap: '24px'
|
|
450
|
+
gap: '24px',
|
|
451
|
+
'&>hr': {
|
|
452
|
+
display: 'none'
|
|
453
|
+
}
|
|
445
454
|
},
|
|
446
455
|
'& .cko-payment-contact': {
|
|
447
456
|
gap: '12px',
|
|
448
|
-
|
|
457
|
+
lineHeight: '1.5rem',
|
|
458
|
+
'&>*': {
|
|
449
459
|
marginBottom: 0
|
|
460
|
+
},
|
|
461
|
+
'&>p': {
|
|
462
|
+
fontSize: '1rem'
|
|
450
463
|
}
|
|
451
464
|
},
|
|
452
465
|
'& .cko-payment-form': {
|
|
453
|
-
|
|
466
|
+
gap: '12px'
|
|
454
467
|
},
|
|
455
468
|
'& .cko-payment-methods': {
|
|
456
469
|
gap: '12px',
|
|
@@ -471,7 +484,7 @@ function Component(_ref2) {
|
|
|
471
484
|
mode: "inline-minimal",
|
|
472
485
|
onPaid: handlePaid,
|
|
473
486
|
onChange: handleChange,
|
|
474
|
-
|
|
487
|
+
theme: "inherit"
|
|
475
488
|
})
|
|
476
489
|
})]
|
|
477
490
|
})]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/launcher-ux",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.50",
|
|
4
4
|
"description": "Launcher UX lib",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/cli": "^7.24.8",
|
|
48
48
|
"@babel/core": "^7.25.2",
|
|
49
|
-
"@babel/preset-env": "^7.25.
|
|
49
|
+
"@babel/preset-env": "^7.25.4",
|
|
50
50
|
"@babel/preset-react": "^7.24.7",
|
|
51
51
|
"@storybook/react": "^6.5.16",
|
|
52
52
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
53
53
|
"glob": "^10.4.5"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@arcblock/ux": "^2.10.
|
|
57
|
-
"@blocklet/launcher-util": "2.3.
|
|
58
|
-
"@blocklet/payment-react": "1.14.
|
|
56
|
+
"@arcblock/ux": "^2.10.23",
|
|
57
|
+
"@blocklet/launcher-util": "2.3.50",
|
|
58
|
+
"@blocklet/payment-react": "^1.14.34",
|
|
59
59
|
"@emotion/styled": "^11.13.0",
|
|
60
60
|
"@mui/icons-material": "^5.16.7",
|
|
61
61
|
"@mui/material": "^5.16.7",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"require": "./lib/use-mobile/index.js"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "1fce965a3faefe5ed5bf0f98f04b6daaaa6437b1"
|
|
97
97
|
}
|