payment-kit 1.13.45 → 1.13.47
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/api/dev.ts +1 -1
- package/api/src/libs/session.ts +1 -1
- package/api/src/routes/prices.ts +21 -18
- package/api/src/routes/pricing-table.ts +3 -1
- package/blocklet.yml +1 -1
- package/package.json +20 -20
- package/src/components/checkout/form/index.tsx +17 -14
- package/src/components/checkout/form/user-buttons.tsx +24 -0
- package/src/components/checkout/header.tsx +22 -5
- package/src/components/checkout/pay.tsx +50 -11
- package/src/components/checkout/product-item.tsx +7 -7
- package/src/components/checkout/summary.tsx +17 -4
- package/src/components/livemode.tsx +1 -1
- package/src/components/portal/invoice/list.tsx +16 -6
- package/src/components/portal/subscription/list.tsx +9 -1
- package/src/components/product/cross-sell-select.tsx +2 -2
- package/src/components/product/cross-sell.tsx +2 -1
- package/src/components/section/header.tsx +2 -0
- package/src/components/status.tsx +1 -1
- package/src/libs/util.ts +52 -31
- package/src/locales/en.tsx +36 -11
- package/src/locales/index.tsx +25 -0
- package/src/locales/zh.tsx +33 -9
- package/src/pages/admin/payments/links/detail.tsx +2 -1
- package/src/pages/admin/products/prices/detail.tsx +11 -3
- package/src/pages/admin/products/prices/list.tsx +4 -2
- package/src/pages/admin/products/pricing-tables/detail.tsx +2 -1
- package/src/pages/admin/products/products/create.tsx +2 -2
- package/src/pages/admin/products/products/detail.tsx +2 -2
- package/src/pages/admin/products/products/index.tsx +2 -2
- package/src/pages/checkout/pricing-table.tsx +66 -16
|
@@ -58,7 +58,7 @@ const groupItemsByRecurring = (items: TPricingTableItem[]) => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
export default function PricingTable({ id }: Props) {
|
|
61
|
-
const { t } = useLocaleContext();
|
|
61
|
+
const { t, locale } = useLocaleContext();
|
|
62
62
|
const [params] = useSearchParams();
|
|
63
63
|
const { error, loading, data } = useRequest(() => fetchData(id));
|
|
64
64
|
const [state, setState] = useSetState({ interval: '', loading: '' });
|
|
@@ -77,18 +77,32 @@ export default function PricingTable({ id }: Props) {
|
|
|
77
77
|
|
|
78
78
|
if (error) {
|
|
79
79
|
return (
|
|
80
|
-
<
|
|
80
|
+
<Box
|
|
81
|
+
sx={{
|
|
82
|
+
width: '100vw',
|
|
83
|
+
minHeight: '90vh',
|
|
84
|
+
pb: 4,
|
|
85
|
+
display: 'flex',
|
|
86
|
+
flexDirection: 'column',
|
|
87
|
+
}}>
|
|
81
88
|
<Header />
|
|
82
89
|
<Center relative="parent">
|
|
83
90
|
<Alert severity="error">{error.message}</Alert>
|
|
84
91
|
</Center>
|
|
85
|
-
</
|
|
92
|
+
</Box>
|
|
86
93
|
);
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
if (loading || !data) {
|
|
90
97
|
return (
|
|
91
|
-
<
|
|
98
|
+
<Box
|
|
99
|
+
sx={{
|
|
100
|
+
width: '100vw',
|
|
101
|
+
minHeight: '90vh',
|
|
102
|
+
pb: 4,
|
|
103
|
+
display: 'flex',
|
|
104
|
+
flexDirection: 'column',
|
|
105
|
+
}}>
|
|
92
106
|
<Header />
|
|
93
107
|
<Center>
|
|
94
108
|
<Stack direction="column" alignItems="center" spacing={4}>
|
|
@@ -98,25 +112,32 @@ export default function PricingTable({ id }: Props) {
|
|
|
98
112
|
<Typography component="div" variant="h6" sx={{ width: '10%' }}>
|
|
99
113
|
<Skeleton />
|
|
100
114
|
</Typography>
|
|
101
|
-
<Stack
|
|
115
|
+
<Stack flexWrap="wrap" direction="row" gap={{ xs: 3, sm: 5, md: 10 }} justifyContent="center">
|
|
102
116
|
<ProductSkeleton key={1} count={2} />
|
|
103
117
|
<ProductSkeleton key={2} count={3} />
|
|
104
118
|
<ProductSkeleton key={3} count={4} />
|
|
105
119
|
</Stack>
|
|
106
120
|
</Stack>
|
|
107
121
|
</Center>
|
|
108
|
-
</
|
|
122
|
+
</Box>
|
|
109
123
|
);
|
|
110
124
|
}
|
|
111
125
|
|
|
112
126
|
if (data.items.length === 0) {
|
|
113
127
|
return (
|
|
114
|
-
<
|
|
128
|
+
<Box
|
|
129
|
+
sx={{
|
|
130
|
+
width: '100vw',
|
|
131
|
+
minHeight: '90vh',
|
|
132
|
+
pb: 4,
|
|
133
|
+
display: 'flex',
|
|
134
|
+
flexDirection: 'column',
|
|
135
|
+
}}>
|
|
115
136
|
<Header />
|
|
116
137
|
<Center relative="parent">
|
|
117
138
|
<Alert severity="warning">{t('checkout.noPricing')}</Alert>
|
|
118
139
|
</Center>
|
|
119
|
-
</
|
|
140
|
+
</Box>
|
|
120
141
|
);
|
|
121
142
|
}
|
|
122
143
|
|
|
@@ -137,24 +158,53 @@ export default function PricingTable({ id }: Props) {
|
|
|
137
158
|
};
|
|
138
159
|
|
|
139
160
|
return (
|
|
140
|
-
<
|
|
161
|
+
<Box
|
|
162
|
+
sx={{
|
|
163
|
+
width: '100vw',
|
|
164
|
+
minHeight: '90vh',
|
|
165
|
+
pb: 4,
|
|
166
|
+
display: {
|
|
167
|
+
xs: 'block',
|
|
168
|
+
sm: 'flex',
|
|
169
|
+
},
|
|
170
|
+
flexDirection: 'column',
|
|
171
|
+
}}>
|
|
141
172
|
<Header />
|
|
142
173
|
<Center relative="parent">
|
|
143
|
-
<Stack
|
|
174
|
+
<Stack
|
|
175
|
+
direction="column"
|
|
176
|
+
alignItems="center"
|
|
177
|
+
sx={{
|
|
178
|
+
pt: {
|
|
179
|
+
xs: 4,
|
|
180
|
+
sm: 2,
|
|
181
|
+
},
|
|
182
|
+
gap: {
|
|
183
|
+
xs: 3,
|
|
184
|
+
sm: 5,
|
|
185
|
+
},
|
|
186
|
+
}}>
|
|
144
187
|
<Typography variant="h4" color="text.primary" fontWeight={600}>
|
|
145
188
|
{data.name}
|
|
146
189
|
{!livemode && <Livemode />}
|
|
147
190
|
</Typography>
|
|
148
191
|
{Object.keys(recurring).length > 1 && (
|
|
149
|
-
<ToggleButtonGroup
|
|
192
|
+
<ToggleButtonGroup
|
|
193
|
+
value={state.interval}
|
|
194
|
+
onChange={(_, value) => {
|
|
195
|
+
if (value !== null) {
|
|
196
|
+
setState({ interval: value });
|
|
197
|
+
}
|
|
198
|
+
}}
|
|
199
|
+
exclusive>
|
|
150
200
|
{Object.keys(recurring).map((x) => (
|
|
151
201
|
<ToggleButton key={x} value={x} sx={{ textTransform: 'capitalize' }}>
|
|
152
|
-
{formatRecurring(recurring[x] as PriceRecurring)}
|
|
202
|
+
{formatRecurring(recurring[x] as PriceRecurring, true, '', locale)}
|
|
153
203
|
</ToggleButton>
|
|
154
204
|
))}
|
|
155
205
|
</ToggleButtonGroup>
|
|
156
206
|
)}
|
|
157
|
-
<Stack
|
|
207
|
+
<Stack flexWrap="wrap" direction="row" gap={{ xs: 3, sm: 5, md: 10 }} justifyContent="center">
|
|
158
208
|
{grouped[state.interval]?.map((x) => {
|
|
159
209
|
return (
|
|
160
210
|
<Fade in>
|
|
@@ -186,10 +236,10 @@ export default function PricingTable({ id }: Props) {
|
|
|
186
236
|
<PaymentAmount amount={formatPriceAmount(x.price, data.currency, x.product.unit_label)} />
|
|
187
237
|
<Stack direction="column" alignItems="flex-start">
|
|
188
238
|
<Typography component="span" color="text.secondary" fontSize="0.8rem">
|
|
189
|
-
per
|
|
239
|
+
{t('checkout.per')}
|
|
190
240
|
</Typography>
|
|
191
241
|
<Typography component="span" color="text.secondary" fontSize="0.8rem">
|
|
192
|
-
{formatRecurring(x.price.recurring as PriceRecurring, false, '')}
|
|
242
|
+
{formatRecurring(x.price.recurring as PriceRecurring, false, '', locale)}
|
|
193
243
|
</Typography>
|
|
194
244
|
</Stack>
|
|
195
245
|
</Stack>
|
|
@@ -226,6 +276,6 @@ export default function PricingTable({ id }: Props) {
|
|
|
226
276
|
</Stack>
|
|
227
277
|
</Stack>
|
|
228
278
|
</Center>
|
|
229
|
-
</
|
|
279
|
+
</Box>
|
|
230
280
|
);
|
|
231
281
|
}
|