@blocklet/payment-react 1.19.22 → 1.20.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.
Files changed (43) hide show
  1. package/.aigne/doc-smith/config.yaml +114 -0
  2. package/.aigne/doc-smith/output/structure-plan.json +361 -0
  3. package/.aigne/doc-smith/preferences.yml +55 -0
  4. package/.aigne/doc-smith/upload-cache.yaml +264 -0
  5. package/README.md +2 -3
  6. package/docs/_sidebar.md +33 -0
  7. package/docs/components-business-auto-topup.md +238 -0
  8. package/docs/components-business-overdue-invoice-payment.md +231 -0
  9. package/docs/components-business-resume-subscription.md +177 -0
  10. package/docs/components-business.md +45 -0
  11. package/docs/components-checkout-checkout-donate.md +199 -0
  12. package/docs/components-checkout-checkout-form.md +185 -0
  13. package/docs/components-checkout-checkout-table.md +228 -0
  14. package/docs/components-checkout.md +131 -0
  15. package/docs/components-history-credit-grants-list.md +98 -0
  16. package/docs/components-history-credit-transactions-list.md +116 -0
  17. package/docs/components-history-invoice-list.md +104 -0
  18. package/docs/components-history-payment-list.md +65 -0
  19. package/docs/components-history.md +92 -0
  20. package/docs/components-ui-form-elements-address-form.md +150 -0
  21. package/docs/components-ui-form-elements-country-select.md +105 -0
  22. package/docs/components-ui-form-elements-currency-selector.md +124 -0
  23. package/docs/components-ui-form-elements-phone-input.md +160 -0
  24. package/docs/components-ui-form-elements.md +125 -0
  25. package/docs/components-ui-payment-summary.md +157 -0
  26. package/docs/components-ui-pricing-table.md +227 -0
  27. package/docs/components-ui.md +44 -0
  28. package/docs/components.md +95 -0
  29. package/docs/getting-started.md +111 -0
  30. package/docs/guides-theming.md +175 -0
  31. package/docs/guides-utilities.md +235 -0
  32. package/docs/guides.md +95 -0
  33. package/docs/hooks-use-mobile.md +70 -0
  34. package/docs/hooks-use-subscription.md +129 -0
  35. package/docs/hooks.md +84 -0
  36. package/docs/overview.md +87 -0
  37. package/docs/providers-donate-provider.md +175 -0
  38. package/docs/providers-payment-provider.md +245 -0
  39. package/docs/providers.md +101 -0
  40. package/es/payment/form/index.js +15 -1
  41. package/lib/payment/form/index.js +14 -1
  42. package/package.json +5 -5
  43. package/src/payment/form/index.tsx +16 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.19.22",
3
+ "version": "1.20.0",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -56,14 +56,14 @@
56
56
  "dependencies": {
57
57
  "@arcblock/did-connect-react": "^3.1.32",
58
58
  "@arcblock/ux": "^3.1.32",
59
- "@arcblock/ws": "^1.23.1",
59
+ "@arcblock/ws": "^1.24.3",
60
60
  "@blocklet/theme": "^3.1.32",
61
61
  "@blocklet/ui-react": "^3.1.32",
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.23.1",
66
+ "@ocap/util": "^1.24.3",
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.19.22",
97
+ "@blocklet/payment-types": "1.20.0",
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": "53d092fa1c88542b297c6333b810ba29751eef19"
128
+ "gitHead": "ca71d3996c6c5be18827a9f3d516bab117b327dd"
129
129
  }
@@ -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={checkoutSession?.success_url}
868
+ returnUrl={getRedirectUrl()}
854
869
  />
855
870
  )}
856
871
  </Stack>