@blocklet/payment-react
Version:
Reusable react components for payment kit v2
56 lines (55 loc) • 3.63 kB
YAML
rules:
- id: pref_b8a4986e9903fe0f
active: true
scope: document
rule: 在所有示例中统一`PaymentProvider`的用法,仅展示通过本地`useSessionContext`获取`session`和`connectApi`,并将`useSessionContext`的完整实现细节和声明方式集中定义在`payment-provider.md`文档中。
feedback: 所有的示例里对于PaymentProvider的用法应该统一,比如具体的使用都指向payment-context的文档, 然后示例里只写明 const {session,
connectApi}=useSessionontext; useSessionContext 说明是指向自己的本地的session文件;
至于怎么声明自己的session文件可以写在payment-provider.md文档里:import { createAuthServiceSessionContext } from
'@arcblock/did-connect-react/lib/Session';import { useContext } from 'react';const { SessionProvider,
SessionContext, SessionConsumer, withSession } = createAuthServiceSessionContext();function useSessionContext()
{ const info = useContext(SessionContext); return info;}export { SessionProvider, SessionContext,
SessionConsumer, useSessionContext, withSession };
createdAt: 2025-09-01T02:32:25.705Z
- id: pref_bf09eebe4c624ab4
active: true
scope: document
rule: 所有代码示例必须保证语法正确和格式无误,确保可以直接复制粘贴运行。
feedback: 更新示例中PaymentProvider的用法, 注意示例代码的括号,严格保证示例代码copy出来没有格式错误
createdAt: 2025-09-01T02:17:20.214Z
- id: pref_805a9242c91fabc6
active: true
scope: document
rule: 在代码示例中,应通过调用 `useSessionContext()` 来获取 `session` 和 `connectApi`,而不是直接 mock 数据。
feedback: "我们不应该这么来mock数据,而是告知从 {session, connectApi} = useSessionContext() "
createdAt: 2025-09-01T02:05:58.458Z
- id: pref_3b490ffac11fd859
active: true
scope: document
rule: 在编写组件示例时,必须严格按照组件本身的属性来实现,确保示例中不使用任何无效的参数。
feedback: PaymentProvider并没有serviceHost参数,请你在写示例时严格按照组件本身的属性来实现
createdAt: 2025-09-01T01:52:43.445Z
- id: pref_5301bb9b58ee36b9
active: true
scope: document
rule: 仅在总览卡片预览中使用 xcard 组件,不要将其用于包含代码示例的内容。
feedback: 有代码示例的内容不需要改成xcard组件,展示效果不好,xcards只用于总览的卡片预览
createdAt: 2025-09-01T01:36:10.289Z
- id: pref_d325528c96a4b7e4
active: true
scope: document
rule: 在组件文档中,确保示例代码包含所有必要的 props 以便运行,并引导用户优先使用集成了子功能的高阶组件。
feedback: 1. 示例里 PaymentProvider需要session和connect; 2.鼓励用户直接使用AutoTopup组件,内部集成了Modal
createdAt: 2025-08-28T16:01:26.410Z
- id: pref_cbe76a82181fabc8
active: true
scope: structure
rule: 将功能紧密相关的组件合并到同一个文档中,而不是为每个组件创建单独的文档。
feedback: 我只需要AutoTopUp和AutoTopupModal的组件,并且把这两个放在一个文档里,不需要细分文档
createdAt: 2025-08-28T15:32:51.303Z
- id: pref_090f6698b82b9d18
active: true
scope: structure
rule: 当新增组件时,必须同步为其生成对应的使用文档。
feedback: 我们新增了AutoTopup和AutoTopupModal组件,我们需要把这两个组件的使用也更新生成对应的文档
createdAt: 2025-08-28T15:19:56.790Z