@blocklet/payment-react 1.23.0 → 1.23.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.
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 +3 -3
  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
@@ -2,92 +2,90 @@
2
2
 
3
3
  The `OverdueInvoicePayment` component is a specialized tool designed to handle the payment of overdue invoices for a specific customer or subscription. It simplifies the process by automatically fetching overdue invoices and presenting users with a clear interface to settle their outstanding payments.
4
4
 
5
- This component can operate in two modes: a default mode that displays a pre-built dialog for quick integration, and a custom mode that provides the flexibility to build a unique user interface using a render prop.
6
-
7
- ## How It Works
8
-
9
- The component orchestrates the entire overdue payment process, from fetching data to handling the final transaction confirmation.
10
-
11
- ```d2 Overdue Payment Flow
12
- direction: down
13
-
14
- User: {
15
- shape: c4-person
16
- }
17
-
18
- Client-App: {
19
- label: "Client Application"
20
- shape: rectangle
21
-
22
- OverdueInvoicePayment-Component: {
23
- label: "OverdueInvoicePayment Component"
24
- shape: rectangle
25
- }
26
- }
27
-
28
- Payment-Backend: {
29
- label: "Payment Backend"
30
- shape: cylinder
31
- }
32
-
33
- DID-Wallet: {
34
- label: "DID Wallet"
35
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
36
- }
37
-
38
- User -> Client-App.OverdueInvoicePayment-Component: "1. Renders the component"
39
- Client-App.OverdueInvoicePayment-Component -> Payment-Backend: "2. Fetch overdue invoices"
40
- Payment-Backend -> Client-App.OverdueInvoicePayment-Component: "3. Return invoice summary"
41
- Client-App.OverdueInvoicePayment-Component -> User: "4. Display payment dialog"
42
- User -> Client-App.OverdueInvoicePayment-Component: "5. Clicks 'Pay Now'"
43
- Client-App.OverdueInvoicePayment-Component -> DID-Wallet: "6. Opens connect session (collect-batch)"
44
- User -> DID-Wallet: "7. Approves payment"
45
- DID-Wallet -> Client-App.OverdueInvoicePayment-Component: "8. Sends success callback"
46
- Payment-Backend -> Client-App.OverdueInvoicePayment-Component: "9. WebSocket event (invoice.paid)"
47
- Client-App.OverdueInvoicePayment-Component -> User: "10. Update UI (e.g., close dialog)"
48
-
49
- ```
5
+ This component can operate in two modes: a default mode that displays a pre-built dialog for quick integration, and a custom mode that provides the flexibility to build a unique user interface using a render prop. It must be wrapped within a `PaymentProvider` to function correctly.
50
6
 
51
7
  ## Props
52
8
 
53
9
  The `OverdueInvoicePayment` component accepts the following props to customize its behavior:
54
10
 
55
- | Prop | Type | Description |
56
- |---|---|---|
57
- | `subscriptionId` | `string` | The ID of the subscription to check for overdue invoices. Either `subscriptionId` or `customerId` must be provided. |
58
- | `customerId` | `string` | The ID or DID of the customer. Use this to handle all overdue invoices for a customer. |
59
- | `mode` | `'default'` \| `'custom'` | The rendering mode. `'default'` shows a pre-built dialog. `'custom'` uses the `children` render prop for a custom UI. Defaults to `'default'`. |
60
- | `onPaid` | `(id, currencyId, type) => void` | An optional callback function that is triggered after payment is successfully completed. `id` will be the `subscriptionId` or `customerId`, `type` will be `'subscription'` or `'customer'`. |
61
- | `dialogProps` | `object` | Optional props to pass to the underlying Material-UI `Dialog` component in `default` mode. e.g., `{ open: true, title: 'Custom Title', onClose: handleClose }`. |
62
- | `detailLinkOptions` | `object` | Optional settings for the "View Details" link. Can be used to disable the link, change its text, or provide a custom `onClick` handler. Format: `{ enabled?: boolean, onClick?: function, title?: string }`. |
63
- | `successToast` | `boolean` | If `true`, a success toast notification is shown upon successful payment. Defaults to `true`. |
64
- | `alertMessage` | `string` | An optional message to append to the default title text when in customer mode. |
65
- | `children` | `(handlePay, data) => React.ReactNode` | A render prop function used only when `mode` is `'custom'`. It receives a `handlePay` function and a `data` object. |
66
- | `authToken` | `string` | An optional authentication token for API requests, useful for server-to-server or cross-origin scenarios. |
67
-
68
- ### `children` Render Prop
69
-
70
- When using `mode="custom"`, the `children` function receives two arguments:
71
-
72
- 1. **`handlePay(item: SummaryItem)`**: A function to initiate the payment process for a specific currency group. The `item` object comes from the `data.summary` object.
73
- 2. **`data`**: An object containing the fetched payment information:
74
- * `subscription?: Subscription`: The subscription details, if `subscriptionId` was provided.
75
- * `summary: { [key: string]: SummaryItem }`: An object where each key is a currency ID and the value contains the total amount, currency details, and payment method.
76
- * `invoices: Invoice[]`: An array of all overdue invoice objects.
77
- * `subscriptionCount?: number`: The number of subscriptions with overdue invoices (for customer mode).
78
- * `detailUrl: string`: The URL to view detailed invoice information.
11
+ <x-field-group>
12
+ <x-field data-name="subscriptionId" data-type="string" data-required="false">
13
+ <x-field-desc markdown>The ID of the subscription to check for overdue invoices. Either `subscriptionId` or `customerId` must be provided.</x-field-desc>
14
+ </x-field>
15
+ <x-field data-name="customerId" data-type="string" data-required="false">
16
+ <x-field-desc markdown>The ID or DID of the customer. Use this to handle all overdue invoices for a specific customer.</x-field-desc>
17
+ </x-field>
18
+ <x-field data-name="mode" data-type="'default' | 'custom'" data-default="default" data-required="false">
19
+ <x-field-desc markdown>The rendering mode. `'default'` shows a pre-built dialog. `'custom'` uses the `children` render prop for a custom UI.</x-field-desc>
20
+ </x-field>
21
+ <x-field data-name="onPaid" data-type="function" data-required="false">
22
+ <x-field-desc markdown>An optional callback function that is triggered after payment for a specific currency is successfully completed. It receives `(id, currencyId, type)`, where `id` is the `subscriptionId` or `customerId`, and `type` is `'subscription'` or `'customer'`.</x-field-desc>
23
+ <x-field data-name="parameters" data-type="object">
24
+ <x-field data-name="id" data-type="string" data-desc="The subscriptionId or customerId."></x-field>
25
+ <x-field data-name="currencyId" data-type="string" data-desc="The ID of the currency used for payment."></x-field>
26
+ <x-field data-name="type" data-type="'subscription' | 'customer'" data-desc="Indicates if the payment was for a subscription or a customer."></x-field>
27
+ </x-field>
28
+ </x-field>
29
+ <x-field data-name="dialogProps" data-type="object" data-required="false">
30
+ <x-field-desc markdown>Optional props to pass to the underlying Material-UI `Dialog` component in `default` mode. For example, `{ open: true, title: 'Custom Title', onClose: handleClose }`.</x-field-desc>
31
+ </x-field>
32
+ <x-field data-name="detailLinkOptions" data-type="object" data-required="false">
33
+ <x-field-desc markdown>Optional settings for the "View Details" link. Can be used to disable the link, change its text, or provide a custom `onClick` handler.</x-field-desc>
34
+ <x-field data-name="enabled" data-type="boolean" data-required="false" data-desc="Whether the link is enabled."></x-field>
35
+ <x-field data-name="onClick" data-type="(e: React.MouseEvent) => void" data-required="false" data-desc="Custom click handler."></x-field>
36
+ <x-field data-name="title" data-type="string" data-required="false" data-desc="Custom link text."></x-field>
37
+ </x-field>
38
+ <x-field data-name="successToast" data-type="boolean" data-default="true" data-required="false">
39
+ <x-field-desc markdown>If `true`, a success toast notification is shown upon successful payment.</x-field-desc>
40
+ </x-field>
41
+ <x-field data-name="alertMessage" data-type="string" data-required="false">
42
+ <x-field-desc markdown>An optional message to append to the default title text when in customer mode.</x-field-desc>
43
+ </x-field>
44
+ <x-field data-name="children" data-type="function" data-required="false">
45
+ <x-field-desc markdown>A render prop function used only when `mode` is `'custom'`. It receives a `handlePay` function and a `data` object.</x-field-desc>
46
+ <x-field data-name="parameters" data-type="object">
47
+ <x-field data-name="handlePay" data-type="(item: SummaryItem) => void" data-desc="Function to initiate the payment process for a specific currency group."></x-field>
48
+ <x-field data-name="data" data-type="object" data-desc="An object containing the fetched payment information."></x-field>
49
+ </x-field>
50
+ </x-field>
51
+ <x-field data-name="authToken" data-type="string" data-required="false">
52
+ <x-field-desc markdown>An optional authentication token for API requests, useful for server-to-server or cross-origin scenarios.</x-field-desc>
53
+ </x-field>
54
+ </x-field-group>
55
+
56
+ ### `children` Render Prop Data
57
+
58
+ When using `mode="custom"`, the `data` object passed to the `children` function contains the following fields:
59
+
60
+ <x-field-group>
61
+ <x-field data-name="subscription" data-type="Subscription" data-required="false">
62
+ <x-field-desc markdown>The subscription details, if `subscriptionId` was provided.</x-field-desc>
63
+ </x-field>
64
+ <x-field data-name="summary" data-type="{ [key: string]: SummaryItem }" data-required="true">
65
+ <x-field-desc markdown>An object where each key is a currency ID. The value contains the total amount, currency details, and payment method for that currency.</x-field-desc>
66
+ </x-field>
67
+ <x-field data-name="invoices" data-type="Invoice[]" data-required="true">
68
+ <x-field-desc markdown>An array of all overdue invoice objects.</x-field-desc>
69
+ </x-field>
70
+ <x-field data-name="subscriptionCount" data-type="number" data-required="false">
71
+ <x-field-desc markdown>The number of subscriptions with overdue invoices (for customer mode).</x-field-desc>
72
+ </x-field>
73
+ <x-field data-name="detailUrl" data-type="string" data-required="true">
74
+ <x-field-desc markdown>The URL to view detailed invoice information.</x-field-desc>
75
+ </x-field>
76
+ </x-field-group>
79
77
 
80
78
  ## Usage Examples
81
79
 
82
- All examples assume you have `PaymentProvider` set up in your application.
80
+ All examples assume you have `PaymentProvider` set up in your application as detailed in the [PaymentProvider documentation](./providers-payment-provider.md).
83
81
 
84
82
  ### 1. Default Mode for a Subscription
85
83
 
86
84
  This is the simplest way to handle overdue payments for a specific subscription. The component will automatically render a dialog if any overdue invoices are found.
87
85
 
88
- ```tsx SubscriptionOverdue.tsx icon=logos:react
86
+ ```javascript SubscriptionOverdue.jsx icon=logos:react
89
87
  import { OverdueInvoicePayment, PaymentProvider } from '@blocklet/payment-react';
90
- import { useSessionContext } from './hooks/session'; // Your custom session hook
88
+ import { useSessionContext } from '../hooks/session'; // Your custom session hook
91
89
 
92
90
  function SubscriptionPage({ subscriptionId }) {
93
91
  const { session, connect } = useSessionContext();
@@ -100,10 +98,7 @@ function SubscriptionPage({ subscriptionId }) {
100
98
  return (
101
99
  <PaymentProvider session={session} connect={connect}>
102
100
  {/* This component will be null if there are no overdue invoices */}
103
- <OverdueInvoicePayment
104
- subscriptionId={subscriptionId}
105
- onPaid={handlePaymentSuccess}
106
- />
101
+ <OverdueInvoicePayment subscriptionId={subscriptionId} onPaid={handlePaymentSuccess} />
107
102
  {/* Other subscription details can be rendered here */}
108
103
  </PaymentProvider>
109
104
  );
@@ -114,9 +109,9 @@ function SubscriptionPage({ subscriptionId }) {
114
109
 
115
110
  Use this to create a centralized place for a customer to pay all their overdue invoices across multiple subscriptions.
116
111
 
117
- ```tsx CustomerDashboard.tsx icon=logos:react
112
+ ```javascript CustomerDashboard.jsx icon=logos:react
118
113
  import { OverdueInvoicePayment, PaymentProvider } from '@blocklet/payment-react';
119
- import { useSessionContext } from './hooks/session'; // Your custom session hook
114
+ import { useSessionContext } from '../hooks/session'; // Your custom session hook
120
115
 
121
116
  function CustomerDashboard() {
122
117
  const { session, connect } = useSessionContext();
@@ -142,21 +137,30 @@ function CustomerDashboard() {
142
137
 
143
138
  For full control over the user experience, use `mode="custom"`. This allows you to integrate the payment functionality directly into your existing UI instead of using a dialog.
144
139
 
145
- ```tsx CustomOverdueUI.tsx icon=logos:react
146
- import { OverdueInvoicePayment, PaymentProvider, Amount } from '@blocklet/payment-react';
147
- import { useSessionContext } from './hooks/session'; // Your custom session hook
140
+ ```javascript CustomOverdueUI.jsx icon=logos:react
141
+ import { OverdueInvoicePayment, PaymentProvider } from '@blocklet/payment-react';
142
+ import { useSessionContext } from '../hooks/session'; // Your custom session hook
148
143
  import { Card, CardContent, Typography, Button, Stack } from '@mui/material';
149
144
 
150
145
  function CustomOverdueUI({ subscriptionId }) {
151
146
  const { session, connect } = useSessionContext();
152
147
 
148
+ // A simple Amount component for formatting
149
+ const Amount = ({ amount, decimal, symbol }) => {
150
+ const formattedAmount = (parseInt(amount, 10) / 10 ** (decimal || 0)).toFixed(2);
151
+ return (
152
+ <strong>
153
+ {formattedAmount} {symbol}
154
+ </strong>
155
+ );
156
+ };
157
+
153
158
  return (
154
159
  <PaymentProvider session={session} connect={connect}>
155
160
  <OverdueInvoicePayment
156
161
  subscriptionId={subscriptionId}
157
162
  mode="custom"
158
- onPaid={() => console.log('Custom UI payment successful!')}
159
- >
163
+ onPaid={() => console.log('Custom UI payment successful!')}>
160
164
  {(handlePay, { summary, invoices }) => {
161
165
  const summaryList = Object.values(summary);
162
166
  if (invoices.length === 0) {
@@ -170,16 +174,17 @@ function CustomOverdueUI({ subscriptionId }) {
170
174
  You have {invoices.length} overdue invoice(s).
171
175
  </Typography>
172
176
  <Stack spacing={2} mt={2}>
173
- {summaryList.map((item) => (
177
+ {summaryList.map(item => (
174
178
  <Stack key={item.currency.id} direction="row" justifyContent="space-between" alignItems="center">
175
179
  <Typography>
176
- Total Due: <Amount amount={item.amount} decimal={item.currency.decimal} symbol={item.currency.symbol} />
180
+ Total Due:{' '}
181
+ <Amount
182
+ amount={item.amount}
183
+ decimal={item.currency.decimal}
184
+ symbol={item.currency.symbol}
185
+ />
177
186
  </Typography>
178
- <Button
179
- variant="contained"
180
- color="primary"
181
- onClick={() => handlePay(item)}
182
- >
187
+ <Button variant="contained" color="primary" onClick={() => handlePay(item)}>
183
188
  Pay with {item.currency.symbol}
184
189
  </Button>
185
190
  </Stack>
@@ -194,3 +199,7 @@ function CustomOverdueUI({ subscriptionId }) {
194
199
  );
195
200
  }
196
201
  ```
202
+
203
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765377372 -->
204
+ ![OverdueInvoicePayment](assets/diagram/components-business-overdue-invoice-payment-01.jpg)
205
+ <!-- DIAGRAM_IMAGE_END -->
@@ -8,46 +8,9 @@
8
8
 
9
9
  該元件協調整個逾期付款流程,從擷取資料到處理最終的交易確認。
10
10
 
11
- ```d2 逾期支付流程
12
- direction: down
13
-
14
- User: {
15
- label: "使用者"
16
- shape: c4-person
17
- }
18
-
19
- Client-App: {
20
- label: "客戶端應用程式"
21
- shape: rectangle
22
-
23
- OverdueInvoicePayment-Component: {
24
- label: "OverdueInvoicePayment 元件"
25
- shape: rectangle
26
- }
27
- }
28
-
29
- Payment-Backend: {
30
- label: "支付後端"
31
- shape: cylinder
32
- }
33
-
34
- DID-Wallet: {
35
- label: "DID 錢包"
36
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
37
- }
38
-
39
- User -> Client-App.OverdueInvoicePayment-Component: "1. 渲染元件"
40
- Client-App.OverdueInvoicePayment-Component -> Payment-Backend: "2. 擷取逾期發票"
41
- Payment-Backend -> Client-App.OverdueInvoicePayment-Component: "3. 回傳發票摘要"
42
- Client-App.OverdueInvoicePayment-Component -> User: "4. 顯示支付對話方塊"
43
- User -> Client-App.OverdueInvoicePayment-Component: "5. 點擊「立即支付」"
44
- Client-App.OverdueInvoicePayment-Component -> DID-Wallet: "6. 開啟連接會話 (collect-batch)"
45
- User -> DID-Wallet: "7. 批准支付"
46
- DID-Wallet -> Client-App.OverdueInvoicePayment-Component: "8. 發送成功回呼"
47
- Payment-Backend -> Client-App.OverdueInvoicePayment-Component: "9. WebSocket 事件 (invoice.paid)"
48
- Client-App.OverdueInvoicePayment-Component -> User: "10. 更新 UI (例如,關閉對話方塊)"
49
-
50
- ```
11
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3::1765377372 -->
12
+ ![OverdueInvoicePayment](assets/diagram/components-business-overdue-invoice-payment-01.zh-TW.jpg)
13
+ <!-- DIAGRAM_IMAGE_END -->
51
14
 
52
15
  ## Props
53
16
 
@@ -8,46 +8,9 @@
8
8
 
9
9
  该组件协调整个逾期支付过程,从获取数据到处理最终的交易确认。
10
10
 
11
- ```d2 Overdue Payment Flow
12
- direction: down
13
-
14
- User: {
15
- shape: c4-person
16
- label: "用户"
17
- }
18
-
19
- Client-App: {
20
- label: "客户端应用"
21
- shape: rectangle
22
-
23
- OverdueInvoicePayment-Component: {
24
- label: "OverdueInvoicePayment 组件"
25
- shape: rectangle
26
- }
27
- }
28
-
29
- Payment-Backend: {
30
- label: "支付后端"
31
- shape: cylinder
32
- }
33
-
34
- DID-Wallet: {
35
- label: "DID 钱包"
36
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
37
- }
38
-
39
- User -> Client-App.OverdueInvoicePayment-Component: "1. 渲染组件"
40
- Client-App.OverdueInvoicePayment-Component -> Payment-Backend: "2. 获取逾期发票"
41
- Payment-Backend -> Client-App.OverdueInvoicePayment-Component: "3. 返回发票摘要"
42
- Client-App.OverdueInvoicePayment-Component -> User: "4. 显示支付对话框"
43
- User -> Client-App.OverdueInvoicePayment-Component: "5. 点击“立即支付”"
44
- Client-App.OverdueInvoicePayment-Component -> DID-Wallet: "6. 打开连接会话 (collect-batch)"
45
- User -> DID-Wallet: "7. 批准支付"
46
- DID-Wallet -> Client-App.OverdueInvoicePayment-Component: "8. 发送成功回调"
47
- Payment-Backend -> Client-App.OverdueInvoicePayment-Component: "9. WebSocket 事件 (invoice.paid)"
48
- Client-App.OverdueInvoicePayment-Component -> User: "10. 更新 UI (例如,关闭对话框)"
49
-
50
- ```
11
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3::1765377372 -->
12
+ ![OverdueInvoicePayment](assets/diagram/components-business-overdue-invoice-payment-01.zh.jpg)
13
+ <!-- DIAGRAM_IMAGE_END -->
51
14
 
52
15
  ## 属性
53
16
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  以下の図は、ユーザーがサブスクリプションを再開する際のプロセスフローを示したもので、再ステーキングの条件分岐ロジックも含まれています。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
12
- ![ResumeSubscription](assets/diagram/resume-subscription-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:sequence:4:3:1764919317 -->
12
+ ![ResumeSubscription](assets/diagram/resume-subscription-diagram-0.ja.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
 
@@ -8,7 +8,7 @@ This component must be used within a `PaymentProvider` to access the necessary c
8
8
 
9
9
  The following diagram illustrates the process flow when a user resumes a subscription, including the conditional logic for re-staking.
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
11
+ <!-- DIAGRAM_IMAGE_START:sequence:4:3:1764919317 -->
12
12
  ![ResumeSubscription](assets/diagram/resume-subscription-diagram-0.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  下圖說明了使用者恢復訂閱時的流程,包括重新質押的條件邏輯。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
12
- ![ResumeSubscription](assets/diagram/resume-subscription-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:sequence:4:3::1764919317 -->
12
+ ![ResumeSubscription](assets/diagram/resume-subscription-diagram-0.zh-TW.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  下图说明了用户恢复订阅时的流程,包括重新质押的条件逻辑。
10
10
 
11
- <!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
12
- ![ResumeSubscription](assets/diagram/resume-subscription-diagram-0.jpg)
11
+ <!-- DIAGRAM_IMAGE_START:sequence:4:3:1764919317 -->
12
+ ![ResumeSubscription](assets/diagram/resume-subscription-diagram-0.zh.jpg)
13
13
  <!-- DIAGRAM_IMAGE_END -->
14
14
 
15
15
 
@@ -8,42 +8,9 @@
8
8
 
9
9
  寄付のフローは`DonateProvider`と`CheckoutDonate`の組み合わせによって調整されます。以下にその概要を示します。
10
10
 
11
- ```d2 How It Works icon=graph-ql:diagram
12
- direction: down
13
-
14
- user: {
15
- shape: c4-person
16
- }
17
-
18
- app: {
19
- label: "あなたのReactアプリ"
20
-
21
- checkout-donate: {
22
- label: "CheckoutDonate"
23
- }
24
-
25
- checkout-form: {
26
- label: "CheckoutForm (ダイアログ内)"
27
- }
28
- }
29
-
30
- payment-api: {
31
- label: "決済バックエンドAPI"
32
- shape: cylinder
33
- }
34
-
35
- # Initial Load
36
- app.checkout-donate -> payment-api: "設定と支援者を取得"
37
-
38
- # Donation Flow
39
- user -> app.checkout-donate: "1. 寄付をクリック"
40
- app.checkout-donate -> app.checkout-form: "2. CheckoutFormを含むダイアログを開く"
41
- app.checkout-form -> payment-api: "3. 支払いを処理"
42
- payment-api -> app.checkout-form: "4. 成功を返す"
43
- app.checkout-form -> app.checkout-donate: "5. onPaidコールバックをトリガー"
44
- app.checkout-donate -> payment-api: "6. 支援者リストを再取得"
45
- payment-api -> app.checkout-donate: "7. 更新された支援者を返す"
46
- ```
11
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3::1765377352 -->
12
+ ![CheckoutDonate](assets/diagram/components-checkout-checkout-donate-01.ja.jpg)
13
+ <!-- DIAGRAM_IMAGE_END -->
47
14
 
48
15
  1. **初期化**:`DonateProvider`は、一意の`mountLocation`によって識別されるバックエンドから、寄付設定(プリセット金額、ボタンテキストなど)を取得してキャッシュします。
49
16
  2. **レンダリング**:`CheckoutDonate`は、取得した設定と自身のpropsに基づいて、ボタンまたはカスタムUIをレンダリングします。