@blocklet/payment-react 1.19.23 → 1.20.1
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/.aigne/doc-smith/config.yaml +114 -0
- package/.aigne/doc-smith/output/structure-plan.json +361 -0
- package/.aigne/doc-smith/preferences.yml +55 -0
- package/.aigne/doc-smith/upload-cache.yaml +264 -0
- package/README.md +2 -3
- package/docs/_sidebar.md +33 -0
- package/docs/components-business-auto-topup.md +238 -0
- package/docs/components-business-overdue-invoice-payment.md +231 -0
- package/docs/components-business-resume-subscription.md +177 -0
- package/docs/components-business.md +45 -0
- package/docs/components-checkout-checkout-donate.md +199 -0
- package/docs/components-checkout-checkout-form.md +185 -0
- package/docs/components-checkout-checkout-table.md +228 -0
- package/docs/components-checkout.md +131 -0
- package/docs/components-history-credit-grants-list.md +98 -0
- package/docs/components-history-credit-transactions-list.md +116 -0
- package/docs/components-history-invoice-list.md +104 -0
- package/docs/components-history-payment-list.md +65 -0
- package/docs/components-history.md +92 -0
- package/docs/components-ui-form-elements-address-form.md +150 -0
- package/docs/components-ui-form-elements-country-select.md +105 -0
- package/docs/components-ui-form-elements-currency-selector.md +124 -0
- package/docs/components-ui-form-elements-phone-input.md +160 -0
- package/docs/components-ui-form-elements.md +125 -0
- package/docs/components-ui-payment-summary.md +157 -0
- package/docs/components-ui-pricing-table.md +227 -0
- package/docs/components-ui.md +44 -0
- package/docs/components.md +95 -0
- package/docs/getting-started.md +111 -0
- package/docs/guides-theming.md +175 -0
- package/docs/guides-utilities.md +235 -0
- package/docs/guides.md +95 -0
- package/docs/hooks-use-mobile.md +70 -0
- package/docs/hooks-use-subscription.md +129 -0
- package/docs/hooks.md +84 -0
- package/docs/overview.md +87 -0
- package/docs/providers-donate-provider.md +175 -0
- package/docs/providers-payment-provider.md +245 -0
- package/docs/providers.md +101 -0
- package/es/libs/util.d.ts +1 -1
- package/es/payment/form/index.js +15 -1
- package/es/payment/summary.js +1 -1
- package/lib/libs/util.d.ts +1 -1
- package/lib/payment/form/index.js +14 -1
- package/lib/payment/summary.js +1 -1
- package/package.json +9 -9
- package/src/libs/util.ts +1 -0
- package/src/payment/form/index.tsx +16 -1
- package/src/payment/summary.tsx +1 -2
|
@@ -161,6 +161,7 @@ function PaymentForm({
|
|
|
161
161
|
creditInsufficientInfo: null
|
|
162
162
|
});
|
|
163
163
|
const currencies = (0, _util2.flattenPaymentMethods)(paymentMethods);
|
|
164
|
+
const searchParams = (0, _util2.getQueryParams)(window.location.href);
|
|
164
165
|
const onCheckoutComplete = (0, _ahooks.useMemoizedFn)(async ({
|
|
165
166
|
response
|
|
166
167
|
}) => {
|
|
@@ -673,6 +674,18 @@ function PaymentForm({
|
|
|
673
674
|
}),
|
|
674
675
|
confirm: t("common.confirm")
|
|
675
676
|
});
|
|
677
|
+
const getRedirectUrl = () => {
|
|
678
|
+
if (searchParams.redirect) {
|
|
679
|
+
return decodeURIComponent(searchParams.redirect);
|
|
680
|
+
}
|
|
681
|
+
if (checkoutSession.success_url) {
|
|
682
|
+
return checkoutSession.success_url;
|
|
683
|
+
}
|
|
684
|
+
if (paymentLink?.after_completion?.redirect?.url) {
|
|
685
|
+
return paymentLink.after_completion.redirect.url;
|
|
686
|
+
}
|
|
687
|
+
return void 0;
|
|
688
|
+
};
|
|
676
689
|
if (onlyShowBtn) {
|
|
677
690
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
678
691
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
@@ -780,7 +793,7 @@ function PaymentForm({
|
|
|
780
793
|
mode: checkoutSession.mode,
|
|
781
794
|
onConfirm: onStripeConfirm,
|
|
782
795
|
onCancel: onStripeCancel,
|
|
783
|
-
returnUrl:
|
|
796
|
+
returnUrl: getRedirectUrl()
|
|
784
797
|
})]
|
|
785
798
|
})
|
|
786
799
|
}), showForm && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
package/lib/payment/summary.js
CHANGED
|
@@ -331,7 +331,7 @@ function PaymentSummary({
|
|
|
331
331
|
mt: 2.5,
|
|
332
332
|
mb: 2.5
|
|
333
333
|
}
|
|
334
|
-
}), staking > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
334
|
+
}), +staking > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
335
335
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
336
336
|
direction: "row",
|
|
337
337
|
spacing: 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@arcblock/did-connect-react": "^3.1.
|
|
58
|
-
"@arcblock/ux": "^3.1.
|
|
59
|
-
"@arcblock/ws": "^1.
|
|
60
|
-
"@blocklet/theme": "^3.1.
|
|
61
|
-
"@blocklet/ui-react": "^3.1.
|
|
57
|
+
"@arcblock/did-connect-react": "^3.1.33",
|
|
58
|
+
"@arcblock/ux": "^3.1.33",
|
|
59
|
+
"@arcblock/ws": "^1.24.7",
|
|
60
|
+
"@blocklet/theme": "^3.1.33",
|
|
61
|
+
"@blocklet/ui-react": "^3.1.33",
|
|
62
62
|
"@mui/icons-material": "^7.1.2",
|
|
63
63
|
"@mui/lab": "7.0.0-beta.14",
|
|
64
64
|
"@mui/material": "^7.1.2",
|
|
65
65
|
"@mui/system": "^7.1.1",
|
|
66
|
-
"@ocap/util": "^1.
|
|
66
|
+
"@ocap/util": "^1.24.7",
|
|
67
67
|
"@stripe/react-stripe-js": "^2.9.0",
|
|
68
68
|
"@stripe/stripe-js": "^2.4.0",
|
|
69
69
|
"@vitejs/plugin-legacy": "^7.0.0",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@babel/core": "^7.27.4",
|
|
95
95
|
"@babel/preset-env": "^7.27.2",
|
|
96
96
|
"@babel/preset-react": "^7.27.1",
|
|
97
|
-
"@blocklet/payment-types": "1.
|
|
97
|
+
"@blocklet/payment-types": "1.20.1",
|
|
98
98
|
"@storybook/addon-essentials": "^7.6.20",
|
|
99
99
|
"@storybook/addon-interactions": "^7.6.20",
|
|
100
100
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"vite-plugin-babel": "^1.3.1",
|
|
126
126
|
"vite-plugin-node-polyfills": "^0.23.0"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "7b2ae13171bfff930083efd2b93974a8fa403de1"
|
|
129
129
|
}
|
package/src/libs/util.ts
CHANGED
|
@@ -1047,6 +1047,7 @@ export function formatTotalPrice({
|
|
|
1047
1047
|
totalAmount: '0',
|
|
1048
1048
|
};
|
|
1049
1049
|
}
|
|
1050
|
+
// @ts-expect-error 这里有问题
|
|
1050
1051
|
const unitValue = new BN(price.custom_unit_amount || price.unit_amount);
|
|
1051
1052
|
const currency: TPaymentCurrency = price?.currency ?? {};
|
|
1052
1053
|
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
formatError,
|
|
31
31
|
formatQuantityInventory,
|
|
32
32
|
getPrefix,
|
|
33
|
+
getQueryParams,
|
|
33
34
|
getStatementDescriptor,
|
|
34
35
|
getTokenBalanceLink,
|
|
35
36
|
isCrossOrigin,
|
|
@@ -229,6 +230,7 @@ export default function PaymentForm({
|
|
|
229
230
|
});
|
|
230
231
|
|
|
231
232
|
const currencies = flattenPaymentMethods(paymentMethods);
|
|
233
|
+
const searchParams = getQueryParams(window.location.href);
|
|
232
234
|
|
|
233
235
|
const onCheckoutComplete = useMemoizedFn(async ({ response }: { response: TCheckoutSession }) => {
|
|
234
236
|
if (response.id === checkoutSession.id && state.paid === false) {
|
|
@@ -743,6 +745,19 @@ export default function PaymentForm({
|
|
|
743
745
|
/>
|
|
744
746
|
);
|
|
745
747
|
|
|
748
|
+
const getRedirectUrl = () => {
|
|
749
|
+
if (searchParams.redirect) {
|
|
750
|
+
return decodeURIComponent(searchParams.redirect);
|
|
751
|
+
}
|
|
752
|
+
if (checkoutSession.success_url) {
|
|
753
|
+
return checkoutSession.success_url;
|
|
754
|
+
}
|
|
755
|
+
if (paymentLink?.after_completion?.redirect?.url) {
|
|
756
|
+
return paymentLink.after_completion.redirect.url;
|
|
757
|
+
}
|
|
758
|
+
return undefined;
|
|
759
|
+
};
|
|
760
|
+
|
|
746
761
|
if (onlyShowBtn) {
|
|
747
762
|
return (
|
|
748
763
|
<>
|
|
@@ -850,7 +865,7 @@ export default function PaymentForm({
|
|
|
850
865
|
mode={checkoutSession.mode}
|
|
851
866
|
onConfirm={onStripeConfirm}
|
|
852
867
|
onCancel={onStripeCancel}
|
|
853
|
-
returnUrl={
|
|
868
|
+
returnUrl={getRedirectUrl()}
|
|
854
869
|
/>
|
|
855
870
|
)}
|
|
856
871
|
</Stack>
|
package/src/payment/summary.tsx
CHANGED