Skip to content

Commit

Permalink
fix(weapp): add getRealtimePhoneNumber and `agreePrivacyAuthorizati…
Browse files Browse the repository at this point in the history
…on` for button opentype

NervJS#14180
  • Loading branch information
TheKonka committed Jul 14, 2023
1 parent 11d68b4 commit cf4b24b
Show file tree
Hide file tree
Showing 31 changed files with 181 additions and 53 deletions.
22 changes: 22 additions & 0 deletions packages/taro-components/types/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ interface ButtonProps extends StandardProps {
* @supported weapp, alipay, swan, tt, jd
*/
onGetPhoneNumber?: CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>
/**
* 手机号实时验证回调,`open-type="getRealtimePhoneNumber"` 时有效
* @supported weapp
*/
onGetRealTimePhoneNumber?: CommonEventFunction<ButtonProps.onGetRealTimePhoneNumberEventDetail>
/** 当使用开放能力时,发生错误的回调
*
* 生效时机:`open-type="launchApp"`
Expand All @@ -213,6 +218,11 @@ interface ButtonProps extends StandardProps {
* @supported weapp
*/
onChooseAvatar?: CommonEventFunction
/**
* 用户同意隐私协议事件回调,`open-type="agreePrivacyAuthorization"`时有效
* @supported weapp
*/
onAgreePrivacyAuthorization?: CommonEventFunction
/** 点击。
* 说明: 每点击一次会触发一次事件,建议自行使用代码防止重复点击,可以使用 js 防抖和节流实现。
* @supported alipay
Expand Down Expand Up @@ -293,6 +303,11 @@ declare namespace ButtonProps {
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
*/
getPhoneNumber
/**
* 手机号实时验证,向用户申请,并在用户同意后,快速填写和实时验证手机号。(*小程序插件中不能使用*)
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getRealtimePhoneNumber.html
*/
getRealtimePhoneNumber
/** 获取用户信息,可以从回调中获取到用户信息 */
getUserInfo
/** 打开APP,可以通过 app-parameter 属性设定向APP传的参数
Expand All @@ -305,6 +320,10 @@ declare namespace ButtonProps {
feedback
/** 获取用户头像,可以从回调中获得具体信息 */
chooseAvatar
/**
* 用户同意隐私协议按钮。可通过 bindagreeprivacyauthorization 监听用户同意隐私协议事件
*/
agreePrivacyAuthorization
}
/** 支付宝小程序专属的 open-type 合法值
* @see https://opendocs.alipay.com/mini/component/button
Expand Down Expand Up @@ -426,6 +445,9 @@ declare namespace ButtonProps {
*/
sign: string
}
interface onGetRealTimePhoneNumberEventDetail {
code: string
}
interface onOpenSettingEventDetail {
/* 打开授权设置页的调用状态 */
errMsg: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -1846,10 +1848,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -3504,10 +3508,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -1706,10 +1708,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -3078,10 +3080,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -6014,10 +6018,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -2374,10 +2376,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -1687,10 +1689,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -3232,10 +3236,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down Expand Up @@ -4777,10 +4783,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1403,10 +1403,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ require("./taro");
bindGetUserInfo: _empty,
bindContact: _empty,
bindGetPhoneNumber: _empty,
bindGetRealTimePhoneNumber: _empty,
bindChooseAvatar: _empty,
bindError: _empty,
bindOpenSetting: _empty,
bindLaunchApp: _empty
bindLaunchApp: _empty,
bindAgreePrivacyAuthorization: _empty
},
Form: {
"report-submit-timeout": _zero
Expand Down
Loading

0 comments on commit cf4b24b

Please sign in to comment.