thread-master/docs/product/opportunity-inbox/tasks/T822-cost-preview-credit-co...

58 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2026-08-13 02:22:24 +00:00
# T822 — cost preview and credit confirmation mock
> Status: `done`
> Milestone: `M2`
> Est. change: `~170 lines`
## Goal
完成後所有可能呼叫 provider 的手動動作都會先顯示固定範圍點數、BYOK、餘額與 ceiling 確認,預覽本身不扣點。
## Depends on
- T820、T821
## Inputs
- `apps/web/src/pages/UsagePage.tsx`
- `apps/web/src/components/radar/ExplorePanel.tsx`
- `apps/web/src/components/radar/WatchSuggestPanel.tsx`
- Spec §5.1§5.2、驗收 #13、#20
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/web/src/components/radar/CostPreviewDialog.tsx` | add | 固定/最小/最大點數、期限與確認 |
| `apps/web/src/data/mock/radarRepo.ts` | edit | preview、expiry、ceiling、platformBYOK mock |
| `apps/web/src/components/radar/ExplorePanel.tsx` | edit | 付費前確認流程 |
| `apps/web/src/components/radar/WatchSuggestPanel.tsx` | edit | enrichment preview 入口 |
### 行為變更
- preview 過期、版本變動、餘額不足或 ceiling 小於固定成本時不啟動動作。
### API / 契約(若有)
- preview_id 與 credit_ceiling 由 mock 傳給後續動作。
## Out of scope
- 不接真 usage API、不改方案點數。
## Acceptance
- [x] 取得 preview 前後 credits 不變。
- [x] BYOK平台模式顯示清楚並保留呼叫次數。
- [ ] 指令:
```bash
cd apps/web && npm run test -- CostPreviewDialog ExplorePanel WatchSuggestPanel
```
## Notes
未知候選數用範圍,不顯示假精準單一數字。