@blocklet/payment-react 1.25.10 → 1.26.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/checkout-v2/checkout-v2.d.ts +2 -0
- package/es/checkout-v2/checkout-v2.js +121 -0
- package/es/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
- package/es/checkout-v2/components/dialogs/checkout-dialogs.js +106 -0
- package/es/checkout-v2/components/left/billing-toggle.d.ts +6 -0
- package/es/checkout-v2/components/left/billing-toggle.js +118 -0
- package/es/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
- package/es/checkout-v2/components/left/cross-sell-card.js +167 -0
- package/es/checkout-v2/components/left/product-item-card.d.ts +26 -0
- package/es/checkout-v2/components/left/product-item-card.js +571 -0
- package/es/checkout-v2/components/left/promotion-input.d.ts +19 -0
- package/es/checkout-v2/components/left/promotion-input.js +178 -0
- package/es/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
- package/es/checkout-v2/components/left/staking-breakdown.js +48 -0
- package/es/checkout-v2/components/left/trial-info.d.ts +13 -0
- package/es/checkout-v2/components/left/trial-info.js +48 -0
- package/es/checkout-v2/components/right/currency-grid.d.ts +8 -0
- package/es/checkout-v2/components/right/currency-grid.js +48 -0
- package/es/checkout-v2/components/right/customer-info-card.d.ts +17 -0
- package/es/checkout-v2/components/right/customer-info-card.js +156 -0
- package/es/checkout-v2/components/right/status-feedback.d.ts +7 -0
- package/es/checkout-v2/components/right/status-feedback.js +17 -0
- package/es/checkout-v2/components/right/submit-button.d.ts +10 -0
- package/es/checkout-v2/components/right/submit-button.js +29 -0
- package/es/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
- package/es/checkout-v2/components/right/subscription-disclaimer.js +8 -0
- package/es/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
- package/es/checkout-v2/components/shared/exchange-rate-footer.js +182 -0
- package/es/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
- package/es/checkout-v2/components/shared/scenario-badge.js +47 -0
- package/es/checkout-v2/components/shared/total-display.d.ts +7 -0
- package/es/checkout-v2/components/shared/total-display.js +84 -0
- package/es/checkout-v2/index.d.ts +2 -0
- package/es/checkout-v2/index.js +1 -0
- package/es/checkout-v2/layouts/checkout-layout.d.ts +7 -0
- package/es/checkout-v2/layouts/checkout-layout.js +226 -0
- package/es/checkout-v2/panels/left/composite-panel.d.ts +1 -0
- package/es/checkout-v2/panels/left/composite-panel.js +423 -0
- package/es/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
- package/es/checkout-v2/panels/left/credit-topup-panel.js +615 -0
- package/es/checkout-v2/panels/left/scenario-router.d.ts +1 -0
- package/es/checkout-v2/panels/left/scenario-router.js +19 -0
- package/es/checkout-v2/panels/right/payment-panel.d.ts +1 -0
- package/es/checkout-v2/panels/right/payment-panel.js +644 -0
- package/es/checkout-v2/types.d.ts +15 -0
- package/es/checkout-v2/types.js +0 -0
- package/es/checkout-v2/utils/format.d.ts +59 -0
- package/es/checkout-v2/utils/format.js +125 -0
- package/es/checkout-v2/utils/scenario-detector.d.ts +3 -0
- package/es/checkout-v2/utils/scenario-detector.js +17 -0
- package/es/checkout-v2/views/error-view.d.ts +7 -0
- package/es/checkout-v2/views/error-view.js +269 -0
- package/es/checkout-v2/views/loading-view.d.ts +5 -0
- package/es/checkout-v2/views/loading-view.js +158 -0
- package/es/checkout-v2/views/success-view.d.ts +29 -0
- package/es/checkout-v2/views/success-view.js +614 -0
- package/es/components/phone-field.d.ts +14 -0
- package/es/components/phone-field.js +96 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/locales/en.js +45 -6
- package/es/locales/zh.js +45 -6
- package/es/payment/form/index.js +10 -1
- package/lib/checkout-v2/checkout-v2.d.ts +2 -0
- package/lib/checkout-v2/checkout-v2.js +151 -0
- package/lib/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
- package/lib/checkout-v2/components/dialogs/checkout-dialogs.js +131 -0
- package/lib/checkout-v2/components/left/billing-toggle.d.ts +6 -0
- package/lib/checkout-v2/components/left/billing-toggle.js +126 -0
- package/lib/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
- package/lib/checkout-v2/components/left/cross-sell-card.js +257 -0
- package/lib/checkout-v2/components/left/product-item-card.d.ts +26 -0
- package/lib/checkout-v2/components/left/product-item-card.js +738 -0
- package/lib/checkout-v2/components/left/promotion-input.d.ts +19 -0
- package/lib/checkout-v2/components/left/promotion-input.js +220 -0
- package/lib/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
- package/lib/checkout-v2/components/left/staking-breakdown.js +96 -0
- package/lib/checkout-v2/components/left/trial-info.d.ts +13 -0
- package/lib/checkout-v2/components/left/trial-info.js +82 -0
- package/lib/checkout-v2/components/right/currency-grid.d.ts +8 -0
- package/lib/checkout-v2/components/right/currency-grid.js +96 -0
- package/lib/checkout-v2/components/right/customer-info-card.d.ts +17 -0
- package/lib/checkout-v2/components/right/customer-info-card.js +246 -0
- package/lib/checkout-v2/components/right/status-feedback.d.ts +7 -0
- package/lib/checkout-v2/components/right/status-feedback.js +30 -0
- package/lib/checkout-v2/components/right/submit-button.d.ts +10 -0
- package/lib/checkout-v2/components/right/submit-button.js +35 -0
- package/lib/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
- package/lib/checkout-v2/components/right/subscription-disclaimer.js +33 -0
- package/lib/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
- package/lib/checkout-v2/components/shared/exchange-rate-footer.js +282 -0
- package/lib/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
- package/lib/checkout-v2/components/shared/scenario-badge.js +57 -0
- package/lib/checkout-v2/components/shared/total-display.d.ts +7 -0
- package/lib/checkout-v2/components/shared/total-display.js +154 -0
- package/lib/checkout-v2/index.d.ts +2 -0
- package/lib/checkout-v2/index.js +13 -0
- package/lib/checkout-v2/layouts/checkout-layout.d.ts +7 -0
- package/lib/checkout-v2/layouts/checkout-layout.js +308 -0
- package/lib/checkout-v2/panels/left/composite-panel.d.ts +1 -0
- package/lib/checkout-v2/panels/left/composite-panel.js +515 -0
- package/lib/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
- package/lib/checkout-v2/panels/left/credit-topup-panel.js +799 -0
- package/lib/checkout-v2/panels/left/scenario-router.d.ts +1 -0
- package/lib/checkout-v2/panels/left/scenario-router.js +29 -0
- package/lib/checkout-v2/panels/right/payment-panel.d.ts +1 -0
- package/lib/checkout-v2/panels/right/payment-panel.js +906 -0
- package/lib/checkout-v2/types.d.ts +15 -0
- package/lib/checkout-v2/types.js +1 -0
- package/lib/checkout-v2/utils/format.d.ts +59 -0
- package/lib/checkout-v2/utils/format.js +158 -0
- package/lib/checkout-v2/utils/scenario-detector.d.ts +3 -0
- package/lib/checkout-v2/utils/scenario-detector.js +23 -0
- package/lib/checkout-v2/views/error-view.d.ts +7 -0
- package/lib/checkout-v2/views/error-view.js +321 -0
- package/lib/checkout-v2/views/loading-view.d.ts +5 -0
- package/lib/checkout-v2/views/loading-view.js +168 -0
- package/lib/checkout-v2/views/success-view.d.ts +29 -0
- package/lib/checkout-v2/views/success-view.js +735 -0
- package/lib/components/phone-field.d.ts +14 -0
- package/lib/components/phone-field.js +130 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.js +8 -0
- package/lib/locales/en.js +45 -6
- package/lib/locales/zh.js +45 -6
- package/lib/payment/form/index.js +10 -1
- package/package.json +4 -3
- package/src/checkout-v2/checkout-v2.tsx +155 -0
- package/src/checkout-v2/components/dialogs/checkout-dialogs.tsx +134 -0
- package/src/checkout-v2/components/left/billing-toggle.tsx +122 -0
- package/src/checkout-v2/components/left/cross-sell-card.tsx +170 -0
- package/src/checkout-v2/components/left/product-item-card.tsx +634 -0
- package/src/checkout-v2/components/left/promotion-input.tsx +207 -0
- package/src/checkout-v2/components/left/staking-breakdown.tsx +57 -0
- package/src/checkout-v2/components/left/trial-info.tsx +63 -0
- package/src/checkout-v2/components/right/currency-grid.tsx +59 -0
- package/src/checkout-v2/components/right/customer-info-card.tsx +214 -0
- package/src/checkout-v2/components/right/status-feedback.tsx +35 -0
- package/src/checkout-v2/components/right/submit-button.tsx +37 -0
- package/src/checkout-v2/components/right/subscription-disclaimer.tsx +27 -0
- package/src/checkout-v2/components/shared/exchange-rate-footer.tsx +221 -0
- package/src/checkout-v2/components/shared/scenario-badge.tsx +51 -0
- package/src/checkout-v2/components/shared/total-display.tsx +112 -0
- package/src/checkout-v2/index.ts +2 -0
- package/src/checkout-v2/layouts/checkout-layout.tsx +232 -0
- package/src/checkout-v2/panels/left/composite-panel.tsx +465 -0
- package/src/checkout-v2/panels/left/credit-topup-panel.tsx +681 -0
- package/src/checkout-v2/panels/left/scenario-router.tsx +22 -0
- package/src/checkout-v2/panels/right/payment-panel.tsx +703 -0
- package/src/checkout-v2/types.ts +18 -0
- package/src/checkout-v2/utils/format.ts +204 -0
- package/src/checkout-v2/utils/scenario-detector.ts +30 -0
- package/src/checkout-v2/views/error-view.tsx +293 -0
- package/src/checkout-v2/views/loading-view.tsx +162 -0
- package/src/checkout-v2/views/success-view.tsx +770 -0
- package/src/components/phone-field.tsx +119 -0
- package/src/index.ts +3 -0
- package/src/locales/en.tsx +45 -4
- package/src/locales/zh.tsx +43 -4
- package/src/payment/form/index.tsx +16 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { alpha, useTheme } from '@mui/material/styles';
|
|
3
|
+
import Header from '@blocklet/ui-react/lib/Header';
|
|
4
|
+
|
|
5
|
+
interface LoadingViewProps {
|
|
6
|
+
mode?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Pulsing dots — minimal loading indicator
|
|
10
|
+
function PulsingDots() {
|
|
11
|
+
return (
|
|
12
|
+
<Box sx={{ display: 'flex', gap: 2, mt: 4 }}>
|
|
13
|
+
{[0, 1, 2].map((i) => (
|
|
14
|
+
<Box
|
|
15
|
+
key={i}
|
|
16
|
+
sx={{
|
|
17
|
+
width: 12,
|
|
18
|
+
height: 12,
|
|
19
|
+
borderRadius: '50%',
|
|
20
|
+
bgcolor: 'primary.main',
|
|
21
|
+
opacity: 0.4,
|
|
22
|
+
animation: `pulse 1.4s ease-in-out ${i * 0.2}s infinite`,
|
|
23
|
+
'@keyframes pulse': {
|
|
24
|
+
'0%, 80%, 100%': { transform: 'scale(0.6)', opacity: 0.3 },
|
|
25
|
+
'40%': { transform: 'scale(1)', opacity: 0.7 },
|
|
26
|
+
},
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
))}
|
|
30
|
+
</Box>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Reuse the same blob decoration as error-view (without wireframe mesh for simplicity)
|
|
35
|
+
function LoadingDecoration() {
|
|
36
|
+
return (
|
|
37
|
+
<Box
|
|
38
|
+
sx={{
|
|
39
|
+
position: 'relative',
|
|
40
|
+
width: { xs: 160, md: 200 },
|
|
41
|
+
height: { xs: 160, md: 200 },
|
|
42
|
+
}}>
|
|
43
|
+
<Box
|
|
44
|
+
sx={{
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
inset: 0,
|
|
47
|
+
borderRadius: '38% 62% 63% 37% / 41% 44% 56% 59%',
|
|
48
|
+
background: (t) =>
|
|
49
|
+
`linear-gradient(45deg, ${alpha(t.palette.primary.main, 0.1)}, ${alpha(t.palette.primary.main, 0.03)})`,
|
|
50
|
+
filter: 'blur(1px)',
|
|
51
|
+
animation: 'spin 20s linear infinite',
|
|
52
|
+
'@keyframes spin': { from: { transform: 'rotate(0deg)' }, to: { transform: 'rotate(360deg)' } },
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
<Box
|
|
56
|
+
sx={{
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
inset: 0,
|
|
59
|
+
borderRadius: '38% 62% 63% 37% / 41% 44% 56% 59%',
|
|
60
|
+
background: (t) =>
|
|
61
|
+
`linear-gradient(135deg, ${alpha(t.palette.primary.main, 0.07)}, ${alpha(t.palette.primary.main, 0.01)})`,
|
|
62
|
+
filter: 'blur(1px)',
|
|
63
|
+
transform: 'scale(0.88)',
|
|
64
|
+
opacity: 0.6,
|
|
65
|
+
animation: 'spinReverse 15s linear infinite',
|
|
66
|
+
'@keyframes spinReverse': {
|
|
67
|
+
from: { transform: 'scale(0.88) rotate(0deg)' },
|
|
68
|
+
to: { transform: 'scale(0.88) rotate(-360deg)' },
|
|
69
|
+
},
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
</Box>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default function LoadingView({ mode = 'inline' }: LoadingViewProps) {
|
|
77
|
+
const isFullScreen = mode === 'standalone';
|
|
78
|
+
const theme = useTheme();
|
|
79
|
+
const primaryColor = theme.palette.primary.main;
|
|
80
|
+
|
|
81
|
+
// Shared background — must match checkout-layout parent exactly
|
|
82
|
+
const bgSx = {
|
|
83
|
+
background: {
|
|
84
|
+
xs: 'none',
|
|
85
|
+
md: `linear-gradient(160deg, ${alpha(primaryColor, 0.03)} 0%, ${alpha(primaryColor, 0.07)} 50%, ${alpha(primaryColor, 0.04)} 100%)`,
|
|
86
|
+
},
|
|
87
|
+
bgcolor: (t: any) => (t.palette.mode === 'dark' ? 'background.default' : '#f8faff'),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Centered content
|
|
91
|
+
const centerContent = (
|
|
92
|
+
<Box
|
|
93
|
+
sx={{
|
|
94
|
+
display: 'flex',
|
|
95
|
+
flexDirection: 'column',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
flex: 1,
|
|
99
|
+
}}>
|
|
100
|
+
<LoadingDecoration />
|
|
101
|
+
<PulsingDots />
|
|
102
|
+
</Box>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
if (!isFullScreen) {
|
|
106
|
+
return (
|
|
107
|
+
<Box
|
|
108
|
+
sx={{
|
|
109
|
+
display: 'flex',
|
|
110
|
+
width: '100%',
|
|
111
|
+
minHeight: { xs: 400, md: 640 },
|
|
112
|
+
maxWidth: 1120,
|
|
113
|
+
mx: 'auto',
|
|
114
|
+
borderRadius: '16px',
|
|
115
|
+
overflow: 'hidden',
|
|
116
|
+
boxShadow: 1,
|
|
117
|
+
border: 1,
|
|
118
|
+
borderColor: 'divider',
|
|
119
|
+
borderLeft: '4px solid',
|
|
120
|
+
borderLeftColor: 'primary.main',
|
|
121
|
+
...bgSx,
|
|
122
|
+
}}>
|
|
123
|
+
{centerContent}
|
|
124
|
+
</Box>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Standalone (full-screen) mode
|
|
129
|
+
return (
|
|
130
|
+
<Box
|
|
131
|
+
sx={{
|
|
132
|
+
width: '100%',
|
|
133
|
+
height: '100vh',
|
|
134
|
+
minHeight: '100vh',
|
|
135
|
+
display: 'flex',
|
|
136
|
+
flexDirection: 'column',
|
|
137
|
+
position: 'relative',
|
|
138
|
+
overflow: 'hidden',
|
|
139
|
+
...bgSx,
|
|
140
|
+
}}>
|
|
141
|
+
{/* Header */}
|
|
142
|
+
<Header
|
|
143
|
+
sx={{
|
|
144
|
+
position: 'absolute',
|
|
145
|
+
top: 20,
|
|
146
|
+
left: 0,
|
|
147
|
+
right: 0,
|
|
148
|
+
zIndex: 10,
|
|
149
|
+
background: 'transparent',
|
|
150
|
+
'& .header-container': { height: 'auto' },
|
|
151
|
+
}}
|
|
152
|
+
hideNavMenu
|
|
153
|
+
brand={null}
|
|
154
|
+
description={null}
|
|
155
|
+
addons={(buildIns: any) =>
|
|
156
|
+
buildIns.filter((addon: any) => ['locale-selector', 'theme-mode-toggle', 'session-user'].includes(addon.key))
|
|
157
|
+
}
|
|
158
|
+
/>
|
|
159
|
+
{centerContent}
|
|
160
|
+
</Box>
|
|
161
|
+
);
|
|
162
|
+
}
|