@blocklet/payment-react 1.13.131 → 1.13.133
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/history/payment/list.js +1 -1
- package/es/payment/index.js +5 -3
- package/es/types/index.d.ts +1 -1
- package/es/util.d.ts +1 -0
- package/es/util.js +12 -0
- package/lib/history/payment/list.js +1 -1
- package/lib/payment/index.js +5 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/util.d.ts +1 -0
- package/lib/util.js +13 -0
- package/package.json +3 -3
- package/src/history/payment/list.tsx +1 -1
- package/src/payment/index.tsx +5 -3
- package/src/types/index.ts +1 -1
- package/src/util.ts +13 -0
|
@@ -70,7 +70,7 @@ export default function CustomerPaymentList({ customer_id }) {
|
|
|
70
70
|
item.paymentCurrency.symbol
|
|
71
71
|
] }) }),
|
|
72
72
|
/* @__PURE__ */ jsx(Box, { flex: 3, children: /* @__PURE__ */ jsx(Status, { label: item.status, color: getPaymentIntentStatusColor(item.status) }) }),
|
|
73
|
-
/* @__PURE__ */ jsx(Box, { flex: 3, children: /* @__PURE__ */ jsx(Typography, { children: item.description ||
|
|
73
|
+
/* @__PURE__ */ jsx(Box, { flex: 3, children: /* @__PURE__ */ jsx(Typography, { children: item.description || "-" }) }),
|
|
74
74
|
/* @__PURE__ */ jsx(Box, { flex: 3, sx: { minWidth: "220px" }, children: item.payment_details?.arcblock?.tx_hash && /* @__PURE__ */ jsx(
|
|
75
75
|
TxLink,
|
|
76
76
|
{
|
package/es/payment/index.js
CHANGED
|
@@ -250,7 +250,7 @@ export const Root = styled(Box)`
|
|
|
250
250
|
|
|
251
251
|
.cko-container {
|
|
252
252
|
width: 100%;
|
|
253
|
-
max-width: 1000px;
|
|
253
|
+
max-width: ${(props) => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
|
|
254
254
|
display: flex;
|
|
255
255
|
flex-direction: row;
|
|
256
256
|
justify-content: space-between;
|
|
@@ -259,9 +259,10 @@ export const Root = styled(Box)`
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
.cko-overview {
|
|
262
|
-
width: 400px;
|
|
262
|
+
width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
|
|
263
263
|
min-height: ${(props) => props.mode === "standalone" ? "540px" : "auto"};
|
|
264
264
|
position: relative;
|
|
265
|
+
display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
|
|
265
266
|
}
|
|
266
267
|
.cko-header {
|
|
267
268
|
left: 0;
|
|
@@ -278,7 +279,7 @@ export const Root = styled(Box)`
|
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
.cko-payment {
|
|
281
|
-
width: 400px;
|
|
282
|
+
width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
|
|
282
283
|
.MuiInputBase-root {
|
|
283
284
|
border-radius: 0;
|
|
284
285
|
}
|
|
@@ -367,6 +368,7 @@ export const Root = styled(Box)`
|
|
|
367
368
|
bottom: 0;
|
|
368
369
|
left: 12px;
|
|
369
370
|
margin: 12px 0;
|
|
371
|
+
display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
|
|
370
372
|
}
|
|
371
373
|
|
|
372
374
|
@media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
|
package/es/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type CheckoutContext = {
|
|
|
11
11
|
export type CheckoutProps = Partial<CheckoutCallbacks> & {
|
|
12
12
|
id: string;
|
|
13
13
|
extraParams?: Record<string, any>;
|
|
14
|
-
mode?: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
14
|
+
mode?: LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
|
|
15
15
|
};
|
|
16
16
|
export type CheckoutCallbacks = {
|
|
17
17
|
onPaid: (res: CheckoutContext) => void;
|
package/es/util.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare function formatLineItemPricing(item: TLineItemExpanded, currency:
|
|
|
22
22
|
};
|
|
23
23
|
export declare function getSubscriptionStatusColor(status: string): "success" | "primary" | "warning" | "error" | "default";
|
|
24
24
|
export declare function getPaymentIntentStatusColor(status: string): "success" | "warning" | "default";
|
|
25
|
+
export declare function getRefundStatusColor(status: string): "success" | "warning" | "default";
|
|
25
26
|
export declare function getInvoiceStatusColor(status: string): "success" | "warning" | "default" | "secondary";
|
|
26
27
|
export declare function getWebhookStatusColor(status: string): "success" | "default";
|
|
27
28
|
export declare function getCheckoutAmount(items: TLineItemExpanded[], currency: TPaymentCurrency, includeFreeTrial?: boolean, upsell?: boolean): {
|
package/es/util.js
CHANGED
|
@@ -201,6 +201,18 @@ export function getPaymentIntentStatusColor(status) {
|
|
|
201
201
|
return "default";
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
+
export function getRefundStatusColor(status) {
|
|
205
|
+
switch (status) {
|
|
206
|
+
case "succeeded":
|
|
207
|
+
return "success";
|
|
208
|
+
case "requires_action":
|
|
209
|
+
return "warning";
|
|
210
|
+
case "canceled":
|
|
211
|
+
case "pending":
|
|
212
|
+
default:
|
|
213
|
+
return "default";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
204
216
|
export function getInvoiceStatusColor(status) {
|
|
205
217
|
switch (status) {
|
|
206
218
|
case "paid":
|
|
@@ -114,7 +114,7 @@ function CustomerPaymentList({
|
|
|
114
114
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
115
115
|
flex: 3,
|
|
116
116
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
117
|
-
children: item.description ||
|
|
117
|
+
children: item.description || "-"
|
|
118
118
|
})
|
|
119
119
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
120
120
|
flex: 3,
|
package/lib/payment/index.js
CHANGED
|
@@ -308,7 +308,7 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
|
|
|
308
308
|
|
|
309
309
|
.cko-container {
|
|
310
310
|
width: 100%;
|
|
311
|
-
max-width: 1000px;
|
|
311
|
+
max-width: ${props => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
|
|
312
312
|
display: flex;
|
|
313
313
|
flex-direction: row;
|
|
314
314
|
justify-content: space-between;
|
|
@@ -317,9 +317,10 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
.cko-overview {
|
|
320
|
-
width: 400px;
|
|
320
|
+
width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
|
|
321
321
|
min-height: ${props => props.mode === "standalone" ? "540px" : "auto"};
|
|
322
322
|
position: relative;
|
|
323
|
+
display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
|
|
323
324
|
}
|
|
324
325
|
.cko-header {
|
|
325
326
|
left: 0;
|
|
@@ -336,7 +337,7 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
|
|
|
336
337
|
}
|
|
337
338
|
|
|
338
339
|
.cko-payment {
|
|
339
|
-
width: 400px;
|
|
340
|
+
width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
|
|
340
341
|
.MuiInputBase-root {
|
|
341
342
|
border-radius: 0;
|
|
342
343
|
}
|
|
@@ -425,6 +426,7 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
|
|
|
425
426
|
bottom: 0;
|
|
426
427
|
left: 12px;
|
|
427
428
|
margin: 12px 0;
|
|
429
|
+
display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
|
|
428
430
|
}
|
|
429
431
|
|
|
430
432
|
@media (max-width: ${({
|
package/lib/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type CheckoutContext = {
|
|
|
11
11
|
export type CheckoutProps = Partial<CheckoutCallbacks> & {
|
|
12
12
|
id: string;
|
|
13
13
|
extraParams?: Record<string, any>;
|
|
14
|
-
mode?: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
14
|
+
mode?: LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
|
|
15
15
|
};
|
|
16
16
|
export type CheckoutCallbacks = {
|
|
17
17
|
onPaid: (res: CheckoutContext) => void;
|
package/lib/util.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare function formatLineItemPricing(item: TLineItemExpanded, currency:
|
|
|
22
22
|
};
|
|
23
23
|
export declare function getSubscriptionStatusColor(status: string): "success" | "primary" | "warning" | "error" | "default";
|
|
24
24
|
export declare function getPaymentIntentStatusColor(status: string): "success" | "warning" | "default";
|
|
25
|
+
export declare function getRefundStatusColor(status: string): "success" | "warning" | "default";
|
|
25
26
|
export declare function getInvoiceStatusColor(status: string): "success" | "warning" | "default" | "secondary";
|
|
26
27
|
export declare function getWebhookStatusColor(status: string): "success" | "default";
|
|
27
28
|
export declare function getCheckoutAmount(items: TLineItemExpanded[], currency: TPaymentCurrency, includeFreeTrial?: boolean, upsell?: boolean): {
|
package/lib/util.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.getPrefix = void 0;
|
|
|
24
24
|
exports.getPriceCurrencyOptions = getPriceCurrencyOptions;
|
|
25
25
|
exports.getPriceUintAmountByCurrency = getPriceUintAmountByCurrency;
|
|
26
26
|
exports.getRecurringPeriod = getRecurringPeriod;
|
|
27
|
+
exports.getRefundStatusColor = getRefundStatusColor;
|
|
27
28
|
exports.getStatementDescriptor = getStatementDescriptor;
|
|
28
29
|
exports.getSubscriptionAction = void 0;
|
|
29
30
|
exports.getSubscriptionStatusColor = getSubscriptionStatusColor;
|
|
@@ -257,6 +258,18 @@ function getPaymentIntentStatusColor(status) {
|
|
|
257
258
|
return "default";
|
|
258
259
|
}
|
|
259
260
|
}
|
|
261
|
+
function getRefundStatusColor(status) {
|
|
262
|
+
switch (status) {
|
|
263
|
+
case "succeeded":
|
|
264
|
+
return "success";
|
|
265
|
+
case "requires_action":
|
|
266
|
+
return "warning";
|
|
267
|
+
case "canceled":
|
|
268
|
+
case "pending":
|
|
269
|
+
default:
|
|
270
|
+
return "default";
|
|
271
|
+
}
|
|
272
|
+
}
|
|
260
273
|
function getInvoiceStatusColor(status) {
|
|
261
274
|
switch (status) {
|
|
262
275
|
case "paid":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.133",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@babel/core": "^7.19.3",
|
|
90
90
|
"@babel/preset-env": "^7.19.3",
|
|
91
91
|
"@babel/preset-react": "^7.18.6",
|
|
92
|
-
"@blocklet/payment-types": "1.13.
|
|
92
|
+
"@blocklet/payment-types": "1.13.133",
|
|
93
93
|
"@storybook/addon-essentials": "^7.6.10",
|
|
94
94
|
"@storybook/addon-interactions": "^7.6.10",
|
|
95
95
|
"@storybook/addon-links": "^7.6.10",
|
|
@@ -118,5 +118,5 @@
|
|
|
118
118
|
"vite-plugin-babel": "^1.2.0",
|
|
119
119
|
"vite-plugin-node-polyfills": "^0.19.0"
|
|
120
120
|
},
|
|
121
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "44fb37dff90e613692afb8b4afd982f27558811f"
|
|
122
122
|
}
|
|
@@ -93,7 +93,7 @@ export default function CustomerPaymentList({ customer_id }: Props) {
|
|
|
93
93
|
<Status label={item.status} color={getPaymentIntentStatusColor(item.status)} />
|
|
94
94
|
</Box>
|
|
95
95
|
<Box flex={3}>
|
|
96
|
-
<Typography>{item.description ||
|
|
96
|
+
<Typography>{item.description || '-'}</Typography>
|
|
97
97
|
</Box>
|
|
98
98
|
<Box flex={3} sx={{ minWidth: '220px' }}>
|
|
99
99
|
{(item as any).payment_details?.arcblock?.tx_hash && (
|
package/src/payment/index.tsx
CHANGED
|
@@ -294,7 +294,7 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
|
|
|
294
294
|
|
|
295
295
|
.cko-container {
|
|
296
296
|
width: 100%;
|
|
297
|
-
max-width: 1000px;
|
|
297
|
+
max-width: ${(props) => (props.mode.endsWith('-minimal') ? '400px' : '1000px')};
|
|
298
298
|
display: flex;
|
|
299
299
|
flex-direction: row;
|
|
300
300
|
justify-content: space-between;
|
|
@@ -303,9 +303,10 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
.cko-overview {
|
|
306
|
-
width: 400px;
|
|
306
|
+
width: ${(props) => (props.mode.endsWith('-minimal') ? '100%' : '400px')};
|
|
307
307
|
min-height: ${(props) => (props.mode === 'standalone' ? '540px' : 'auto')};
|
|
308
308
|
position: relative;
|
|
309
|
+
display: ${(props) => (props.mode.endsWith('-minimal') ? 'none' : 'block')};
|
|
309
310
|
}
|
|
310
311
|
.cko-header {
|
|
311
312
|
left: 0;
|
|
@@ -322,7 +323,7 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
|
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
.cko-payment {
|
|
325
|
-
width: 400px;
|
|
326
|
+
width: ${(props) => (props.mode.endsWith('-minimal') ? '100%' : '400px')};
|
|
326
327
|
.MuiInputBase-root {
|
|
327
328
|
border-radius: 0;
|
|
328
329
|
}
|
|
@@ -411,6 +412,7 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
|
|
|
411
412
|
bottom: 0;
|
|
412
413
|
left: 12px;
|
|
413
414
|
margin: 12px 0;
|
|
415
|
+
display: ${(props) => (props.mode.endsWith('-minimal') ? 'none' : 'block')};
|
|
414
416
|
}
|
|
415
417
|
|
|
416
418
|
@media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
|
package/src/types/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type CheckoutContext = {
|
|
|
20
20
|
export type CheckoutProps = Partial<CheckoutCallbacks> & {
|
|
21
21
|
id: string;
|
|
22
22
|
extraParams?: Record<string, any>;
|
|
23
|
-
mode?: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
23
|
+
mode?: LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type CheckoutCallbacks = {
|
package/src/util.ts
CHANGED
|
@@ -292,6 +292,19 @@ export function getPaymentIntentStatusColor(status: string) {
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
export function getRefundStatusColor(status: string) {
|
|
296
|
+
switch (status) {
|
|
297
|
+
case 'succeeded':
|
|
298
|
+
return 'success';
|
|
299
|
+
case 'requires_action':
|
|
300
|
+
return 'warning';
|
|
301
|
+
case 'canceled':
|
|
302
|
+
case 'pending':
|
|
303
|
+
default:
|
|
304
|
+
return 'default';
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
295
308
|
export function getInvoiceStatusColor(status: string) {
|
|
296
309
|
switch (status) {
|
|
297
310
|
case 'paid':
|