@blocklet/payment-react 1.22.27 → 1.22.28
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/docs/assets/diagram/auto-topup-diagram-0.jpg +0 -0
- package/docs/assets/diagram/components-diagram-0.jpg +0 -0
- package/docs/assets/diagram/payment-provider-diagram-0.jpg +0 -0
- package/docs/assets/diagram/phone-input-diagram-0.jpg +0 -0
- package/docs/assets/diagram/resume-subscription-diagram-0.jpg +0 -0
- package/docs/assets/diagram/use-subscription-diagram-0.jpg +0 -0
- package/docs/components-business-auto-topup.ja.md +3 -36
- package/docs/components-business-auto-topup.md +3 -36
- package/docs/components-business-auto-topup.zh-TW.md +3 -36
- package/docs/components-business-auto-topup.zh.md +3 -36
- package/docs/components-business-resume-subscription.ja.md +3 -31
- package/docs/components-business-resume-subscription.md +3 -31
- package/docs/components-business-resume-subscription.zh-TW.md +3 -31
- package/docs/components-business-resume-subscription.zh.md +3 -31
- package/docs/components-ui-form-elements-phone-input.ja.md +3 -32
- package/docs/components-ui-form-elements-phone-input.md +4 -33
- package/docs/components-ui-form-elements-phone-input.zh-TW.md +3 -32
- package/docs/components-ui-form-elements-phone-input.zh.md +3 -33
- package/docs/components.ja.md +3 -44
- package/docs/components.md +4 -45
- package/docs/components.zh-TW.md +3 -44
- package/docs/components.zh.md +3 -44
- package/docs/hooks-use-subscription.ja.md +3 -30
- package/docs/hooks-use-subscription.md +4 -29
- package/docs/hooks-use-subscription.zh-TW.md +3 -30
- package/docs/hooks-use-subscription.zh.md +3 -30
- package/docs/providers-payment-provider.ja.md +3 -29
- package/docs/providers-payment-provider.md +4 -28
- package/docs/providers-payment-provider.zh-TW.md +3 -29
- package/docs/providers-payment-provider.zh.md +3 -29
- package/package.json +3 -3
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -6,42 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
以下の図は、自動チャージ機能設定の典型的なユーザーフローを示しています。ユーザーは`AutoTopup`表示コンポーネントを操作し、それが変更を行うための`AutoTopupModal`を起動します。その後、モーダルはバックエンドAPIと通信して設定を保存します。
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
User: {
|
|
13
|
-
shape: c4-person
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
Application-UI: {
|
|
17
|
-
label: "アプリケーションUI"
|
|
18
|
-
shape: rectangle
|
|
19
|
-
|
|
20
|
-
AutoTopup-Card: {
|
|
21
|
-
label: "AutoTopupコンポーネント"
|
|
22
|
-
shape: rectangle
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
AutoTopup-Modal: {
|
|
26
|
-
label: "AutoTopupModal"
|
|
27
|
-
shape: rectangle
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Payment-API: {
|
|
32
|
-
label: "支払いAPI"
|
|
33
|
-
shape: cylinder
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
User -> Application-UI.AutoTopup-Card: "1. 自動チャージのステータスを表示"
|
|
37
|
-
Application-UI.AutoTopup-Card -> Application-UI.AutoTopup-Modal: "2. '設定'をクリックしてモーダルを開く"
|
|
38
|
-
User -> Application-UI.AutoTopup-Modal: "3. 設定を調整して保存"
|
|
39
|
-
Application-UI.AutoTopup-Modal -> Payment-API: "4. 設定を送信"
|
|
40
|
-
Payment-API -> Payment-API: "5. 設定を保存"
|
|
41
|
-
Payment-API -> Application-UI.AutoTopup-Modal: "6. 成功を返す"
|
|
42
|
-
Application-UI.AutoTopup-Modal -> Application-UI.AutoTopup-Card: "7. onSuccessを呼び出し、UIを更新"
|
|
43
|
-
|
|
44
|
-
```
|
|
9
|
+
<!-- DIAGRAM_IMAGE_START:flowchart:16:9 -->
|
|
10
|
+

|
|
11
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
45
12
|
|
|
46
13
|
## AutoTopup
|
|
47
14
|
|
|
@@ -6,42 +6,9 @@ The auto-topup feature ensures uninterrupted service by automatically recharging
|
|
|
6
6
|
|
|
7
7
|
The diagram below illustrates the typical user flow for configuring the auto-topup feature. The user interacts with the `AutoTopup` display component, which launches the `AutoTopupModal` for making changes. The modal then communicates with the backend API to save the configuration.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
User: {
|
|
13
|
-
shape: c4-person
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
Application-UI: {
|
|
17
|
-
label: "Application UI"
|
|
18
|
-
shape: rectangle
|
|
19
|
-
|
|
20
|
-
AutoTopup-Card: {
|
|
21
|
-
label: "AutoTopup Component"
|
|
22
|
-
shape: rectangle
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
AutoTopup-Modal: {
|
|
26
|
-
label: "AutoTopupModal"
|
|
27
|
-
shape: rectangle
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Payment-API: {
|
|
32
|
-
label: "Payment API"
|
|
33
|
-
shape: cylinder
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
User -> Application-UI.AutoTopup-Card: "1. Views auto-topup status"
|
|
37
|
-
Application-UI.AutoTopup-Card -> Application-UI.AutoTopup-Modal: "2. Clicks 'Configure' to open modal"
|
|
38
|
-
User -> Application-UI.AutoTopup-Modal: "3. Adjusts settings & saves"
|
|
39
|
-
Application-UI.AutoTopup-Modal -> Payment-API: "4. Submit configuration"
|
|
40
|
-
Payment-API -> Payment-API: "5. Save configuration"
|
|
41
|
-
Payment-API -> Application-UI.AutoTopup-Modal: "6. Return success"
|
|
42
|
-
Application-UI.AutoTopup-Modal -> Application-UI.AutoTopup-Card: "7. Calls onSuccess, UI updates"
|
|
43
|
-
|
|
44
|
-
```
|
|
9
|
+
<!-- DIAGRAM_IMAGE_START:flowchart:16:9 -->
|
|
10
|
+

|
|
11
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
45
12
|
|
|
46
13
|
## AutoTopup
|
|
47
14
|
|
|
@@ -6,42 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
下圖說明了使用者設定自動儲值功能的典型流程。使用者與 `AutoTopup` 顯示元件互動,該元件會啟動 `AutoTopupModal` 以進行變更。然後,彈出視窗會與後端 API 通訊以儲存設定。
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
User: {
|
|
13
|
-
shape: c4-person
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
Application-UI: {
|
|
17
|
-
label: "應用程式 UI"
|
|
18
|
-
shape: rectangle
|
|
19
|
-
|
|
20
|
-
AutoTopup-Card: {
|
|
21
|
-
label: "AutoTopup 元件"
|
|
22
|
-
shape: rectangle
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
AutoTopup-Modal: {
|
|
26
|
-
label: "AutoTopupModal"
|
|
27
|
-
shape: rectangle
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Payment-API: {
|
|
32
|
-
label: "支付 API"
|
|
33
|
-
shape: cylinder
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
User -> Application-UI.AutoTopup-Card: "1. 查看自動儲值狀態"
|
|
37
|
-
Application-UI.AutoTopup-Card -> Application-UI.AutoTopup-Modal: "2. 點擊「設定」開啟彈出視窗"
|
|
38
|
-
User -> Application-UI.AutoTopup-Modal: "3. 調整設定並儲存"
|
|
39
|
-
Application-UI.AutoTopup-Modal -> Payment-API: "4. 提交設定"
|
|
40
|
-
Payment-API -> Payment-API: "5. 儲存設定"
|
|
41
|
-
Payment-API -> Application-UI.AutoTopup-Modal: "6. 回傳成功"
|
|
42
|
-
Application-UI.AutoTopup-Modal -> Application-UI.AutoTopup-Card: "7. 呼叫 onSuccess,UI 更新"
|
|
43
|
-
|
|
44
|
-
```
|
|
9
|
+
<!-- DIAGRAM_IMAGE_START:flowchart:16:9 -->
|
|
10
|
+

|
|
11
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
45
12
|
|
|
46
13
|
## AutoTopup
|
|
47
14
|
|
|
@@ -6,42 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
下图展示了配置自动充值功能的典型用户流程。用户与 `AutoTopup` 显示组件交互,该组件会启动 `AutoTopupModal` 以进行更改。然后,该模态框与后端 API 通信以保存配置。
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
User: {
|
|
13
|
-
shape: c4-person
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
Application-UI: {
|
|
17
|
-
label: "应用程序 UI"
|
|
18
|
-
shape: rectangle
|
|
19
|
-
|
|
20
|
-
AutoTopup-Card: {
|
|
21
|
-
label: "AutoTopup 组件"
|
|
22
|
-
shape: rectangle
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
AutoTopup-Modal: {
|
|
26
|
-
label: "AutoTopupModal"
|
|
27
|
-
shape: rectangle
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Payment-API: {
|
|
32
|
-
label: "支付 API"
|
|
33
|
-
shape: cylinder
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
User -> Application-UI.AutoTopup-Card: "1. 查看自动充值状态"
|
|
37
|
-
Application-UI.AutoTopup-Card -> Application-UI.AutoTopup-Modal: "2. 点击“配置”打开模态框"
|
|
38
|
-
User -> Application-UI.AutoTopup-Modal: "3. 调整设置并保存"
|
|
39
|
-
Application-UI.AutoTopup-Modal -> Payment-API: "4. 提交配置"
|
|
40
|
-
Payment-API -> Payment-API: "5. 保存配置"
|
|
41
|
-
Payment-API -> Application-UI.AutoTopup-Modal: "6. 返回成功"
|
|
42
|
-
Application-UI.AutoTopup-Modal -> Application-UI.AutoTopup-Card: "7. 调用 onSuccess,UI 更新"
|
|
43
|
-
|
|
44
|
-
```
|
|
9
|
+
<!-- DIAGRAM_IMAGE_START:flowchart:16:9 -->
|
|
10
|
+

|
|
11
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
45
12
|
|
|
46
13
|
## AutoTopup
|
|
47
14
|
|
|
@@ -8,37 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
以下の図は、ユーザーがサブスクリプションを再開する際のプロセスフローを示したもので、再ステーキングの条件分岐ロジックも含まれています。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: { label: "ユーザー"; shape: c4-person }
|
|
15
|
-
ResumeSubscription: { label: "ResumeSubscription コンポーネント" }
|
|
16
|
-
PaymentAPI: { label: "決済API" }
|
|
17
|
-
DIDWallet: { label: "DID Wallet" }
|
|
18
|
-
|
|
19
|
-
User -> ResumeSubscription: "1. 再開をトリガー"
|
|
20
|
-
ResumeSubscription -> PaymentAPI: "2. GET /recover-info"
|
|
21
|
-
PaymentAPI -> ResumeSubscription: "3. ステータスを返す\n(例: needStake: true)"
|
|
22
|
-
|
|
23
|
-
ResumeSubscription.t1 -> User: "4. 確認ダイアログを表示"
|
|
24
|
-
User -> ResumeSubscription.t1: "5. 確認"
|
|
25
|
-
|
|
26
|
-
alt "再ステーキングが必要" {
|
|
27
|
-
ResumeSubscription.t1 -> DIDWallet: "6a. 再ステークセッションを開く"
|
|
28
|
-
User -> DIDWallet: "7a. 承認"
|
|
29
|
-
DIDWallet -> ResumeSubscription.t1: "8a. 成功コールバック"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
alt "ステーキング不要" {
|
|
33
|
-
ResumeSubscription.t1 -> PaymentAPI: "6b. PUT /recover"
|
|
34
|
-
PaymentAPI -> ResumeSubscription.t1: "7b. 成功"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ResumeSubscription.t1 -> PaymentAPI: "9. 更新されたサブスクリプションを取得"
|
|
38
|
-
PaymentAPI -> ResumeSubscription.t1: "10. サブスクリプションを返す"
|
|
39
|
-
ResumeSubscription.t1 -> User: "11. onResumed()を呼び出し、ダイアログを閉じる"
|
|
40
|
-
|
|
41
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
42
14
|
|
|
43
15
|
|
|
44
16
|
## Props
|
|
@@ -8,37 +8,9 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: { shape: c4-person }
|
|
15
|
-
ResumeSubscription: { label: "ResumeSubscription Component" }
|
|
16
|
-
PaymentAPI: { label: "Payment API" }
|
|
17
|
-
DIDWallet: { label: "DID Wallet" }
|
|
18
|
-
|
|
19
|
-
User -> ResumeSubscription: "1. Triggers resume"
|
|
20
|
-
ResumeSubscription -> PaymentAPI: "2. GET /recover-info"
|
|
21
|
-
PaymentAPI -> ResumeSubscription: "3. Return status\n(e.g., needStake: true)"
|
|
22
|
-
|
|
23
|
-
ResumeSubscription.t1 -> User: "4. Show confirmation dialog"
|
|
24
|
-
User -> ResumeSubscription.t1: "5. Confirm"
|
|
25
|
-
|
|
26
|
-
alt "Re-Staking Required" {
|
|
27
|
-
ResumeSubscription.t1 -> DIDWallet: "6a. Open re-stake session"
|
|
28
|
-
User -> DIDWallet: "7a. Approve"
|
|
29
|
-
DIDWallet -> ResumeSubscription.t1: "8a. Success callback"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
alt "No Staking Required" {
|
|
33
|
-
ResumeSubscription.t1 -> PaymentAPI: "6b. PUT /recover"
|
|
34
|
-
PaymentAPI -> ResumeSubscription.t1: "7b. Success"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ResumeSubscription.t1 -> PaymentAPI: "9. Fetch updated subscription"
|
|
38
|
-
PaymentAPI -> ResumeSubscription.t1: "10. Return subscription"
|
|
39
|
-
ResumeSubscription.t1 -> User: "11. Call onResumed() & close dialog"
|
|
40
|
-
|
|
41
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
42
14
|
|
|
43
15
|
|
|
44
16
|
## Props
|
|
@@ -8,37 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
下圖說明了使用者恢復訂閱時的流程,包括重新質押的條件邏輯。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: { shape: c4-person }
|
|
15
|
-
ResumeSubscription: { label: "ResumeSubscription 元件" }
|
|
16
|
-
PaymentAPI: { label: "Payment API" }
|
|
17
|
-
DIDWallet: { label: "DID 錢包" }
|
|
18
|
-
|
|
19
|
-
User -> ResumeSubscription: "1. 觸發恢復"
|
|
20
|
-
ResumeSubscription -> PaymentAPI: "2. GET /recover-info"
|
|
21
|
-
PaymentAPI -> ResumeSubscription: "3. 返回狀態\n(例如:needStake: true)"
|
|
22
|
-
|
|
23
|
-
ResumeSubscription.t1 -> User: "4. 顯示確認對話方塊"
|
|
24
|
-
User -> ResumeSubscription.t1: "5. 確認"
|
|
25
|
-
|
|
26
|
-
alt "需要重新質押" {
|
|
27
|
-
ResumeSubscription.t1 -> DIDWallet: "6a. 開啟重新質押會話"
|
|
28
|
-
User -> DIDWallet: "7a. 批准"
|
|
29
|
-
DIDWallet -> ResumeSubscription.t1: "8a. 成功回呼"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
alt "無需質押" {
|
|
33
|
-
ResumeSubscription.t1 -> PaymentAPI: "6b. PUT /recover"
|
|
34
|
-
PaymentAPI -> ResumeSubscription.t1: "7b. 成功"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ResumeSubscription.t1 -> PaymentAPI: "9. 取得更新後的訂閱"
|
|
38
|
-
PaymentAPI -> ResumeSubscription.t1: "10. 返回訂閱"
|
|
39
|
-
ResumeSubscription.t1 -> User: "11. 呼叫 onResumed() 並關閉對話方塊"
|
|
40
|
-
|
|
41
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
42
14
|
|
|
43
15
|
|
|
44
16
|
## Props
|
|
@@ -8,37 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
下图说明了用户恢复订阅时的流程,包括重新质押的条件逻辑。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: { shape: c4-person }
|
|
15
|
-
ResumeSubscription: { label: "ResumeSubscription 组件" }
|
|
16
|
-
PaymentAPI: { label: "Payment API" }
|
|
17
|
-
DIDWallet: { label: "DID Wallet" }
|
|
18
|
-
|
|
19
|
-
User -> ResumeSubscription: "1. 触发恢复"
|
|
20
|
-
ResumeSubscription -> PaymentAPI: "2. GET /recover-info"
|
|
21
|
-
PaymentAPI -> ResumeSubscription: "3. 返回状态\n(例如,needStake: true)"
|
|
22
|
-
|
|
23
|
-
ResumeSubscription.t1 -> User: "4. 显示确认对话框"
|
|
24
|
-
User -> ResumeSubscription.t1: "5. 确认"
|
|
25
|
-
|
|
26
|
-
alt "需要重新质押" {
|
|
27
|
-
ResumeSubscription.t1 -> DIDWallet: "6a. 打开重新质押会话"
|
|
28
|
-
User -> DIDWallet: "7a. 批准"
|
|
29
|
-
DIDWallet -> ResumeSubscription.t1: "8a. 成功回调"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
alt "无需质押" {
|
|
33
|
-
ResumeSubscription.t1 -> PaymentAPI: "6b. PUT /recover"
|
|
34
|
-
PaymentAPI -> ResumeSubscription.t1: "7b. 成功"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ResumeSubscription.t1 -> PaymentAPI: "9. 获取更新后的订阅"
|
|
38
|
-
PaymentAPI -> ResumeSubscription.t1: "10. 返回订阅"
|
|
39
|
-
ResumeSubscription.t1 -> User: "11. 调用 onResumed() 并关闭对话框"
|
|
40
|
-
|
|
41
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:sequence:4:3 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
42
14
|
|
|
43
15
|
|
|
44
16
|
## Props
|
|
@@ -8,38 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
このコンポーネントは、`react-international-phone`ライブラリをコア機能として活用し、それをラップして`react-hook-form`およびMaterial-UIとの深い統合を提供します。ユーザーが国を選択したり番号を入力したりすると、コンポーネントはフォームの状態にある対応するフィールドを更新します。また、他のコンポーネントがフォーム内のリンクされた国フィールドを変更すると、自動的に国選択を更新します。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
shape: c4-person
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Form-State: {
|
|
19
|
-
label: "React Hook Form の状態"
|
|
20
|
-
shape: cylinder
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
PhoneInput-Component: {
|
|
24
|
-
label: "PhoneInput コンポーネント"
|
|
25
|
-
|
|
26
|
-
CountrySelect: {
|
|
27
|
-
label: "CountrySelect"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Phone-Field: {
|
|
31
|
-
label: "電話番号テキストフィールド"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
User -> PhoneInput-Component.CountrySelect: "1. 国を選択"
|
|
36
|
-
PhoneInput-Component.CountrySelect -> Form-State: "2. 'countryFieldName' の値を更新"
|
|
37
|
-
|
|
38
|
-
User -> PhoneInput-Component.Phone-Field: "3. 電話番号を入力"
|
|
39
|
-
PhoneInput-Component.Phone-Field -> Form-State: "4. 'name' の値(電話番号)を更新"
|
|
40
|
-
|
|
41
|
-
Form-State -> PhoneInput-Component: "5. 状態を同期"
|
|
42
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
43
14
|
|
|
44
15
|
## Props
|
|
45
16
|
|
|
@@ -8,38 +8,9 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
shape: c4-person
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Form-State: {
|
|
19
|
-
label: "React Hook Form State"
|
|
20
|
-
shape: cylinder
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
PhoneInput-Component: {
|
|
24
|
-
label: "PhoneInput Component"
|
|
25
|
-
|
|
26
|
-
CountrySelect: {
|
|
27
|
-
label: "CountrySelect"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Phone-Field: {
|
|
31
|
-
label: "Phone Text Field"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
User -> PhoneInput-Component.CountrySelect: "1. Selects a country"
|
|
36
|
-
PhoneInput-Component.CountrySelect -> Form-State: "2. Updates 'countryFieldName' value"
|
|
37
|
-
|
|
38
|
-
User -> PhoneInput-Component.Phone-Field: "3. Enters phone number"
|
|
39
|
-
PhoneInput-Component.Phone-Field -> Form-State: "4. Updates 'name' value (phone number)"
|
|
40
|
-
|
|
41
|
-
Form-State -> PhoneInput-Component: "5. Synchronizes state"
|
|
42
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
43
14
|
|
|
44
15
|
## Props
|
|
45
16
|
|
|
@@ -135,4 +106,4 @@ export default function MyPaymentForm() {
|
|
|
135
106
|
|
|
136
107
|
The true power of `PhoneInput` is revealed when used alongside an `AddressForm`. Since both components can be linked to the same country field (`billing_address.country` by default), changing the country in the `AddressForm` will automatically update the flag and dial code in the `PhoneInput`.
|
|
137
108
|
|
|
138
|
-
For a complete example of this integration, please see the documentation for [`AddressForm`](./components-ui-form-elements-address-form.md).
|
|
109
|
+
For a complete example of this integration, please see the documentation for [`AddressForm`](./components-ui-form-elements-address-form.md).
|
|
@@ -8,38 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
該元件利用 `react-international-phone` 函式庫實現其核心功能,並將其包裝以提供與 `react-hook-form` 和 Material-UI 的深度整合。當使用者選擇一個國家或輸入號碼時,該元件會更新表單狀態中對應的欄位。當另一個元件修改表單中連結的國家欄位時,它也會自動更新其國家選擇。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
shape: c4-person
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Form-State: {
|
|
19
|
-
label: "React Hook Form 狀態"
|
|
20
|
-
shape: cylinder
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
PhoneInput-Component: {
|
|
24
|
-
label: "PhoneInput 元件"
|
|
25
|
-
|
|
26
|
-
CountrySelect: {
|
|
27
|
-
label: "CountrySelect"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Phone-Field: {
|
|
31
|
-
label: "電話文字欄位"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
User -> PhoneInput-Component.CountrySelect: "1. 選擇一個國家"
|
|
36
|
-
PhoneInput-Component.CountrySelect -> Form-State: "2. 更新 'countryFieldName' 的值"
|
|
37
|
-
|
|
38
|
-
User -> PhoneInput-Component.Phone-Field: "3. 輸入電話號碼"
|
|
39
|
-
PhoneInput-Component.Phone-Field -> Form-State: "4. 更新 'name' 的值(電話號碼)"
|
|
40
|
-
|
|
41
|
-
Form-State -> PhoneInput-Component: "5. 同步狀態"
|
|
42
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
43
14
|
|
|
44
15
|
## 屬性
|
|
45
16
|
|
|
@@ -8,39 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
该组件利用 `react-international-phone` 库实现其核心功能,并对其进行包装,以提供与 `react-hook-form` 和 Material-UI 的深度集成。当用户选择一个国家或输入一个号码时,该组件会更新表单状态中相应的字段。当另一个组件修改表单中链接的国家字段时,它也会自动更新其国家选择。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
label: "用户"
|
|
16
|
-
shape: c4-person
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
Form-State: {
|
|
20
|
-
label: "React Hook Form 状态"
|
|
21
|
-
shape: cylinder
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
PhoneInput-Component: {
|
|
25
|
-
label: "PhoneInput 组件"
|
|
26
|
-
|
|
27
|
-
CountrySelect: {
|
|
28
|
-
label: "CountrySelect"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Phone-Field: {
|
|
32
|
-
label: "电话文本字段"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
User -> PhoneInput-Component.CountrySelect: "1. 选择一个国家"
|
|
37
|
-
PhoneInput-Component.CountrySelect -> Form-State: "2. 更新 'countryFieldName' 的值"
|
|
38
|
-
|
|
39
|
-
User -> PhoneInput-Component.Phone-Field: "3. 输入电话号码"
|
|
40
|
-
PhoneInput-Component.Phone-Field -> Form-State: "4. 更新 'name' 的值(电话号码)"
|
|
41
|
-
|
|
42
|
-
Form-State -> PhoneInput-Component: "5. 同步状态"
|
|
43
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
44
14
|
|
|
45
15
|
## Props
|
|
46
16
|
|
package/docs/components.ja.md
CHANGED
|
@@ -8,50 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
次の図は、高レベルのコンポーネントが通常どのように相互作用するかを示しています。`CheckoutTable` や `CheckoutDonate` のようなユーザー向けのコンポーネントがエントリーポイントとして機能し、その後、コアの `CheckoutForm` を利用して最終的な支払い処理を行います。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
shape: c4-person
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PaymentProvider-Context: {
|
|
19
|
-
label: "PaymentProviderコンテキスト"
|
|
20
|
-
shape: rectangle
|
|
21
|
-
style: {
|
|
22
|
-
stroke: "#888"
|
|
23
|
-
stroke-width: 2
|
|
24
|
-
stroke-dash: 4
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Entry-Points: {
|
|
28
|
-
label: "高レベルコンポーネント"
|
|
29
|
-
shape: rectangle
|
|
30
|
-
|
|
31
|
-
CheckoutTable: {
|
|
32
|
-
label: "CheckoutTable"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
CheckoutDonate: {
|
|
36
|
-
label: "CheckoutDonate"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
Core-Processor: {
|
|
41
|
-
label: "コア支払いプロセッサ"
|
|
42
|
-
shape: rectangle
|
|
43
|
-
|
|
44
|
-
CheckoutForm: {
|
|
45
|
-
label: "CheckoutForm"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutTable: "プランを選択"
|
|
51
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutDonate: "寄付を行う"
|
|
52
|
-
PaymentProvider-Context.Entry-Points.CheckoutTable -> PaymentProvider-Context.Core-Processor.CheckoutForm: "チェックアウトを開始"
|
|
53
|
-
PaymentProvider-Context.Entry-Points.CheckoutDonate -> PaymentProvider-Context.Core-Processor.CheckoutForm: "チェックアウトを開始"
|
|
54
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
55
14
|
|
|
56
15
|
## コンポーネントカテゴリ
|
|
57
16
|
|
package/docs/components.md
CHANGED
|
@@ -8,50 +8,9 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
shape: c4-person
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PaymentProvider-Context: {
|
|
19
|
-
label: "PaymentProvider Context"
|
|
20
|
-
shape: rectangle
|
|
21
|
-
style: {
|
|
22
|
-
stroke: "#888"
|
|
23
|
-
stroke-width: 2
|
|
24
|
-
stroke-dash: 4
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Entry-Points: {
|
|
28
|
-
label: "High-Level Components"
|
|
29
|
-
shape: rectangle
|
|
30
|
-
|
|
31
|
-
CheckoutTable: {
|
|
32
|
-
label: "CheckoutTable"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
CheckoutDonate: {
|
|
36
|
-
label: "CheckoutDonate"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
Core-Processor: {
|
|
41
|
-
label: "Core Payment Processor"
|
|
42
|
-
shape: rectangle
|
|
43
|
-
|
|
44
|
-
CheckoutForm: {
|
|
45
|
-
label: "CheckoutForm"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutTable: "Selects a plan"
|
|
51
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutDonate: "Makes a donation"
|
|
52
|
-
PaymentProvider-Context.Entry-Points.CheckoutTable -> PaymentProvider-Context.Core-Processor.CheckoutForm: "Initiates checkout"
|
|
53
|
-
PaymentProvider-Context.Entry-Points.CheckoutDonate -> PaymentProvider-Context.Core-Processor.CheckoutForm: "Initiates checkout"
|
|
54
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
55
14
|
|
|
56
15
|
## Component Categories
|
|
57
16
|
|
|
@@ -119,4 +78,4 @@ Display historical payment and credit data to your users. These components make
|
|
|
119
78
|
<x-card data-title="CreditGrantsList" data-icon="lucide:award" data-href="/components/history/credit-grants-list">
|
|
120
79
|
Show a list of credit grants, including status and remaining amounts.
|
|
121
80
|
</x-card>
|
|
122
|
-
</x-cards>
|
|
81
|
+
</x-cards>
|
package/docs/components.zh-TW.md
CHANGED
|
@@ -8,50 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
下圖說明了高階元件通常如何互動。面向使用者的元件,如 `CheckoutTable` 或 `CheckoutDonate`,作為入口點,然後利用核心的 `CheckoutForm` 來處理最終的支付處理。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
shape: c4-person
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PaymentProvider-Context: {
|
|
19
|
-
label: "PaymentProvider 上下文"
|
|
20
|
-
shape: rectangle
|
|
21
|
-
style: {
|
|
22
|
-
stroke: "#888"
|
|
23
|
-
stroke-width: 2
|
|
24
|
-
stroke-dash: 4
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Entry-Points: {
|
|
28
|
-
label: "高階元件"
|
|
29
|
-
shape: rectangle
|
|
30
|
-
|
|
31
|
-
CheckoutTable: {
|
|
32
|
-
label: "CheckoutTable"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
CheckoutDonate: {
|
|
36
|
-
label: "CheckoutDonate"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
Core-Processor: {
|
|
41
|
-
label: "核心支付處理器"
|
|
42
|
-
shape: rectangle
|
|
43
|
-
|
|
44
|
-
CheckoutForm: {
|
|
45
|
-
label: "CheckoutForm"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutTable: "選擇一個方案"
|
|
51
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutDonate: "進行一次捐贈"
|
|
52
|
-
PaymentProvider-Context.Entry-Points.CheckoutTable -> PaymentProvider-Context.Core-Processor.CheckoutForm: "啟動結帳"
|
|
53
|
-
PaymentProvider-Context.Entry-Points.CheckoutDonate -> PaymentProvider-Context.Core-Processor.CheckoutForm: "啟動結帳"
|
|
54
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
55
14
|
|
|
56
15
|
## 元件類別
|
|
57
16
|
|
package/docs/components.zh.md
CHANGED
|
@@ -8,50 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
下图说明了高级组件通常如何交互。面向用户的组件(如 `CheckoutTable` 或 `CheckoutDonate`)作为入口点,然后利用核心的 `CheckoutForm` 来处理最终的支付流程。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
User: {
|
|
15
|
-
shape: c4-person
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
PaymentProvider-Context: {
|
|
19
|
-
label: "PaymentProvider 上下文"
|
|
20
|
-
shape: rectangle
|
|
21
|
-
style: {
|
|
22
|
-
stroke: "#888"
|
|
23
|
-
stroke-width: 2
|
|
24
|
-
stroke-dash: 4
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Entry-Points: {
|
|
28
|
-
label: "高级组件"
|
|
29
|
-
shape: rectangle
|
|
30
|
-
|
|
31
|
-
CheckoutTable: {
|
|
32
|
-
label: "CheckoutTable"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
CheckoutDonate: {
|
|
36
|
-
label: "CheckoutDonate"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
Core-Processor: {
|
|
41
|
-
label: "核心支付处理器"
|
|
42
|
-
shape: rectangle
|
|
43
|
-
|
|
44
|
-
CheckoutForm: {
|
|
45
|
-
label: "CheckoutForm"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutTable: "选择一个计划"
|
|
51
|
-
User -> PaymentProvider-Context.Entry-Points.CheckoutDonate: "进行捐赠"
|
|
52
|
-
PaymentProvider-Context.Entry-Points.CheckoutTable -> PaymentProvider-Context.Core-Processor.CheckoutForm: "发起结账"
|
|
53
|
-
PaymentProvider-Context.Entry-Points.CheckoutDonate -> PaymentProvider-Context.Core-Processor.CheckoutForm: "发起结账"
|
|
54
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
55
14
|
|
|
56
15
|
## 组件分类
|
|
57
16
|
|
|
@@ -10,36 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
バックエンドサービスがそのチャネルにイベントを公開すると、フックのサブスクリプションオブジェクトがイベントを発行し、コンポーネントはそれをリッスンできます。
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
react-component: {
|
|
17
|
-
label: "React コンポーネント"
|
|
18
|
-
shape: rectangle
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
use-subscription-hook: {
|
|
22
|
-
label: "useSubscription フック"
|
|
23
|
-
shape: rectangle
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
websocket-server: {
|
|
27
|
-
label: "WebSocket サーバー"
|
|
28
|
-
shape: rectangle
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
backend-service: {
|
|
32
|
-
label: "バックエンドサービス"
|
|
33
|
-
shape: rectangle
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
react-component -> use-subscription-hook: "1. チャネルIDで呼び出し"
|
|
37
|
-
use-subscription-hook -> websocket-server: "2. 接続&名前空間付きチャネルを購読"
|
|
38
|
-
backend-service -> websocket-server: "3. イベントを公開(例:'invoice.paid')"
|
|
39
|
-
websocket-server -> use-subscription-hook: "4. イベントをクライアントにプッシュ"
|
|
40
|
-
use-subscription-hook -> react-component: "5. イベントをリスナーに発行"
|
|
41
|
-
react-component -> react-component: "6. UIを更新"
|
|
42
|
-
```
|
|
13
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
14
|
+

|
|
15
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
43
16
|
|
|
44
17
|
## パラメータ
|
|
45
18
|
|
|
@@ -10,36 +10,11 @@ The hook abstracts the complexity of managing a WebSocket connection. When a com
|
|
|
10
10
|
|
|
11
11
|
When the backend service publishes an event to that channel, the hook's subscription object emits the event, which your component can listen for.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
direction: down
|
|
13
|
+
The following diagram illustrates this data flow:
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
use-subscription-hook: {
|
|
22
|
-
label: "useSubscription Hook"
|
|
23
|
-
shape: rectangle
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
websocket-server: {
|
|
27
|
-
label: "WebSocket Server"
|
|
28
|
-
shape: rectangle
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
backend-service: {
|
|
32
|
-
label: "Backend Service"
|
|
33
|
-
shape: rectangle
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
react-component -> use-subscription-hook: "1. Call with channel ID"
|
|
37
|
-
use-subscription-hook -> websocket-server: "2. Connect & Subscribe to namespaced channel"
|
|
38
|
-
backend-service -> websocket-server: "3. Publish event (e.g., 'invoice.paid')"
|
|
39
|
-
websocket-server -> use-subscription-hook: "4. Push event to client"
|
|
40
|
-
use-subscription-hook -> react-component: "5. Emit event to listener"
|
|
41
|
-
react-component -> react-component: "6. Update UI"
|
|
42
|
-
```
|
|
15
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
16
|
+

|
|
17
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
43
18
|
|
|
44
19
|
## Parameters
|
|
45
20
|
|
|
@@ -10,36 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
當後端服務向該頻道發布事件時,此 hook 的訂閱物件會發出該事件,您的元件可以監聽該事件。
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
react-component: {
|
|
17
|
-
label: "React Component"
|
|
18
|
-
shape: rectangle
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
use-subscription-hook: {
|
|
22
|
-
label: "useSubscription Hook"
|
|
23
|
-
shape: rectangle
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
websocket-server: {
|
|
27
|
-
label: "WebSocket Server"
|
|
28
|
-
shape: rectangle
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
backend-service: {
|
|
32
|
-
label: "Backend Service"
|
|
33
|
-
shape: rectangle
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
react-component -> use-subscription-hook: "1. Call with channel ID"
|
|
37
|
-
use-subscription-hook -> websocket-server: "2. Connect & Subscribe to namespaced channel"
|
|
38
|
-
backend-service -> websocket-server: "3. Publish event (e.g., 'invoice.paid')"
|
|
39
|
-
websocket-server -> use-subscription-hook: "4. Push event to client"
|
|
40
|
-
use-subscription-hook -> react-component: "5. Emit event to listener"
|
|
41
|
-
react-component -> react-component: "6. Update UI"
|
|
42
|
-
```
|
|
13
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
14
|
+

|
|
15
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
43
16
|
|
|
44
17
|
## 參數
|
|
45
18
|
|
|
@@ -10,36 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
当后端服务向该通道发布事件时,Hook 的订阅对象会发出该事件,您的组件可以监听该事件。
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
react-component: {
|
|
17
|
-
label: "React 组件"
|
|
18
|
-
shape: rectangle
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
use-subscription-hook: {
|
|
22
|
-
label: "useSubscription Hook"
|
|
23
|
-
shape: rectangle
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
websocket-server: {
|
|
27
|
-
label: "WebSocket 服务器"
|
|
28
|
-
shape: rectangle
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
backend-service: {
|
|
32
|
-
label: "后端服务"
|
|
33
|
-
shape: rectangle
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
react-component -> use-subscription-hook: "1. 使用 channel ID 调用"
|
|
37
|
-
use-subscription-hook -> websocket-server: "2. 连接并订阅命名空间化的 channel"
|
|
38
|
-
backend-service -> websocket-server: "3. 发布事件(例如 'invoice.paid')"
|
|
39
|
-
websocket-server -> use-subscription-hook: "4. 将事件推送至客户端"
|
|
40
|
-
use-subscription-hook -> react-component: "5. 向监听器发出事件"
|
|
41
|
-
react-component -> react-component: "6. 更新 UI"
|
|
42
|
-
```
|
|
13
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
14
|
+

|
|
15
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
43
16
|
|
|
44
17
|
## 参数
|
|
45
18
|
|
|
@@ -8,35 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
このプロバイダーは、マウント時にPayment Kitのバックエンドから設定データを初期化して取得します。このデータは、ユーザーのセッションやその他のユーティリティとともに、`usePaymentContext`フックを介してすべての子孫コンポーネントで利用可能になります。このパターンにより、支払いコンポーネントはプロップのバケツリレー(prop drilling)なしで、常に必要なコンテキストにアクセスできるようになります。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Your-Application: {
|
|
15
|
-
label: "あなたのアプリケーション"
|
|
16
|
-
shape: rectangle
|
|
17
|
-
|
|
18
|
-
PaymentProvider: {
|
|
19
|
-
label: "PaymentProvider"
|
|
20
|
-
style.fill: "#d1e7dd"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Payment-Components: {
|
|
24
|
-
label: "支払いコンポーネント\n(例: CheckoutForm)"
|
|
25
|
-
shape: rectangle
|
|
26
|
-
style.fill: "#cfe2ff"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Payment-Kit-API: {
|
|
31
|
-
label: "Payment Kit API"
|
|
32
|
-
shape: cylinder
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Your-Application.PaymentProvider -> Payment-Kit-API: "1. 設定とメソッドを取得"
|
|
36
|
-
Your-Application.PaymentProvider -> Your-Application.Payment-Components: "2. コンテキストを提供 (セッション、設定、APIクライアント)"
|
|
37
|
-
Your-Application.Payment-Components -> Payment-Kit-API: "3. APIコールを作成 (例: チェックアウト作成)"
|
|
38
|
-
|
|
39
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
40
14
|
|
|
41
15
|
## セットアップと使用法
|
|
42
16
|
|
|
@@ -8,35 +8,11 @@ Nearly every component and hook in this library requires being nested within a `
|
|
|
8
8
|
|
|
9
9
|
The provider initializes and fetches configuration data from the Payment Kit backend when it mounts. This data, along with the user's session and other utilities, is then made available to any descendant component via the `usePaymentContext` hook. This pattern ensures that your payment components always have access to the necessary context without prop drilling.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
direction: down
|
|
13
|
-
|
|
14
|
-
Your-Application: {
|
|
15
|
-
label: "Your Application"
|
|
16
|
-
shape: rectangle
|
|
17
|
-
|
|
18
|
-
PaymentProvider: {
|
|
19
|
-
label: "PaymentProvider"
|
|
20
|
-
style.fill: "#d1e7dd"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Payment-Components: {
|
|
24
|
-
label: "Payment Components\n(e.g., CheckoutForm)"
|
|
25
|
-
shape: rectangle
|
|
26
|
-
style.fill: "#cfe2ff"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Payment-Kit-API: {
|
|
31
|
-
label: "Payment Kit API"
|
|
32
|
-
shape: cylinder
|
|
33
|
-
}
|
|
11
|
+
The following diagram illustrates this flow:
|
|
34
12
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```
|
|
13
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
14
|
+

|
|
15
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
40
16
|
|
|
41
17
|
## Setup and Usage
|
|
42
18
|
|
|
@@ -8,35 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
該提供者在掛載時會初始化並從 Payment Kit 後端取得設定資料。這些資料,連同使用者的 session 和其他工具,會透過 `usePaymentContext` 掛鉤提供給任何後代元件。這種模式確保您的支付元件始終能夠存取必要的上下文,而無需透過屬性傳遞。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Your-Application: {
|
|
15
|
-
label: "您的應用程式"
|
|
16
|
-
shape: rectangle
|
|
17
|
-
|
|
18
|
-
PaymentProvider: {
|
|
19
|
-
label: "PaymentProvider"
|
|
20
|
-
style.fill: "#d1e7dd"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Payment-Components: {
|
|
24
|
-
label: "支付元件\n(例如 CheckoutForm)"
|
|
25
|
-
shape: rectangle
|
|
26
|
-
style.fill: "#cfe2ff"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Payment-Kit-API: {
|
|
31
|
-
label: "Payment Kit API"
|
|
32
|
-
shape: cylinder
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Your-Application.PaymentProvider -> Payment-Kit-API: "1. 取得設定與方法"
|
|
36
|
-
Your-Application.PaymentProvider -> Your-Application.Payment-Components: "2. 提供上下文 (session、設定、API 客戶端)"
|
|
37
|
-
Your-Application.Payment-Components -> Payment-Kit-API: "3. 發起 API 呼叫 (例如建立結帳)"
|
|
38
|
-
|
|
39
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
40
14
|
|
|
41
15
|
## 設定與使用
|
|
42
16
|
|
|
@@ -8,35 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
提供者在挂载时会初始化并从 Payment Kit 后端获取配置数据。这些数据连同用户会话和其他实用工具,通过 `usePaymentContext` 钩子提供给任何后代组件。这种模式确保您的支付组件始终能够访问必要的上下文,而无需进行属性钻取(prop drilling)。
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Your-Application: {
|
|
15
|
-
label: "你的应用程序"
|
|
16
|
-
shape: rectangle
|
|
17
|
-
|
|
18
|
-
PaymentProvider: {
|
|
19
|
-
label: "PaymentProvider"
|
|
20
|
-
style.fill: "#d1e7dd"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Payment-Components: {
|
|
24
|
-
label: "支付组件\n(例如,CheckoutForm)"
|
|
25
|
-
shape: rectangle
|
|
26
|
-
style.fill: "#cfe2ff"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Payment-Kit-API: {
|
|
31
|
-
label: "Payment Kit API"
|
|
32
|
-
shape: cylinder
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Your-Application.PaymentProvider -> Payment-Kit-API: "1. 获取设置和方法"
|
|
36
|
-
Your-Application.PaymentProvider -> Your-Application.Payment-Components: "2. 提供上下文(会话、设置、API 客户端)"
|
|
37
|
-
Your-Application.Payment-Components -> Payment-Kit-API: "3. 发起 API 调用(例如,创建结账)"
|
|
38
|
-
|
|
39
|
-
```
|
|
11
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9 -->
|
|
12
|
+

|
|
13
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
40
14
|
|
|
41
15
|
## 设置和使用
|
|
42
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.28",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@babel/core": "^7.27.4",
|
|
97
97
|
"@babel/preset-env": "^7.27.2",
|
|
98
98
|
"@babel/preset-react": "^7.27.1",
|
|
99
|
-
"@blocklet/payment-types": "1.22.
|
|
99
|
+
"@blocklet/payment-types": "1.22.28",
|
|
100
100
|
"@storybook/addon-essentials": "^7.6.20",
|
|
101
101
|
"@storybook/addon-interactions": "^7.6.20",
|
|
102
102
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"vite-plugin-babel": "^1.3.1",
|
|
128
128
|
"vite-plugin-node-polyfills": "^0.23.0"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "b3c8797e5ffe68ae3a0de1962b1d076a9d2fef33"
|
|
131
131
|
}
|