@blocklet/payment-react 1.23.0 → 1.23.2

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 (96) hide show
  1. package/.aigne/doc-smith/translation-cache.yaml +2 -2
  2. package/.aigne/doc-smith/upload-cache.yaml +342 -0
  3. package/docs/assets/diagram/auto-topup-diagram-0.ja.jpg +0 -0
  4. package/docs/assets/diagram/auto-topup-diagram-0.zh-TW.jpg +0 -0
  5. package/docs/assets/diagram/auto-topup-diagram-0.zh.jpg +0 -0
  6. package/docs/assets/diagram/components-business-overdue-invoice-payment-01.ja.jpg +0 -0
  7. package/docs/assets/diagram/components-business-overdue-invoice-payment-01.jpg +0 -0
  8. package/docs/assets/diagram/components-business-overdue-invoice-payment-01.zh-TW.jpg +0 -0
  9. package/docs/assets/diagram/components-business-overdue-invoice-payment-01.zh.jpg +0 -0
  10. package/docs/assets/diagram/components-checkout-checkout-donate-01.ja.jpg +0 -0
  11. package/docs/assets/diagram/components-checkout-checkout-donate-01.jpg +0 -0
  12. package/docs/assets/diagram/components-checkout-checkout-donate-01.zh-TW.jpg +0 -0
  13. package/docs/assets/diagram/components-checkout-checkout-donate-01.zh.jpg +0 -0
  14. package/docs/assets/diagram/components-checkout-checkout-table-01.ja.jpg +0 -0
  15. package/docs/assets/diagram/components-checkout-checkout-table-01.jpg +0 -0
  16. package/docs/assets/diagram/components-checkout-checkout-table-01.zh-TW.jpg +0 -0
  17. package/docs/assets/diagram/components-checkout-checkout-table-01.zh.jpg +0 -0
  18. package/docs/assets/diagram/components-diagram-0.ja.jpg +0 -0
  19. package/docs/assets/diagram/components-diagram-0.zh-TW.jpg +0 -0
  20. package/docs/assets/diagram/components-diagram-0.zh.jpg +0 -0
  21. package/docs/assets/diagram/overview-01.ja.jpg +0 -0
  22. package/docs/assets/diagram/overview-01.jpg +0 -0
  23. package/docs/assets/diagram/overview-01.zh-TW.jpg +0 -0
  24. package/docs/assets/diagram/overview-01.zh.jpg +0 -0
  25. package/docs/assets/diagram/payment-provider-diagram-0.ja.jpg +0 -0
  26. package/docs/assets/diagram/payment-provider-diagram-0.zh-TW.jpg +0 -0
  27. package/docs/assets/diagram/payment-provider-diagram-0.zh.jpg +0 -0
  28. package/docs/assets/diagram/phone-input-diagram-0.ja.jpg +0 -0
  29. package/docs/assets/diagram/phone-input-diagram-0.zh-TW.jpg +0 -0
  30. package/docs/assets/diagram/phone-input-diagram-0.zh.jpg +0 -0
  31. package/docs/assets/diagram/providers-01.ja.jpg +0 -0
  32. package/docs/assets/diagram/providers-01.jpg +0 -0
  33. package/docs/assets/diagram/providers-01.zh-TW.jpg +0 -0
  34. package/docs/assets/diagram/providers-01.zh.jpg +0 -0
  35. package/docs/assets/diagram/resume-subscription-diagram-0.ja.jpg +0 -0
  36. package/docs/assets/diagram/resume-subscription-diagram-0.zh-TW.jpg +0 -0
  37. package/docs/assets/diagram/resume-subscription-diagram-0.zh.jpg +0 -0
  38. package/docs/assets/diagram/use-subscription-diagram-0.ja.jpg +0 -0
  39. package/docs/assets/diagram/use-subscription-diagram-0.zh-TW.jpg +0 -0
  40. package/docs/assets/diagram/use-subscription-diagram-0.zh.jpg +0 -0
  41. package/docs/components-business-auto-topup.ja.md +2 -2
  42. package/docs/components-business-auto-topup.md +1 -1
  43. package/docs/components-business-auto-topup.zh-TW.md +2 -2
  44. package/docs/components-business-auto-topup.zh.md +2 -2
  45. package/docs/components-business-overdue-invoice-payment.ja.md +3 -39
  46. package/docs/components-business-overdue-invoice-payment.md +99 -90
  47. package/docs/components-business-overdue-invoice-payment.zh-TW.md +3 -40
  48. package/docs/components-business-overdue-invoice-payment.zh.md +3 -40
  49. package/docs/components-business-resume-subscription.ja.md +2 -2
  50. package/docs/components-business-resume-subscription.md +1 -1
  51. package/docs/components-business-resume-subscription.zh-TW.md +2 -2
  52. package/docs/components-business-resume-subscription.zh.md +2 -2
  53. package/docs/components-checkout-checkout-donate.ja.md +3 -36
  54. package/docs/components-checkout-checkout-donate.md +135 -128
  55. package/docs/components-checkout-checkout-donate.zh-TW.md +3 -36
  56. package/docs/components-checkout-checkout-donate.zh.md +3 -36
  57. package/docs/components-checkout-checkout-form.md +63 -82
  58. package/docs/components-checkout-checkout-table.ja.md +3 -35
  59. package/docs/components-checkout-checkout-table.md +112 -72
  60. package/docs/components-checkout-checkout-table.zh-TW.md +3 -35
  61. package/docs/components-checkout-checkout-table.zh.md +3 -36
  62. package/docs/components-checkout.md +11 -49
  63. package/docs/components-ui-form-elements-phone-input.ja.md +2 -2
  64. package/docs/components-ui-form-elements-phone-input.md +1 -1
  65. package/docs/components-ui-form-elements-phone-input.zh-TW.md +2 -2
  66. package/docs/components-ui-form-elements-phone-input.zh.md +2 -2
  67. package/docs/components.ja.md +2 -2
  68. package/docs/components.md +1 -1
  69. package/docs/components.zh-TW.md +2 -2
  70. package/docs/components.zh.md +2 -2
  71. package/docs/hooks-use-subscription.ja.md +2 -2
  72. package/docs/hooks-use-subscription.md +1 -1
  73. package/docs/hooks-use-subscription.zh-TW.md +2 -2
  74. package/docs/hooks-use-subscription.zh.md +2 -2
  75. package/docs/overview.ja.md +3 -39
  76. package/docs/overview.md +25 -56
  77. package/docs/overview.zh-TW.md +3 -39
  78. package/docs/overview.zh.md +3 -39
  79. package/docs/providers-payment-provider.ja.md +2 -2
  80. package/docs/providers-payment-provider.md +1 -1
  81. package/docs/providers-payment-provider.zh-TW.md +2 -2
  82. package/docs/providers-payment-provider.zh.md +2 -2
  83. package/docs/providers.ja.md +3 -23
  84. package/docs/providers.md +11 -29
  85. package/docs/providers.zh-TW.md +3 -23
  86. package/docs/providers.zh.md +3 -23
  87. package/es/history/credit/transactions-list.js +31 -49
  88. package/es/locales/en.js +16 -0
  89. package/es/locales/zh.js +16 -0
  90. package/lib/history/credit/transactions-list.js +63 -66
  91. package/lib/locales/en.js +16 -0
  92. package/lib/locales/zh.js +16 -0
  93. package/package.json +9 -9
  94. package/src/history/credit/transactions-list.tsx +54 -64
  95. package/src/locales/en.tsx +16 -0
  96. package/src/locales/zh.tsx +16 -0
@@ -1,65 +1,27 @@
1
1
  # Checkout Components
2
2
 
3
- The `@blocklet/payment-react` library provides a set of high-level Checkout Components designed to serve as complete, ready-to-use entry points for various payment scenarios. These components encapsulate the entire user flow, from selecting a product to completing the payment, allowing you to integrate complex payment experiences with minimal setup.
3
+ This section covers the high-level components that serve as entry points for various checkout flows. These components are designed to provide a complete, out-of-the-box experience for common payment scenarios like standard payments from a link, selecting a plan from a pricing table, or making a donation. They encapsulate the necessary logic to initiate and process payments, often leveraging the core `CheckoutForm` component internally.
4
4
 
5
- Whether you need to display a pricing table, accept donations, or process a direct payment link, these components handle the underlying logic of session creation, state management, and UI rendering.
5
+ ### Component Relationship
6
6
 
7
- ### Component Flow
7
+ The typical flow involves a user interacting with an entry-point component like `CheckoutTable` or `CheckoutDonate`. These components handle the initial user interaction (e.g., selecting a subscription plan) and then create a `CheckoutSession`. Once the session is ready, they delegate the final payment processing to the `CheckoutForm`, which renders the actual payment interface.
8
8
 
9
- The typical flow involves a user interacting with an entry-point component like `CheckoutTable` or `CheckoutDonate`. These components then create a `CheckoutSession` and delegate the final payment processing to the core `CheckoutForm` component.
9
+ The following diagram illustrates this component relationship:
10
10
 
11
- ```d2 Checkout Component Flow icon=mdi:transit-connection-variant
12
- direction: down
11
+ DIAGRAM_PLACEHOLDER
13
12
 
14
- User: {
15
- shape: c4-person
16
- }
13
+ This modular design allows for both flexibility and ease of use. You can quickly implement a complete payment workflow with a single component or compose them for more complex scenarios.
17
14
 
18
- Checkout-Flow: {
19
- label: "Checkout Flow"
20
-
21
- Entry-Points: {
22
- label: "User-Facing Components"
23
- shape: rectangle
24
-
25
- CheckoutTable: {
26
- label: "CheckoutTable"
27
- }
28
-
29
- CheckoutDonate: {
30
- label: "CheckoutDonate"
31
- }
32
- }
33
-
34
- Core-Processor: {
35
- label: "Core Payment Processor"
36
- shape: rectangle
37
-
38
- CheckoutForm: {
39
- label: "CheckoutForm"
40
- }
41
- }
42
- }
43
-
44
- User -> Checkout-Flow.Entry-Points.CheckoutTable: "Selects a subscription"
45
- User -> Checkout-Flow.Entry-Points.CheckoutDonate: "Makes a donation"
46
- Checkout-Flow.Entry-Points.CheckoutTable -> Checkout-Flow.Core-Processor.CheckoutForm: "On plan selection"
47
- Checkout-Flow.Entry-Points.CheckoutDonate -> Checkout-Flow.Core-Processor.CheckoutForm: "On donate action"
48
- Checkout-Flow.Core-Processor.CheckoutForm -> User: "Payment Result"
49
- ```
50
-
51
- Explore the components below to find the best fit for your application's needs.
15
+ For more detailed information on each component, including props and usage examples, please refer to their respective documentation pages.
52
16
 
53
17
  <x-cards data-columns="3">
54
18
  <x-card data-title="CheckoutForm" data-icon="lucide:credit-card" data-href="/components/checkout/checkout-form">
55
- The fundamental component for processing payments. It takes a `paymentLink` or `checkoutSession` ID and renders the complete payment UI.
19
+ The primary component for handling payment links and checkout sessions. It supports various display modes, including inline, standalone, and popup.
56
20
  </x-card>
57
21
  <x-card data-title="CheckoutTable" data-icon="lucide:table" data-href="/components/checkout/checkout-table">
58
- Displays a complete pricing table. When a user selects a plan, it automatically initiates a checkout session and renders the payment form.
22
+ Renders a complete pricing table and manages the checkout flow when a user selects a plan, automatically creating a session and displaying the payment form.
59
23
  </x-card>
60
24
  <x-card data-title="CheckoutDonate" data-icon="lucide:heart-handshake" data-href="/components/checkout/checkout-donate">
61
- A flexible component for adding donation functionality. It handles donation setup, displays supporter history, and manages the donation payment flow.
25
+ Implements donation functionality with flexible options for display modes, supporter history, and customization, guiding the user through the donation process.
62
26
  </x-card>
63
- </x-cards>
64
-
65
- Each of these components is designed to be highly customizable and can be integrated seamlessly into your application. Click on any card to view its detailed documentation and usage examples.
27
+ </x-cards>
@@ -8,8 +8,8 @@
8
8
 
9
9
  このコンポーネントは、`react-international-phone`ライブラリをコア機能として活用し、それをラップして`react-hook-form`およびMaterial-UIとの深い統合を提供します。ユーザーが国を選択したり番号を入力したりすると、コンポーネントはフォームの状態にある対応するフィールドを更新します。また、他のコンポーネントがフォーム内のリンクされた国フィールドを変更すると、自動的に国選択を更新します。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![PhoneInput](assets/diagram/phone-input-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![PhoneInput](assets/diagram/phone-input-diagram-0.ja.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## Props
@@ -8,7 +8,7 @@ This component is designed to work in tandem with other form elements, such as t
8
8
 
9
9
  The component leverages the `react-international-phone` library for its core functionality and wraps it to provide deep integration with `react-hook-form` and Material-UI. When a user selects a country or types a number, the component updates the corresponding fields in the form state. It also automatically updates its country selection when another component modifies the linked country field in the form.
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
12
  ![PhoneInput](assets/diagram/phone-input-diagram-0.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  該元件利用 `react-international-phone` 函式庫實現其核心功能,並將其包裝以提供與 `react-hook-form` 和 Material-UI 的深度整合。當使用者選擇一個國家或輸入號碼時,該元件會更新表單狀態中對應的欄位。當另一個元件修改表單中連結的國家欄位時,它也會自動更新其國家選擇。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![PhoneInput](assets/diagram/phone-input-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![PhoneInput](assets/diagram/phone-input-diagram-0.zh-TW.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## 屬性
@@ -8,8 +8,8 @@
8
8
 
9
9
  该组件利用 `react-international-phone` 库实现其核心功能,并对其进行包装,以提供与 `react-hook-form` 和 Material-UI 的深度集成。当用户选择一个国家或输入一个号码时,该组件会更新表单状态中相应的字段。当另一个组件修改表单中链接的国家字段时,它也会自动更新其国家选择。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![PhoneInput](assets/diagram/phone-input-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9::1764919317 -->
12
+ ![PhoneInput](assets/diagram/phone-input-diagram-0.zh.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## Props
@@ -8,8 +8,8 @@
8
8
 
9
9
  次の図は、高レベルのコンポーネントが通常どのように相互作用するかを示しています。`CheckoutTable` や `CheckoutDonate` のようなユーザー向けのコンポーネントがエントリーポイントとして機能し、その後、コアの `CheckoutForm` を利用して最終的な支払い処理を行います。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![Components](assets/diagram/components-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![Components](assets/diagram/components-diagram-0.ja.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## コンポーネントカテゴリ
@@ -8,7 +8,7 @@ All components are designed to work seamlessly within the `PaymentProvider` cont
8
8
 
9
9
  The following diagram illustrates how the high-level components typically interact. User-facing components like `CheckoutTable` or `CheckoutDonate` act as entry points, which then utilize the core `CheckoutForm` to handle the final payment processing.
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
12
  ![Components](assets/diagram/components-diagram-0.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  下圖說明了高階元件通常如何互動。面向使用者的元件,如 `CheckoutTable` 或 `CheckoutDonate`,作為入口點,然後利用核心的 `CheckoutForm` 來處理最終的支付處理。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![Components](assets/diagram/components-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![Components](assets/diagram/components-diagram-0.zh-TW.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## 元件類別
@@ -8,8 +8,8 @@
8
8
 
9
9
  下图说明了高级组件通常如何交互。面向用户的组件(如 `CheckoutTable` 或 `CheckoutDonate`)作为入口点,然后利用核心的 `CheckoutForm` 来处理最终的支付流程。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![Components](assets/diagram/components-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![Components](assets/diagram/components-diagram-0.zh.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## 组件分类
@@ -10,8 +10,8 @@
10
10
 
11
11
  バックエンドサービスがそのチャネルにイベントを公開すると、フックのサブスクリプションオブジェクトがイベントを発行し、コンポーネントはそれをリッスンできます。
12
12
 
13
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
14
- ![useSubscription](assets/diagram/use-subscription-diagram-0.jpg)
13
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
14
+ ![useSubscription](assets/diagram/use-subscription-diagram-0.ja.jpg)
15
15
  <!-- DIAGRAM_IMAGE_END -->
16
16
 
17
17
  ## パラメータ
@@ -12,7 +12,7 @@ When the backend service publishes an event to that channel, the hook's subscrip
12
12
 
13
13
  The following diagram illustrates this data flow:
14
14
 
15
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
15
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
16
16
  ![useSubscription](assets/diagram/use-subscription-diagram-0.jpg)
17
17
  <!-- DIAGRAM_IMAGE_END -->
18
18
 
@@ -10,8 +10,8 @@
10
10
 
11
11
  當後端服務向該頻道發布事件時,此 hook 的訂閱物件會發出該事件,您的元件可以監聽該事件。
12
12
 
13
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
14
- ![useSubscription](assets/diagram/use-subscription-diagram-0.jpg)
13
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
14
+ ![useSubscription](assets/diagram/use-subscription-diagram-0.zh-TW.jpg)
15
15
  <!-- DIAGRAM_IMAGE_END -->
16
16
 
17
17
  ## 參數
@@ -10,8 +10,8 @@
10
10
 
11
11
  当后端服务向该通道发布事件时,Hook 的订阅对象会发出该事件,您的组件可以监听该事件。
12
12
 
13
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
14
- ![useSubscription](assets/diagram/use-subscription-diagram-0.jpg)
13
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
14
+ ![useSubscription](assets/diagram/use-subscription-diagram-0.zh.jpg)
15
15
  <!-- DIAGRAM_IMAGE_END -->
16
16
 
17
17
  ## 参数
@@ -26,45 +26,9 @@
26
26
 
27
27
  このライブラリは、プロバイダーコンポーネントモデルを中心に設計されています。`PaymentProvider` はライブラリの中核であり、認証、API通信、状態を管理するコンテキストを作成します。他のすべての決済コンポーネントは、正しく機能するためにこのプロバイダーでラップする必要があります。これにより、決済ロジックが一元化され、個々のコンポーネントは軽量で特定の機能に集中できます。
28
28
 
29
- ```d2 高レベルアーキテクチャ
30
- direction: down
31
-
32
- User: {
33
- shape: c4-person
34
- }
35
-
36
- Your-Application: {
37
- label: "あなたのアプリケーション"
38
- shape: rectangle
39
-
40
- PaymentProvider: {
41
- label: "PaymentProvider"
42
- shape: rectangle
43
-
44
- Payment-Components: {
45
- label: "決済コンポーネント"
46
- shape: rectangle
47
- grid-columns: 2
48
-
49
- CheckoutForm: { label: "CheckoutForm" }
50
- CheckoutTable: { label: "CheckoutTable" }
51
- CheckoutDonate: { label: "CheckoutDonate" }
52
- CustomerInvoiceList: { label: "CustomerInvoiceList" }
53
- }
54
- }
55
- }
56
-
57
- Payment-Kit-Backend: {
58
- label: "Payment Kit バックエンド"
59
- shape: cylinder
60
- }
61
-
62
- User -> Your-Application.PaymentProvider.Payment-Components: "UIと対話する"
63
- Your-Application.PaymentProvider -> Payment-Kit-Backend: "API通信を処理する"
64
- Payment-Kit-Backend -> Your-Application.PaymentProvider: "データを返す"
65
- Your-Application.PaymentProvider.Payment-Components -> User: "UIの更新をレンダリングする"
66
-
67
- ```
29
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9::1765377042 -->
30
+ ![Overview](assets/diagram/overview-01.ja.jpg)
31
+ <!-- DIAGRAM_IMAGE_END -->
68
32
 
69
33
  ## 構築できるもの
70
34
 
package/docs/overview.md CHANGED
@@ -1,80 +1,49 @@
1
1
  # Overview
2
2
 
3
- `@blocklet/payment-react` is a comprehensive React component library designed to streamline the integration of payment flows, subscriptions, and donation systems into your blocklets. Built on top of [Payment Kit](https://www.arcblock.io/docs/arcblock-payment-kit), it provides a suite of pre-built, customizable, and production-ready components to help you build powerful payment experiences with minimal effort.
3
+ This document provides a high-level overview of the `@blocklet/payment-react` library. By the end of this guide, you will understand its core features, architecture, and the types of payment functionalities you can build with it. This library is designed to simplify the integration of payment flows, subscriptions, and donation systems into React applications by interfacing with the Blocklet Payment Kit.
4
4
 
5
5
  ## Key Features
6
6
 
7
- <x-cards data-columns="3">
7
+ The library offers a comprehensive set of tools to accelerate the development of payment-related features.
8
+
9
+ <x-cards data-columns="2">
8
10
  <x-card data-title="Pre-built UI Components" data-icon="lucide:layout-template">
9
- Includes a rich set of components like checkout forms, pricing tables, and donation widgets to cover common payment scenarios out of the box.
11
+ A suite of ready-to-use components, including checkout forms, pricing tables, and donation widgets, to handle common payment workflows.
10
12
  </x-card>
11
13
  <x-card data-title="Customizable Themes" data-icon="lucide:palette">
12
- Gain full control over the look and feel of your payment flows using Material-UI themes, ensuring a consistent user experience.
13
- </x-card>
14
- <x-card data-title="i18n Support" data-icon="lucide:languages">
15
- Built-in internationalization support allows you to easily localize component text for a global audience.
14
+ Leverages Material-UI for theming, allowing for extensive customization to match your application's design system.
16
15
  </x-card>
17
16
  <x-card data-title="Comprehensive Payment Operations" data-icon="lucide:credit-card">
18
- Easily handle complex payment logic, including subscriptions, refunds, invoice management, and metered billing.
17
+ Supports a wide range of payment operations such as subscriptions, invoice management, refunds, and metered billing.
19
18
  </x-card>
20
- <x-card data-title="Optimized Performance" data-icon="lucide:package-minus">
21
- Optimize your application's bundle size and improve performance with built-in support for lazy loading and dynamic component imports.
19
+ <x-card data-title="Internationalization (i18n)" data-icon="lucide:languages">
20
+ Includes built-in support for multiple languages, enabling you to create a localized experience for a global user base.
22
21
  </x-card>
23
22
  </x-cards>
24
23
 
25
24
  ## How It Works
26
25
 
27
- The library is architected around a provider-component model. The `PaymentProvider` is the core of the library, creating a context that manages authentication, API communication, and state. All other payment components must be wrapped within this provider to function correctly. This centralizes the payment logic and makes individual components lightweight and focused.
28
-
29
- ```d2 High-Level Architecture
30
- direction: down
31
-
32
- User: {
33
- shape: c4-person
34
- }
35
-
36
- Your-Application: {
37
- label: "Your Application"
38
- shape: rectangle
26
+ `@blocklet/payment-react` operates on a provider-component model. The `PaymentProvider` component is central to the library's functionality. It establishes a React context that manages API communication, state, and session information. All other payment-related components must be nested within a `PaymentProvider` to function correctly. This architecture centralizes critical logic, ensuring that components are decoupled and focused on their specific UI tasks.
39
27
 
40
- PaymentProvider: {
41
- label: "PaymentProvider"
42
- shape: rectangle
28
+ The diagram below illustrates the high-level data flow. User interactions with payment components trigger API calls handled by the `PaymentProvider`, which communicates with the Payment Kit backend and updates the UI with the response.
43
29
 
44
- Payment-Components: {
45
- label: "Payment Components"
46
- shape: rectangle
47
- grid-columns: 2
30
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1765377042 -->
31
+ ![Overview](assets/diagram/overview-01.jpg)
32
+ <!-- DIAGRAM_IMAGE_END -->
48
33
 
49
- CheckoutForm: { label: "CheckoutForm" }
50
- CheckoutTable: { label: "CheckoutTable" }
51
- CheckoutDonate: { label: "CheckoutDonate" }
52
- CustomerInvoiceList: { label: "CustomerInvoiceList" }
53
- }
54
- }
55
- }
34
+ ## Available Components
56
35
 
57
- Payment-Kit-Backend: {
58
- label: "Payment Kit Backend"
59
- shape: cylinder
60
- }
36
+ The library is organized into several categories of components and utilities to address different aspects of building a payment system.
61
37
 
62
- User -> Your-Application.PaymentProvider.Payment-Components: "Interacts with UI"
63
- Your-Application.PaymentProvider -> Payment-Kit-Backend: "Handles API Communication"
64
- Payment-Kit-Backend -> Your-Application.PaymentProvider: "Returns Data"
65
- Your-Application.PaymentProvider.Payment-Components -> User: "Renders UI Updates"
66
-
67
- ```
68
-
69
- ## What You Can Build
70
-
71
- - **Subscription Services:** Quickly implement pricing pages and checkout flows for SaaS products using `CheckoutTable`.
72
- - **E-commerce Checkouts:** Build one-time payment forms for selling goods with `CheckoutForm`.
73
- - **Donation Systems:** Add flexible donation widgets to support creators or causes with `CheckoutDonate`.
74
- - **Customer Portals:** Display invoice history and manage payment methods for users with `CustomerInvoiceList` and other history components.
38
+ | Category | Description | Key Components |
39
+ | --- | --- | --- |
40
+ | **Providers** | Context providers that wrap your application to enable payment features. | `PaymentProvider`, `DonateProvider` |
41
+ | **Checkout Components** | High-level components for complete payment and donation flows. | `CheckoutForm`, `CheckoutTable`, `CheckoutDonate` |
42
+ | **UI Components** | Granular components for building custom payment user interfaces. | `PricingTable`, `PaymentSummary`, `AddressForm` |
43
+ | **History Components** | Components for displaying historical data like invoices and payments. | `CustomerInvoiceList`, `CustomerPaymentList` |
44
+ | **Business Logic** | Specialized components for managing subscriptions and overdue payments. | `ResumeSubscription`, `OverdueInvoicePayment` |
45
+ | **Hooks & Utilities** | Custom hooks and utility functions for interacting with the payment service. | `useSubscription`, `api`, `dayjs` |
75
46
 
76
47
  ## Next Steps
77
48
 
78
- Now that you have an overview of what `@blocklet/payment-react` offers, the best way to learn is by building something.
79
-
80
- Dive into our [Getting Started](./getting-started.md) guide to install the library and create your first payment form in minutes.
49
+ To begin implementing payment features, proceed to the [Getting Started](./getting-started.md) guide, which provides step-by-step instructions for installation and building a basic payment form.
@@ -26,45 +26,9 @@
26
26
 
27
27
  此函式庫圍繞著提供者-元件模型架構。`PaymentProvider` 是此函式庫的核心,它建立了一個管理身份驗證、API 通訊和狀態的上下文 (context)。所有其他支付元件都必須包裹在此提供者內才能正常運作。這種方式集中了支付邏輯,並使個別元件保持輕量和專注。
28
28
 
29
- ```d2 高階架構
30
- direction: down
31
-
32
- User: {
33
- shape: c4-person
34
- }
35
-
36
- Your-Application: {
37
- label: "Your Application"
38
- shape: rectangle
39
-
40
- PaymentProvider: {
41
- label: "PaymentProvider"
42
- shape: rectangle
43
-
44
- Payment-Components: {
45
- label: "Payment Components"
46
- shape: rectangle
47
- grid-columns: 2
48
-
49
- CheckoutForm: { label: "CheckoutForm" }
50
- CheckoutTable: { label: "CheckoutTable" }
51
- CheckoutDonate: { label: "CheckoutDonate" }
52
- CustomerInvoiceList: { label: "CustomerInvoiceList" }
53
- }
54
- }
55
- }
56
-
57
- Payment-Kit-Backend: {
58
- label: "Payment Kit Backend"
59
- shape: cylinder
60
- }
61
-
62
- User -> Your-Application.PaymentProvider.Payment-Components: "Interacts with UI"
63
- Your-Application.PaymentProvider -> Payment-Kit-Backend: "Handles API Communication"
64
- Payment-Kit-Backend -> Your-Application.PaymentProvider: "Returns Data"
65
- Your-Application.PaymentProvider.Payment-Components -> User: "Renders UI Updates"
66
-
67
- ```
29
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9::1765377042 -->
30
+ ![Overview](assets/diagram/overview-01.zh-TW.jpg)
31
+ <!-- DIAGRAM_IMAGE_END -->
68
32
 
69
33
  ## 您可以建立什麼
70
34
 
@@ -26,45 +26,9 @@
26
26
 
27
27
  该库围绕提供者-组件模型构建。`PaymentProvider` 是该库的核心,它创建了一个管理身份验证、API 通信和状态的上下文。所有其他支付组件都必须在此提供者内包装才能正常工作。这种方式集中了支付逻辑,并使各个组件保持轻量和专注。
28
28
 
29
- ```d2 High-Level Architecture
30
- direction: down
31
-
32
- User: {
33
- shape: c4-person
34
- }
35
-
36
- Your-Application: {
37
- label: "你的应用"
38
- shape: rectangle
39
-
40
- PaymentProvider: {
41
- label: "PaymentProvider"
42
- shape: rectangle
43
-
44
- Payment-Components: {
45
- label: "支付组件"
46
- shape: rectangle
47
- grid-columns: 2
48
-
49
- CheckoutForm: { label: "CheckoutForm" }
50
- CheckoutTable: { label: "CheckoutTable" }
51
- CheckoutDonate: { label: "CheckoutDonate" }
52
- CustomerInvoiceList: { label: "CustomerInvoiceList" }
53
- }
54
- }
55
- }
56
-
57
- Payment-Kit-Backend: {
58
- label: "Payment Kit 后端"
59
- shape: cylinder
60
- }
61
-
62
- User -> Your-Application.PaymentProvider.Payment-Components: "与 UI 交互"
63
- Your-Application.PaymentProvider -> Payment-Kit-Backend: "处理 API 通信"
64
- Payment-Kit-Backend -> Your-Application.PaymentProvider: "返回数据"
65
- Your-Application.PaymentProvider.Payment-Components -> User: "渲染 UI 更新"
66
-
67
- ```
29
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9::1765377042 -->
30
+ ![Overview](assets/diagram/overview-01.zh.jpg)
31
+ <!-- DIAGRAM_IMAGE_END -->
68
32
 
69
33
  ## 你可以构建什么
70
34
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  このプロバイダーは、マウント時にPayment Kitのバックエンドから設定データを初期化して取得します。このデータは、ユーザーのセッションやその他のユーティリティとともに、`usePaymentContext`フックを介してすべての子孫コンポーネントで利用可能になります。このパターンにより、支払いコンポーネントはプロップのバケツリレー(prop drilling)なしで、常に必要なコンテキストにアクセスできるようになります。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![PaymentProvider](assets/diagram/payment-provider-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![PaymentProvider](assets/diagram/payment-provider-diagram-0.ja.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## セットアップと使用法
@@ -10,7 +10,7 @@ The provider initializes and fetches configuration data from the Payment Kit bac
10
10
 
11
11
  The following diagram illustrates this flow:
12
12
 
13
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
13
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
14
14
  ![PaymentProvider](assets/diagram/payment-provider-diagram-0.jpg)
15
15
  <!-- DIAGRAM_IMAGE_END -->
16
16
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  該提供者在掛載時會初始化並從 Payment Kit 後端取得設定資料。這些資料,連同使用者的 session 和其他工具,會透過 `usePaymentContext` 掛鉤提供給任何後代元件。這種模式確保您的支付元件始終能夠存取必要的上下文,而無需透過屬性傳遞。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![PaymentProvider](assets/diagram/payment-provider-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![PaymentProvider](assets/diagram/payment-provider-diagram-0.zh-TW.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## 設定與使用
@@ -8,8 +8,8 @@
8
8
 
9
9
  提供者在挂载时会初始化并从 Payment Kit 后端获取配置数据。这些数据连同用户会话和其他实用工具,通过 `usePaymentContext` 钩子提供给任何后代组件。这种模式确保您的支付组件始终能够访问必要的上下文,而无需进行属性钻取(prop drilling)。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
12
- ![PaymentProvider](assets/diagram/payment-provider-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1764919317 -->
12
+ ![PaymentProvider](assets/diagram/payment-provider-diagram-0.zh.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
  ## 设置和使用
@@ -4,29 +4,9 @@ Context Provider は `@blocklet/payment-react` の中心的な概念です。こ
4
4
 
5
5
  このライブラリのほとんどのコンポーネントを使用するには、アプリケーションまたは関連ページを適切なプロバイダーでラップする必要があります。
6
6
 
7
- ```d2 基本的なプロバイダー構造 icon=graph:flowchart
8
- direction: down
9
-
10
- あなたのアプリケーション: {
11
- shape: rectangle
12
-
13
- PaymentProvider: {
14
- label: "PaymentProvider"
15
- shape: rectangle
16
-
17
- CheckoutForm: {
18
- label: "CheckoutForm"
19
- }
20
- CustomerInvoiceList: {
21
- label: "CustomerInvoiceList"
22
- }
23
- }
24
- }
25
-
26
- あなたのアプリケーション -> PaymentProvider: "ラップする"
27
- PaymentProvider -> CheckoutForm: "コンテキストを提供"
28
- PaymentProvider -> CustomerInvoiceList: "コンテキストを提供"
29
- ```
7
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9::1765377042 -->
8
+ ![Providers](assets/diagram/providers-01.ja.jpg)
9
+ <!-- DIAGRAM_IMAGE_END -->
30
10
 
31
11
  このライブラリは、それぞれ異なる目的を果たす2つの主要なプロバイダーを提供しています。ニーズに合ったものを選択してください。
32
12
 
package/docs/providers.md CHANGED
@@ -1,42 +1,24 @@
1
1
  # Providers
2
2
 
3
- Context Providers are a core concept in `@blocklet/payment-react`. They act as wrappers around parts of your application, using React's Context API to pass down essential data and functions to all the components nested within them. This avoids the need to pass props down manually through many levels of your component tree.
3
+ To enable payment functionalities in your application, you must first wrap your components with the appropriate context providers. These providers use React's Context API to supply essential data and functions throughout your component tree, eliminating the need to pass props down manually.
4
4
 
5
- To use most of the components in this library, you must wrap your application or relevant pages with the appropriate provider.
5
+ Nearly all components in `@blocklet/payment-react` depend on a provider to function correctly. Wrapping your application or a specific page in a provider makes payment settings, user session information, and API clients available to all nested payment components.
6
6
 
7
- ```d2 Basic Provider Structure icon=graph:flowchart
8
- direction: down
7
+ The following diagram illustrates how these providers wrap your application components:
9
8
 
10
- Your-Application: {
11
- shape: rectangle
9
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1765377042 -->
10
+ ![Providers](assets/diagram/providers-01.jpg)
11
+ <!-- DIAGRAM_IMAGE_END -->
12
12
 
13
- PaymentProvider: {
14
- label: "PaymentProvider"
15
- shape: rectangle
13
+ The library includes two primary providers, each designed for a specific use case.
16
14
 
17
- CheckoutForm: {
18
- label: "CheckoutForm"
19
- }
20
- CustomerInvoiceList: {
21
- label: "CustomerInvoiceList"
22
- }
23
- }
24
- }
25
-
26
- Your-Application -> PaymentProvider: "Wraps"
27
- PaymentProvider -> CheckoutForm: "Provides context"
28
- PaymentProvider -> CustomerInvoiceList: "Provides context"
29
- ```
30
-
31
- The library offers two main providers, each serving a distinct purpose. Choose the one that fits your needs.
32
-
33
- <x-cards>
15
+ <x-cards data-columns="2">
34
16
  <x-card data-title="PaymentProvider" data-icon="lucide:package" data-href="/providers/payment-provider">
35
- The fundamental provider required for nearly all payment-related operations. It manages payment methods, currency settings, user session information, and provides a pre-configured API client.
17
+ The core provider required for all standard payment operations. It manages payment methods, currency settings, API access, and user session data.
36
18
  </x-card>
37
19
  <x-card data-title="DonateProvider" data-icon="lucide:heart" data-href="/providers/donate-provider">
38
- A specialized provider for donation features. It handles the configuration and state for donation widgets, such as those implemented with the CheckoutDonate component.
20
+ A specialized provider for donation features. It handles the unique settings and state management for donation components like `CheckoutDonate`.
39
21
  </x-card>
40
22
  </x-cards>
41
23
 
42
- Click on a provider above to view its detailed documentation, including required props and setup examples.
24
+ For detailed setup instructions and available properties, please refer to the documentation for each specific provider.