-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat(uat): add getRealtimePhoneNumber for Button #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(uat): add getRealtimePhoneNumber for Button #43
Conversation
✅ Deploy Preview for uni-typed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdded a new Button open-type "getRealtimePhoneNumber" with its event/detail/callback types, exported public types and UniHelper mappings, added ButtonProps.onGetrealtimephonenumber and phoneNumberNoQuotaToast?, and added corresponding type tests. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as Button (openType="getRealtimePhoneNumber")
participant Platform as PlatformAPI
participant App as AppCallback
User->>UI: Tap button
UI->>Platform: Request realtime phone number
alt success
Platform-->>UI: { errMsg, errno, code, cloudID }
UI->>App: onGetrealtimephonenumber(event)
else error
Platform-->>UI: { errMsg, errno }
UI->>App: onGetrealtimephonenumber(errorEvent)
end
note right of UI: phoneNumberNoQuotaToast? controls quota toast display
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@uni-helper/uni-app-components
@uni-helper/uni-app-types
@uni-helper/uni-cloud-types
@uni-helper/uni-types
@uni-helper/uni-ui-types
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/uni-app-types/test/form-components/button.test-d.ts (1)
159-166
: Different callback parameters - consider creating separate event type.According to WeChat documentation,
bindgetrealtimephonenumber
"returns only the Code, will not return encryptedData and iv" unlikegetPhoneNumber
. The current implementation reuses_ButtonOnGetphonenumberEvent
which includesencryptedData
,iv
, andcloudID
properties that won't be present in the realtime verification callback.Consider creating a dedicated event type:
+interface _ButtonOnGetrealtimephonenumberDetail { + /** 错误信息 */ + errMsg?: string; + /** 动态令牌 */ + code?: string; + /** 错误码 (失败时返回) */ + errno?: number; +} + +type _ButtonOnGetrealtimephonenumberEvent = CustomEvent<_ButtonOnGetrealtimephonenumberDetail>; /** * 手机号实时验证回调 * * Open-type="getRealtimePhoneNumber" 时有效 */ type _ButtonOnGetrealtimephonenumber = ( - event: _ButtonOnGetphonenumberEvent, + event: _ButtonOnGetrealtimephonenumberEvent, ) => void;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/uni-app-types/src/form-components/button.ts
(9 hunks)packages/uni-app-types/test/form-components/button.test-d.ts
(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/uni-app-types/test/form-components/button.test-d.ts (1)
packages/uni-app-types/src/form-components/button.ts (1)
ButtonOnGetrealtimephonenumber
(714-715)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: test (windows-latest, 20)
- GitHub Check: test (windows-latest, 18)
- GitHub Check: test (windows-latest, 22)
🔇 Additional comments (10)
packages/uni-app-types/src/form-components/button.ts (8)
48-49
: LGTM! Documentation follows existing patterns.The JSDoc documentation for the new
GetRealtimePhoneNumber
open type is clear and follows the established pattern of other open types.
102-102
: LGTM! Open type value added correctly.The
"getRealtimePhoneNumber"
value is properly added to the_ButtonOpenType
union type, maintaining alphabetical ordering within the list.
325-326
: LGTM! JSDoc documentation is consistent.The documentation in the
_ButtonProps
interface properly describes the new open type and maintains consistency with the existing pattern.
372-379
: LGTM! New prop is well-documented.The
phoneNumberNoQuotaToast
prop is properly typed as optional boolean with a clear description and default value documentation. The JSDoc follows the established pattern.
492-497
: LGTM! Callback prop follows established pattern.The
onGetrealtimephonenumber
prop is properly typed and documented, following the same pattern asonGetphonenumber
.
571-571
: LGTM! Export follows naming convention.The export of
_ButtonOnGetrealtimephonenumber as ButtonOnGetrealtimephonenumber
follows the established pattern for making internal types available publicly.
641-642
: LGTM! UniHelper namespace documentation is consistent.The JSDoc documentation in the global UniHelper namespace properly describes the new open type and maintains consistency.
709-715
: LGTM! Global interface declaration follows pattern.The global interface declaration for
ButtonOnGetrealtimephonenumber
correctly extends the internal type, following the established pattern used by other callback interfaces.packages/uni-app-types/test/form-components/button.test-d.ts (2)
21-21
: LGTM! Import follows alphabetical ordering.The
ButtonOnGetrealtimephonenumber
import is correctly placed in alphabetical order within the import statement.
64-65
: LGTM! Type tests follow established pattern.The type tests for
ButtonOnGetrealtimephonenumber
properly verify:
- The type is a function (
toBeFunction()
)- It matches the corresponding UniHelper namespace type (
toEqualTypeOf<UniHelper.ButtonOnGetrealtimephonenumber>()
)This mirrors the existing pattern used for
ButtonOnGetphonenumber
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/uni-app-types/src/form-components/button.ts
(9 hunks)packages/uni-app-types/test/form-components/button.test-d.ts
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/uni-app-types/test/form-components/button.test-d.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/uni-app-types/src/form-components/button.ts (1)
packages/uni-app-types/src/events/index.ts (1)
CustomEvent
(135-135)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: test (windows-latest, 22)
- GitHub Check: test (windows-latest, 20)
- GitHub Check: test (windows-latest, 18)
Thank you! |
Description 描述
添加微信小程序
button
按钮组件相关open-type
添加getRealtimePhoneNumber
类型phone-number-no-quota-toast
onGetrealtimephonenumber
不太清楚onGetrealtimephonenumber
回调参数类型,这里复用的onGetphonenumber
事件的回调参数类型Linked Issues 关联的 Issues
Moonofweisheng/wot-design-uni#1327
Additional context 额外上下文
微信button文档
getRealtimePhoneNumber文档
Summary by CodeRabbit
New Features
Tests