@intlsdk/account-api
Advanced tools
Comparing version 1.18.0 to 1.19.0
@@ -19,2 +19,3 @@ export declare const HOST_INTL: { | ||
readonly hok: "https://hok.intlgame.com"; | ||
readonly 'gcp-eu': "https://gcp-eu.intlgame.com"; | ||
}; | ||
@@ -56,7 +57,4 @@ export declare const HOST_MSDK: { | ||
readonly hok: "https://hok-webproxy.intlgame.com"; | ||
readonly 'gcp-eu': "https://gcp-eu-webproxy.intlgame.com"; | ||
}; | ||
export declare const HOST_SMARTLINK: { | ||
test: string; | ||
prod: string; | ||
}; | ||
export declare const THIRD_PARTY_WEB_PAGE_HOST: { | ||
@@ -63,0 +61,0 @@ readonly test: "https://test-common-web.intlgame.com"; |
@@ -34,7 +34,12 @@ import { ClientOptions } from '../type'; | ||
hostThird: string; | ||
hostSmartLink: string; | ||
} | ||
/** | ||
* 账号的初始化配置 | ||
*/ | ||
declare const defaultConfig: Config; | ||
export default defaultConfig; | ||
export type SDKConfig = Config & ClientOptions; | ||
/** | ||
* 根据 scene 获取默认的 sigkey | ||
*/ | ||
export declare function getDefaultSigkey(scene: string): string; |
@@ -56,5 +56,2 @@ declare const ACCOUNT: { | ||
}; | ||
declare const SMARTLINK: { | ||
readonly syncWithEmail: "/v1/userManage/syncWithEmail"; | ||
}; | ||
export { ACCOUNT, INTL, THIRD_PARTY, SMARTLINK }; | ||
export { ACCOUNT, INTL, THIRD_PARTY }; |
@@ -9,2 +9,3 @@ import Aegis from 'aegis-web-mini-sdk'; | ||
import MapApi from './model/api-map'; | ||
import IntlApi from './model/api-intl'; | ||
import { getUbid } from './model/intl-account'; | ||
@@ -67,3 +68,3 @@ import { ClientOptions } from './type/client'; | ||
verifyLogin: ApiModel['verifyLogin']; | ||
intlRequest: ApiModel['intlRequest']; | ||
intlRequest: IntlApi['intlRequest']; | ||
decryptAES: ApiModel['decryptAES']; | ||
@@ -87,3 +88,2 @@ modifyUserAgreement: AccountApi['modifyUserAgreement']; | ||
getBindChannelsByOpenID: BindApi['getBindChannelsByOpenID']; | ||
subscribeEmail: ApiModel['subscribeEmail']; | ||
queryMyCountry: CommonApi['queryMyCountry']; | ||
@@ -90,0 +90,0 @@ queryMyRegion: CommonApi['queryMyRegion']; |
@@ -1,3 +0,3 @@ | ||
import { RespMeta, IntlSignInResp, IntlRequestParams } from '../type/common.type'; | ||
import { IntlSignInParams, RequestVerifyImageResp, SubscribeEmailParams, intlLogoutParams, VerifyLoginParams, DecryptAESParams } from '../type'; | ||
import { RespMeta, IntlSignInResp } from '../type/common.type'; | ||
import { IntlSignInParams, RequestVerifyImageResp, intlLogoutParams, VerifyLoginParams, DecryptAESParams } from '../type'; | ||
import { SDKConfig } from '../config'; | ||
@@ -9,2 +9,5 @@ export declare const VERIFY_TYPE: { | ||
}; | ||
/** | ||
* 对外api类,和业务完全解耦。 | ||
*/ | ||
export default class { | ||
@@ -14,2 +17,5 @@ private config; | ||
constructor(config: SDKConfig); | ||
/** | ||
* 获取验证图片的内容 | ||
*/ | ||
getVerifyPngImageData: () => Promise<{ | ||
@@ -19,13 +25,58 @@ sessionid: any; | ||
}>; | ||
/** | ||
* 生成图片验证码图片url | ||
*/ | ||
requestVerifyImage: () => Promise<RequestVerifyImageResp>; | ||
/** | ||
* 自建账号uid换取INTL账号openid | ||
* @param params | ||
* @returns | ||
*/ | ||
intlSignIn: (params: IntlSignInParams) => Promise<IntlSignInResp<'customAccount'>>; | ||
subscribeEmail: (params: SubscribeEmailParams) => Promise<any>; | ||
/** | ||
* 获取账号配置 | ||
* @returns | ||
*/ | ||
queryAccountConfig: (params?: any) => Promise<any>; | ||
/** | ||
* Query uid through INTL openid | ||
* @returns | ||
*/ | ||
queryUidByOpenID: (params?: any) => Promise<any>; | ||
/** | ||
* refresh cacc token by openid | ||
* openid string [required] third channel oepnid | ||
* token string [required] third channel token | ||
* channel_id number [required] CAcc account_plat_type | ||
* oauth_channelid [required] third channel id | ||
* @returns | ||
*/ | ||
refreshCAccTokenByOpenID: (params?: any) => Promise<any>; | ||
/** | ||
* verify_code string [required] Verify Code | ||
* account string [required] Email or Phone | ||
* phone_area_code string [optional] Country Calling Code | ||
* account_type int [required] Account Type: 1 email, 2 phone | ||
* machine_check_type int [optional] Machine Check Type: 2 Google, 3 Tencent | ||
* google_response string [optional] Gooogle machine check response | ||
* tencent_response string [optional] Tencent machine check response | ||
*/ | ||
unlink: (params: any) => Promise<any>; | ||
/** | ||
* Intl退出登录 | ||
* @param params | ||
* @returns | ||
*/ | ||
intlLogout: (params: intlLogoutParams) => Promise<RespMeta>; | ||
/** | ||
* Intl 鉴权 | ||
* @param params | ||
* @returns | ||
*/ | ||
verifyLogin: (params: VerifyLoginParams) => Promise<RespMeta>; | ||
intlRequest: (params: IntlRequestParams) => Promise<RespMeta>; | ||
/** | ||
* intl descryptAES for openid/token/uid | ||
* @returns | ||
*/ | ||
decryptAES: (params: DecryptAESParams) => Promise<any>; | ||
} |
import { SDKConfig } from '../config'; | ||
import { RespMeta } from '../type/common.type'; | ||
import { BindParams, GetBindChannelsByOpenIDParams, UnbindParams } from '../type'; | ||
/** | ||
* 绑定相关 API | ||
*/ | ||
export default class { | ||
private intl; | ||
private config; | ||
constructor(config: SDKConfig); | ||
getBindChannelsByOpenID: (params?: any) => Promise<any>; | ||
/** | ||
* 根据INTL账号token/openid获取绑定列表 | ||
* @param {*} params | ||
* openid 用户渠道信息 | ||
* token 用户渠道id | ||
* channelid 渠道id | ||
* @returns | ||
*/ | ||
getBindChannelsByOpenID: (params: GetBindChannelsByOpenIDParams) => Promise<any>; | ||
/** | ||
* 根据uid获取绑定列表 | ||
* @param {*} params | ||
* channel_info 用户渠道信息 | ||
* channel_id 用户渠道id | ||
* @returns | ||
*/ | ||
getBindChannelsByUid: (params?: any) => Promise<any>; | ||
bind: (params?: any) => Promise<any>; | ||
unbind: (params?: any) => Promise<any>; | ||
/** | ||
* 绑定 | ||
* @param {*} params | ||
* openid INTL openid | ||
* token INTL token | ||
* oauth_channelid 登录INTL账号的渠道id | ||
* bind_channelid 需要绑定的账号的渠道id | ||
* bind_channel_info 需要绑定渠道的channelinfo信息(acctoken等信息) | ||
* @returns | ||
*/ | ||
bind: (params?: BindParams) => Promise<RespMeta>; | ||
/** | ||
* 解除绑定 | ||
* @param {*} params | ||
* openid INTL openid | ||
* token INTL token | ||
* unbind_channelid 解除绑定的渠道id | ||
* uid 用户uid | ||
* oauth_channelid 渠道id | ||
* @returns | ||
*/ | ||
unbind: (params: UnbindParams) => Promise<any>; | ||
} |
@@ -1,28 +0,212 @@ | ||
import { RespMeta } from 'src/type/common.type'; | ||
import { RespMeta } from '../type/common.type'; | ||
import { SDKConfig } from '../config'; | ||
import { SignInParams, CACCSignInResp, VerifyCodeSignInParams, QueryUserInfoParams, QueryUserInfoResp, ModifyProfileParams, ModifyProfileResp, QueryRegisterStatusResp, RegisterParams, RegisterResp, VerifyCodeRegisterParams, VerifyCodeRegisterResp, RequestVerifyCodeParams, RequestVerifyCodeResp, ResetPasswordParams, LogoutParams, QueryRegisterStatusParams, QueryCodeStatusParams, QueryCodeStatusResp, QueryUserNameStatusParams, QueryUserNameStatusResp, ModifyUserAgreementParams, ModifyUserAgreementResp, ModifyAccountInfoParams, ModifyAccountInfoResp } from '../type'; | ||
import { GetProtocolParam, GetProtocolResp, SetProtocolParam, SetProtocolResp } from '../type/account'; | ||
/** | ||
* LI PASS 账号相关 API | ||
*/ | ||
export default class { | ||
private config; | ||
constructor(config: SDKConfig); | ||
/** 密码登录接口(密码校验) | ||
* @param {*} params | ||
* account string 【必填】登录的帐号 | ||
* account_type int 【必填】1email,2phone | ||
* phone_area_code string 【选填 】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
* password string 【必填】 登录密码 ,格式(09a-zA-z_![]-+()) 3264个字节 MD5加密 | ||
* machine_check_type【选填:是否必填受管理端自建账号配置控制】 人机识别方式,1 为图片验证,2 为 google reCAPTCHA 方式 ,3 为腾讯人机识别。未传时默认走图片验证码 | ||
* png_verify_code【选填:machine_check_type=1必填】 图片验证码,通过获取图片验证接口进行获取 ,60s 有效,只能校验一次 | ||
* session_id 图形验证码session_id | ||
* google_response【选填:machine_check_type=2必填】 google reCAPTCHA 方式,response 入参,2 分钟有效,只能校验一次 | ||
* tencent_response【选填:machine_check_type=3必填】 tencent 人机识别返回 | ||
*/ | ||
signIn: (params: SignInParams) => Promise<CACCSignInResp>; | ||
/** 修改密码 | ||
* @param {*} params | ||
* verify_type int 【必填】验证方式,1:使用验证码,2:使用旧密码 | ||
* verify_code string 【当verify_type=1时必填】验证码 ,可为int型老协议适配 | ||
* account string 【必填】注册的帐号 | ||
* phone_area_code string 【选填 】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
* account_type int 【必填】1email,2phone | ||
* password string 【必填】 新密码,格式8-20位A-Za-z0-9!@#$%^&*()+=\\-_/?<>,.:;| | ||
* old_password string 【当verify_type=2时必填】 旧密码格式(09a-zA-z_![]-+()) 32/64个字节-客户端MD5传输 | ||
*/ | ||
resetPassword: (params: ResetPasswordParams) => Promise<RespMeta>; | ||
/** 验证码登录接口 | ||
* | ||
* @param {*} params | ||
* account string 【必填】注册的帐号 | ||
* account_type int 【必填】1email,2phone | ||
* verify_code string 【必填】验证码,老协议适配可为int型 | ||
* phone_area_code string 【选填 】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
* machine_check_type【选填:是否必填受管理端自建账号配置控制】 人机识别方式,1 为图片验证,2 为 google reCAPTCHA 方式 ,3 为腾讯人机识别。未传时默认走图片验证码 | ||
* png_verify_code【选填:machine_check_type=1必填】 图片验证码,通过获取图片验证接口进行获取 ,60s 有效,只能校验一次 | ||
* google_response【选填:machine_check_type=2必填】 google reCAPTCHA 方式,response 入参,2 分钟有效,只能校验一次 | ||
* tencent_response【选填:machine_check_type=3必填】 tencent 人机识别返回 | ||
*/ | ||
verifyCodeSignIn: (params: VerifyCodeSignInParams) => Promise<CACCSignInResp>; | ||
/** 发送邮件校验码 | ||
* | ||
* @param {*参数对象} params | ||
* account string 【必填】注册的帐号 | ||
* account_type int 【必填】1email(5到50个字节),2phone | ||
* code_type int 【必填】生成的验证码类型,0注册,1修改密码,2登录并注册,3修改主体注册账号 | ||
* machine_check_type int 【os=3时必填】人机识别方式,1为图片验证,2为google reCAPTCHA方式,未传时默认走图片验证码 3.腾讯防水墙 | ||
* google_response string 【os=3且人机识别方式为2时必填】google reCAPTCHA方式,response入参,2分钟有效,只能校验一次 | ||
* tencent_response string 【os=3且人机识别方式为3时必填】tencent防水墙方式 | ||
* phone_area_code string 【选填】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
* png_verify_code string 【os=3且人机识别方式为1时必填】图片验证码,通过获取图片验证接口进行获取 ,60s有效,只能校验一次 | ||
* session_id string 【os=3且人机识别方式为1时必填】图片验证码的sessionid,在获取图片验证码的头里面会返回 | ||
*/ | ||
requestVerifyCode: (params: RequestVerifyCodeParams) => Promise<RequestVerifyCodeResp>; | ||
/** 获取验证码有效状态 | ||
* | ||
* @returns | ||
*/ | ||
getCodeStatus: (params: QueryCodeStatusParams) => Promise<QueryCodeStatusResp>; | ||
/** 账号密码注册 | ||
* @param {*} params 参数 | ||
* account_type int 【必填】1email,2sms | ||
* is_receive_email int 【选填】用户同意接收线下邮件选项,1为同意,其他为不同意 | ||
* verify_code string 【必填】验证码,老协议适配可为int型 | ||
* account string 【必填】注册的帐号 | ||
* phone_area_code string 【选填 】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
* password string 【必填】 登录密码,格式(09a-zA-z_![]-+()) 3264个字节-客户端MD5传输 | ||
* user_name string 【选填】 不可重复,用户名由小写字母开头、小写字母下划线及数字组成(a-z_09)616bytes,在后台开关关闭时, 可以不必填 | ||
* nick_name string 【选填】昵称,可重复 | ||
* birthday string 【选填】 YYYY-MM-DD,不填为设置默认值"1970-01-01" | ||
* region string 【选填】 取值参考ISO_3166-1标准,3字节的数字字符 | ||
* machine_check_type【选填:是否必填受管理端自建账号配置控制】 人机识别方式,1 为图片验证,2 为 google reCAPTCHA 方式 ,3 为腾讯人机识别。未传时默认走图片验证码 | ||
* png_verify_code【选填:machine_check_type=1必填】 图片验证码,通过获取图片验证接口进行获取 ,60s 有效,只能校验一次 | ||
* google_response【选填:machine_check_type=2必填】 google reCAPTCHA 方式,response 入参,2 分钟有效,只能校验一次 | ||
* tencent_response【选填:machine_check_type=3必填】 tencent 人机识别返回 | ||
*/ | ||
register: (params: RegisterParams) => Promise<RegisterResp>; | ||
/** | ||
* 验证码注册接口 | ||
* @param {*} params 参数 | ||
* account_type int 【必填】1email,2sms | ||
* is_receive_email int 【选填】用户同意接收线下邮件选项,1为同意,其他为不同意 | ||
* verify_code string 【必填】验证码,老协议适配可为int型 (必须是code_type=2收到的验证码,否则注册不成功) | ||
* account string 【必填】注册的帐号 | ||
* phone_area_code string 【选填】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
* password string 【选填】 登录密码,格式(09a-zA-z_![]-+()) 3264个字节-客户端MD5传输 | ||
* user_name string 【选填】 不可重复,用户名由小写字母开头、小写字母下划线及数字组成(a-z_09)616bytes,在后台开关关闭时, 可以不必填 | ||
* nick_name string 【选填】昵称,可重复 | ||
* birthday string 【选填】 YYYY-MM-DD,不填为设置默认值"1970-01-01" | ||
* region string 【选填】 取值参考ISO_3166-1标准,3字节的数字字符 | ||
* machine_check_type【选填:是否必填受管理端自建账号配置控制】 人机识别方式,1 为图片验证,2 为 google reCAPTCHA 方式 ,3 为腾讯人机识别。未传时默认走图片验证码 | ||
* png_verify_code【选填:machine_check_type=1必填】 图片验证码,通过获取图片验证接口进行获取 ,60s 有效,只能校验一次 | ||
* google_response【选填:machine_check_type=2必填】 google reCAPTCHA 方式,response 入参,2 分钟有效,只能校验一次 | ||
* tencent_response【选填:machine_check_type=3必填】 tencent 人机识别返回 | ||
*/ | ||
verifyCodeRegister: (params: VerifyCodeRegisterParams) => Promise<VerifyCodeRegisterResp>; | ||
/** 用户账号是否注册查询接口 | ||
* | ||
* @param {*参数对象} params | ||
* account string 【必填】注册的帐号 | ||
* account_type int 【必填】1email,2phone | ||
* phone_area_code string 【选填 】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
*/ | ||
queryRegisterStatus: (params: QueryRegisterStatusParams) => Promise<QueryRegisterStatusResp>; | ||
/** | ||
* 获取用户信息(和queryUserInfoBy返回的结果相同,只不过是多了terms_of_service/privacy_policy信息) | ||
* @param {*参数对象} params | ||
* uid string 【必填】用户id | ||
* token string 【必填】自建帐号登录态信息 | ||
*/ | ||
queryUserInfo: (params: QueryUserInfoParams) => Promise<QueryUserInfoResp>; | ||
/** | ||
* 修改个人信息 | ||
* @param {*参数对象} params | ||
* token string 【必填】自建帐号登录态信息 | ||
* uid string 【必填】用户id | ||
* user_name string 【选填】 用户名由小写字母开头、小写字母下划线及数字组成(a-z_09)616bytes,在后台开关关闭时, 可以不必填;(注册时非必填,故此设置非必填);不能重复 | ||
* nick_name string 【选填】 昵称,允许重复 | ||
* birthday string 【选填】 YYYY-MM-DD,不填为设置默认值"1970-01-01" | ||
* region string 【选填】 取值参考ISO_3166-1标准,3字节的数字字符 | ||
* user_lang_type string 【选填】 用户语言信息 | ||
* is_receive_email int 【选填】用户同意接收线下邮件选项,1为同意,其他为不同意 | ||
*/ | ||
modifyProfile: (params: ModifyProfileParams) => Promise<ModifyProfileResp>; | ||
/** | ||
* 修改账号信息:参考接口 修改账号信息接口 | ||
* @param {*} params | ||
* verify_type int 【必填】验证方式,1:使用验证码,2:使用旧密码 3: 使用当前自建账号登录态!! | ||
* verify_code string / int 【当verify_type=1时必填】验证码, 可为int型老协议适配 | ||
* password string 【当verify_type=2时必填】 密码,格式(09a-zA-z_![]-+()) 32 - 64个字节-客户端MD5传输 | ||
* account string 【当verify_type!=3时必填】当前存在的账号 | ||
* phone_area_code string 【account_type = 2必填】 手机登录时为必填参数, 这里填写的是手机区号字段 | ||
* account_type int 【当verify_type!=3时必填】1 email, 2 phone | ||
* token string 【当verify_type=3时必填】自建帐号登录态信息 | ||
* uid string 【当verify_type=3时必填】用户id | ||
* | ||
* verify_code_modify string 【必填】被修改账号的验证码,修改账号验证码(code_type=3) | ||
* account_modify string 【必填】要修改的帐号 | ||
* account_type_modify int 【必填】要修改的账号,类似1email,2phone | ||
* phone_area_code_modify string 【ccount_type_modify = 2必填】 要修改的账号是手机时为必填参数, 这里填写的是手机区号字段 | ||
*/ | ||
modifyAccountInfo: (params: ModifyAccountInfoParams) => Promise<ModifyAccountInfoResp>; | ||
/** | ||
* 用户名username已被注册(重复)查询接口 | ||
* @param {*参数对象} params | ||
* username string 【必填】用户id | ||
*/ | ||
queryUserNameStatus: (params: QueryUserNameStatusParams) => Promise<QueryUserNameStatusResp>; | ||
/** | ||
* 查询 LI uid 是否同意了协议,是否需要升级 | ||
* @param params | ||
* @returns | ||
*/ | ||
getProtocol: (params: GetProtocolParam) => Promise<GetProtocolResp>; | ||
/** | ||
* 设置 LI uid 同意协议 | ||
* @param params | ||
* @returns | ||
*/ | ||
setProtocol: (params: SetProtocolParam) => Promise<SetProtocolResp>; | ||
/** | ||
* 修改用户协议版本 | ||
* @param {*} params | ||
* uid 用户uid | ||
* token 自建账号token | ||
* privacy_policy 隐私政策版本号 | ||
* terms_of_service 服务期限版本号 | ||
* @returns | ||
*/ | ||
modifyUserAgreement: (params: ModifyUserAgreementParams) => Promise<ModifyUserAgreementResp>; | ||
/** | ||
* LonelyFish新增需求,官网渠道账号新增字段,存储玩家不接收Idomoo videos的选项 | ||
* @param {*参数对象} params | ||
* uid string 【必填】用户id | ||
* token string 【必填】自建帐号登录态信息 | ||
* is_receive_video int 【必填】存储玩家不接收Idomoo videos的选项: -1 未设置, 0表示不接收, 1表示接收 | ||
* @returns { | ||
* ret: Response status, 0 stands for success, others stands for failure | ||
* msg: string Response message | ||
* } | ||
*/ | ||
setReceiveVideo: (params: any) => Promise<any>; | ||
/** | ||
* 查询当前账号是否允许邮件推送 | ||
* @returns | ||
*/ | ||
getReceiveEmail: (params?: any) => Promise<any>; | ||
/** | ||
* 设置当前账号是否允许邮件推送 | ||
* @returns | ||
*/ | ||
setReceiveEmail: (params?: any) => Promise<any>; | ||
/** | ||
* 校验自建账号token有效性 | ||
* @param {*参数对象} params | ||
* uid string 【必填】用户id | ||
* token string 【必填】自建帐号登录态信息 | ||
*/ | ||
checkAccountLogined: (params?: any) => Promise<any>; | ||
/** 登出 | ||
* token string 【必填】自建帐号登录态信息 | ||
* uid string 【必填】用户id | ||
*/ | ||
logout: (params: LogoutParams) => Promise<RespMeta>; | ||
} |
import { SDKConfig } from '../config'; | ||
/** | ||
* 映射相关 API | ||
*/ | ||
export default class { | ||
@@ -6,6 +9,50 @@ private config; | ||
constructor(config: SDKConfig); | ||
/** | ||
* 查询此openid上的map列表 | ||
* @param {* Object} params | ||
* token:自建账号token 【必填】 | ||
* openid:自建账号uid 【必填】 | ||
*/ | ||
queryThirdMap: (params?: any) => Promise<any>; | ||
/** | ||
* 查询映射到渠道的自建账号 | ||
* @param {* Object} params | ||
* third_type //steam ,facebook ,twitter ... | ||
* channel_info 渠道信息 | ||
* @returns | ||
*/ | ||
queryAccountMap: (params?: any) => Promise<any>; | ||
/** | ||
* 解除映射 | ||
* @param { Object} params | ||
* token:string 自建账号token 【必填】 | ||
* openid:string 自建账号openid 【必填】 | ||
* unmap_channelid:int 解除三方渠道id | ||
*/ | ||
unmap: (params?: any) => Promise<any>; | ||
/** | ||
* 建立自建账号和三方平台的映射关系 | ||
* @param {*} params | ||
* params: | ||
* ({ | ||
* third_type:'',//三方平台类型 | ||
* channel_info:{ | ||
* openid.ns:'', | ||
* openid.mode:'', | ||
* openid.op_endpoint:'', | ||
* openid.claimed_id:'', | ||
* openid.identity:'', | ||
* openid.return_to:'', | ||
* openid.response_nonce:'', | ||
* openid.assoc_handle:'', | ||
* openid.signed:'', | ||
* openid.sig:'' | ||
* }, | ||
* sacc_channel_info:{ | ||
* token:''//自建账号token, | ||
* openid:''//uid | ||
* } | ||
* })//目前仅支持steam,steam的channel_info暂时如此 | ||
*/ | ||
map: (params?: any) => Promise<any>; | ||
} |
@@ -1,5 +0,8 @@ | ||
import { IntlSignInResp, RespMeta } from '../type/common.type'; | ||
import { CredentialFromResultRes, IntlSignInResp } from '../type/common.type'; | ||
import { SDKConfig } from '../config'; | ||
import { ThirdAuthorizeParams, ThirdAuthorizeResp, IntlAuthorizeParams, GetThirdAccessTokenParams, GetThirdAccessTokenResp, LoginParams, LoginResp, getRedirectResultParams, SignInWithRedirectParams } from '../type'; | ||
import { ThirdChannelInfo } from '../type/third-common.type'; | ||
/** | ||
* 三方渠道相关 API | ||
*/ | ||
export default class { | ||
@@ -11,8 +14,54 @@ private config; | ||
constructor(config: SDKConfig); | ||
/** | ||
* 获取三方登录信息 | ||
* | ||
* @returns url | ||
*/ | ||
getThirdLoginInfo: (params: ThirdAuthorizeParams) => Promise<ThirdAuthorizeResp | unknown>; | ||
getThirdAccessToken: (reqParams: GetThirdAccessTokenParams) => Promise<GetThirdAccessTokenResp>; | ||
/** | ||
* | ||
* 使用重定向模式进行三方渠道身份验证 | ||
* | ||
* 调用该方法会在当前页面重定向到三方渠道的授权页面 | ||
* 授权成功后,会重定向到传入的 callbackurl | ||
* | ||
* @important | ||
* callback 增加一个参数 operate_type ,让统一回调识别为重定向模式 | ||
* | ||
* @param params | ||
*/ | ||
signInWithRedirect: (params: SignInWithRedirectParams) => void; | ||
credentialFromRedirect: (params: getRedirectResultParams) => Promise<RespMeta | null>; | ||
/** | ||
* | ||
* 从链接上解析出身份提供商的的 OAuth 身份凭据 | ||
* 一般是在页面加载时进行 | ||
* | ||
* 1. 调用 getRedirectResult 从链接上获取 state, msgType, code(等渠道的信息) | ||
* 2. 使用 redirectResult 获取 credential | ||
* | ||
* @param params | ||
* @returns | ||
*/ | ||
credentialFromRedirect: (params: getRedirectResultParams) => Promise<CredentialFromResultRes | null>; | ||
/** 三方渠道登录 intl, 获取 openid | ||
* | ||
* @param param0 | ||
* @returns | ||
*/ | ||
thirdChannelLogin: <T extends keyof ThirdChannelInfo>({ third_type, channel_info, }: IntlAuthorizeParams<T>) => Promise<IntlSignInResp<T>>; | ||
/** 三方渠道快速登录, 发起渠道授权,登录 intl 获取 openid | ||
* | ||
* | ||
* 只支持 popup 模式,不支持 redirect 模式 | ||
* @param param0 | ||
* @returns | ||
*/ | ||
login: <T extends keyof ThirdChannelInfo>({ third_type, extra, }: LoginParams<T>) => Promise<LoginResp>; | ||
/** 三方渠道登录 MSDK | ||
* | ||
*目前兼容 'facebook', 'google', 'apple' 渠道 | ||
* @param param0 | ||
* @returns | ||
*/ | ||
thirdChannelLoginToMsdk: ({ third_type, channel_info }: { | ||
@@ -22,8 +71,56 @@ third_type: string; | ||
}) => Promise<any>; | ||
/** 分享 | ||
* 公共方法(新版) | ||
* @param {*} params | ||
*/ | ||
openShareBox: (params?: any) => Promise<unknown>; | ||
/** 获取三方 authlink 链接 | ||
* | ||
* 1. 访问三方渠道 authlink 接口 | ||
* 2. 对链接进行处理 | ||
* | ||
* @param options | ||
* @returns | ||
*/ | ||
private getAuthLink; | ||
/** 处理三方渠道返回的授权信息 | ||
* | ||
* 1. 取消授权 | ||
* 2. 授权失败 | ||
* 3. 授权成功,用 code 换 token 等授权信息 | ||
* 4. 授权成功,直接返回授权信息 | ||
* | ||
* @param options | ||
* @returns | ||
*/ | ||
private credentialFromResult; | ||
/** | ||
* 在页面加载时检索身份提供商的的 OAuth 令牌 | ||
* | ||
* 1. 打开 iframe: auth_iframe.html 从这个 iframe 里获取身份提供的 OAuth 令牌,如 code | ||
* | ||
* If sign-in succeeded, returns the signed in user. | ||
* If sign-in was unsuccessful, fails with an error. | ||
* If no redirect operation was called, returns `null`. | ||
* @param params | ||
* @returns | ||
*/ | ||
private getRedirectResult; | ||
/** | ||
* kakao version 3 ,login | ||
* @param params | ||
* appId | ||
* jsKey | ||
* @returns | ||
*/ | ||
private kakaoV3Login; | ||
/** | ||
* kakao story share | ||
* @param params | ||
* url | ||
* text | ||
* jsKey kakao appkey for jssdk | ||
* @returns | ||
*/ | ||
private kakaoStoryShare; | ||
} |
@@ -8,3 +8,9 @@ import { QueryGameNameParams, QueryGameNameResp } from '../type/common.type'; | ||
queryMyRegion: () => Promise<any>; | ||
/** | ||
* | ||
* https://iwiki.woa.com/pages/viewpage.action?pageId=520665832 | ||
* @param params region、lang_type、gameid | ||
* @returns | ||
*/ | ||
queryGameName: (params: QueryGameNameParams) => Promise<QueryGameNameResp>; | ||
} |
@@ -10,2 +10,5 @@ export declare const MACHINE_CHECK_TYPE: { | ||
}; | ||
/** | ||
* 渠道(channel)常量类 | ||
*/ | ||
export declare const THIRD_CHANNEL_IDS: { | ||
@@ -54,2 +57,6 @@ readonly guest: 3; | ||
export declare const THIRD_LOGIN_PARAMS: any; | ||
/** | ||
* popup 模式下 渠道登陆窗口尺寸 | ||
* width、height、 | ||
*/ | ||
export declare const THIRD_LOGIN_POPUP_LAYOUT: { | ||
@@ -56,0 +63,0 @@ readonly [x: string]: { |
@@ -5,2 +5,5 @@ import { SDKConfig } from '../config'; | ||
constructor(config: SDKConfig); | ||
/** | ||
* 查询 | ||
*/ | ||
queryGameInfo(params: QueryGameInfoParam): Promise<QueryGameInfoResp>; | ||
@@ -7,0 +10,0 @@ queryBindListBySacc(params: QueryBindListBySaccParam): Promise<any>; |
@@ -1,4 +0,3 @@ | ||
import '../utils/polyfill'; | ||
import { IntlRequestParams, RespMeta } from '../type/common.type'; | ||
import { SubscribeEmailParams, UnbindParams, VerifyLoginParams, intlLogoutParams } from '../type/cacc.type'; | ||
import { RespMeta } from '../type/common.type'; | ||
import { VerifyLoginParams, intlLogoutParams } from '../type/cacc.type'; | ||
import { SDKConfig } from '../config'; | ||
@@ -23,25 +22,47 @@ import { DecryptAESParams } from '../type'; | ||
export declare const CHANNEL_DIS = "00000000"; | ||
/** | ||
* INTL 平台 API | ||
*/ | ||
export default class { | ||
private config; | ||
constructor(config: SDKConfig); | ||
/** | ||
* 登录 | ||
*/ | ||
uidToOpenID: (params?: {}, extraConfig?: {}) => Promise<any>; | ||
getBindChannelsByOpenID({ openid, token }: { | ||
openid: string; | ||
token: string; | ||
}, extraConfig?: {}): Promise<any>; | ||
getBindChannelsByUid({ channel_info }: { | ||
channel_info: any; | ||
}, extraConfig?: {}): Promise<any>; | ||
/** | ||
* 查询映射 | ||
*/ | ||
queryChannelMap(params: {} | undefined, extraConfig: any): Promise<any>; | ||
/** | ||
* 建立映射 | ||
*/ | ||
map(params: {} | undefined, extraConfig: any): Promise<any>; | ||
/** | ||
* 解除映射 | ||
*/ | ||
unmap(params: {} | undefined, extraConfig: any): Promise<any>; | ||
bind(params: {} | undefined, extraConfig: any): Promise<RespMeta>; | ||
unbind(params: UnbindParams, extraConfig: any): Promise<RespMeta>; | ||
subscribeEmail(params: SubscribeEmailParams, extraConfig: any): Promise<RespMeta>; | ||
/** | ||
* 登录鉴权 | ||
*/ | ||
verifyLogin: ({ openid, token, channel_id }: VerifyLoginParams) => Promise<any>; | ||
/** | ||
* intl解密 | ||
*/ | ||
decryptAES(params: DecryptAESParams): Promise<import("axios").AxiosResponse<any>>; | ||
/** | ||
* Query uid through INTL openid | ||
*/ | ||
getChannelInfo(params: {} | undefined, extraConfig: any): Promise<any>; | ||
/** | ||
* 获取账号配置 | ||
* @returns | ||
*/ | ||
queryAccountConfig(params: {} | undefined, extraConfig: any): Promise<any>; | ||
/** | ||
* Intl 退出登录 | ||
* | ||
* channel_id 需要和 intl 授权时的 channel id 相一致 | ||
*/ | ||
intlLogout(params: intlLogoutParams): Promise<RespMeta>; | ||
intlRequest(params: IntlRequestParams): Promise<RespMeta>; | ||
} |
@@ -0,5 +1,46 @@ | ||
/** | ||
* 自建账号get请求 | ||
* @param url | ||
* @param data | ||
* @param config | ||
* @param headers | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare function get(url: string, data?: {}, config?: {}, headers?: {}, options?: {}): Promise<any>; | ||
/** | ||
* 自建账号get请求(返回结果包含header信息) | ||
* @param url | ||
* @param data | ||
* @param config | ||
* @param headers | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare function getWithHeader(url: string, data?: {}, config?: {}, headers?: {}, options?: {}): Promise<import("axios").AxiosResponse<any>>; | ||
/** | ||
* 自建账号post请求 | ||
* @param url | ||
* @param data | ||
* @param config | ||
* @param headers | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare function post(url: string, data?: {}, config?: {}, headers?: {}, options?: {}): Promise<any>; | ||
/** | ||
* 通用post请求 | ||
* @param url | ||
* @param data | ||
* @param headers | ||
* @returns | ||
*/ | ||
export declare function singlePost(url: string, data: any, headers?: Record<string, unknown>): Promise<any>; | ||
/** | ||
* 通用get请求 | ||
* @param url | ||
* @param data | ||
* @param headers | ||
* @returns | ||
*/ | ||
export declare function singleGet(url: string, data: any, headers?: Record<string, unknown>): Promise<any>; |
@@ -7,2 +7,11 @@ export declare const STEAM_PARAM_KEYS: readonly ["openid.ns", "openid.mode", "openid.op_endpoint", "openid.claimed_id", "openid.identity", "openid.return_to", "openid.response_nonce", "openid.assoc_handle", "openid.signed", "openid.sig"]; | ||
} | ||
/** | ||
* | ||
* 后台 auth/login 授权、绑定等需要的 steam channelInfo 是 steamid 和 query_str | ||
* 而 steam 返回的是 Record<TSteamParamKeys, string> | ||
* 所以如果有 query_str, steamid 了,就无需重新构造出来 | ||
* 没有的话,根据 steam 返回的 Record<TSteamParamKeys, string> 构造出后台需要的 channelInfo | ||
* @param params | ||
* @returns | ||
*/ | ||
export declare function generateSteamChannelInfo(params: GenerateSteamChannelInfoParams): { | ||
@@ -9,0 +18,0 @@ steamid: string; |
@@ -0,1 +1,11 @@ | ||
/** | ||
* 校验参数合法性 | ||
* @param params 参数对象 | ||
* @param keys 必要参数key值数组 | ||
* @param validates 自定义校验规则对象数组 | ||
* @param validates[].key 参数key | ||
* @param validates[].valid 校验规则,目前只支持正则 | ||
* @param validates[].msg 描述 | ||
* @returns 合法性 | ||
*/ | ||
export declare function assertNecessaryParams(params?: any, keys?: any, validates?: any): true | { | ||
@@ -5,9 +15,37 @@ msg: any; | ||
}; | ||
/** | ||
* 校验地区合法性 | ||
* @returns | ||
*/ | ||
export declare function validRegion(value: string): boolean; | ||
/** | ||
* 校验语言合法性 | ||
* @returns | ||
*/ | ||
export declare function validLang(value: string): boolean; | ||
/** | ||
* 校验生日合法性;允许yy-mm格式 | ||
* @returns | ||
*/ | ||
export declare function validBirthday(value: string): boolean; | ||
/** | ||
* 格式化后台接口response为标准对外api结构体 | ||
* @param rtn | ||
* @returns | ||
*/ | ||
export declare function formatBackend(rtn: Record<string, any>): any; | ||
/** | ||
* 格式化数据为标准对外api结构体 | ||
* @param rtn | ||
* @returns | ||
*/ | ||
export declare function formatData(rtn?: Record<string, any>): any; | ||
/** | ||
* 校验请求是否失败 | ||
*/ | ||
export declare function getCurrentUrl(): string; | ||
/** | ||
* Dynamically load script tag resources | ||
*/ | ||
export declare function dynaLoadScript(params: any, callbackFunc: any): void; | ||
export declare function osType(): number; |
import { MachineCheckMeta, UidMeta } from './common.type'; | ||
/** | ||
* 自建账号:账号参数 | ||
*/ | ||
export interface AccountMeta { | ||
@@ -7,4 +10,21 @@ account: string; | ||
} | ||
/** | ||
* 自建账号:账号类型 | ||
* 1: email | ||
* 2: phone | ||
*/ | ||
export type AccountType = 1 | 2; | ||
/** | ||
* 自建账号:账号删除状态 | ||
* -1: 查询失败 | ||
* 0: 未撤回任何删除账户记录或删除号码 | ||
* 1:账号删除前的等待期 | ||
* 2:已经成功删除账号 | ||
* 3:正在删除账号 | ||
* 4:删除账号失败 | ||
*/ | ||
export type DelAccountStatusType = -1 | 0 | 1 | 2 | 3 | 4; | ||
/** | ||
* 自建账号:通用个人基础信息 | ||
*/ | ||
export interface PersonalInfoMeta { | ||
@@ -17,5 +37,20 @@ user_name?: string; | ||
} | ||
/** | ||
* 自建账号:是否接收邮件推送 | ||
* 1:允许推送 其他:不允许 | ||
*/ | ||
export type ReceiveEmailType = 0 | 1; | ||
/** | ||
* 自建账号:用户名是否可用 | ||
* 0:不可用, 1:可用 | ||
*/ | ||
export type UsernameAvailableType = 0 | 1; | ||
/** | ||
* 自建账号:账号是否存在 | ||
* 0:不存在, 1:存在 | ||
*/ | ||
export type RegisterType = 0 | 1; | ||
/** | ||
* 自建账号:用户协议 | ||
*/ | ||
export interface UserAgreementMeta { | ||
@@ -25,2 +60,5 @@ privacy_policy: string; | ||
} | ||
/** | ||
* 自建账号:用户协议及更新时间 | ||
*/ | ||
export interface UpdateUserAgreementMeta extends UserAgreementMeta { | ||
@@ -30,6 +68,16 @@ privacy_update_time: number; | ||
} | ||
/** | ||
* 自建账号:验证方式 | ||
* 1:使用验证码 2:使用旧密码 3:使⽤当前⾃建账号的登录态 | ||
*/ | ||
export type VerifyType = 1 | 2 | 3; | ||
/** | ||
* 自建账号:Uid和expire参数 | ||
*/ | ||
export interface UidExpireRespMeta extends UidMeta { | ||
expire: number; | ||
} | ||
/** | ||
* 自建账号:手机号参数 | ||
*/ | ||
export interface PhoneMeta { | ||
@@ -39,2 +87,5 @@ phone: string; | ||
} | ||
/** | ||
* 自建账号:密码验证码参数 | ||
*/ | ||
export interface PasswordMeta { | ||
@@ -44,6 +95,15 @@ password: string; | ||
} | ||
/** | ||
* 自建账号:人机校验参数 | ||
*/ | ||
export interface MachineCheckParams extends AccountMeta, MachineCheckMeta { | ||
} | ||
/** | ||
* 自建账号:密码、人机校验参数 | ||
*/ | ||
export interface PasswordParams extends PasswordMeta, MachineCheckParams { | ||
} | ||
/** | ||
* 自建账号:渠道参数信息 | ||
*/ | ||
export interface CustomAccountMeta { | ||
@@ -54,4 +114,7 @@ token: string; | ||
} | ||
/** | ||
* 自建账号:渠道信息 | ||
*/ | ||
export interface CustomAccountChannelInfo { | ||
customAccount: CustomAccountMeta; | ||
} |
import { PersonalInfoMeta, UsernameAvailableType, UserAgreementMeta, RegisterType, VerifyType, UidExpireRespMeta, PhoneMeta, UpdateUserAgreementMeta, MachineCheckParams, PasswordParams, AccountMeta, AccountType } from './cacc-common.type'; | ||
import { RespMeta, CodeType, BasicRespMeta, UidMeta, OpenIdMeta, ExtraMeta } from './common.type'; | ||
import { RespMeta, CodeType, BasicRespMeta, UidMeta, OpenIdMeta } from './common.type'; | ||
/** | ||
* 【API 参数】自建账号密码登录 | ||
*/ | ||
export interface SignInParams extends MachineCheckParams { | ||
password: string; | ||
device_info?: Record<string, any>; | ||
qr_code?: string; | ||
} | ||
/** | ||
* 【API 回包】自建账号密码 / 验证码登录 | ||
*/ | ||
export interface CACCSignInResp extends RespMeta, UidExpireRespMeta { | ||
register_time: number; | ||
} | ||
/** | ||
* 【API 参数】自建账号验证码登录 | ||
*/ | ||
export interface VerifyCodeSignInParams extends MachineCheckParams { | ||
@@ -14,3 +24,7 @@ verify_code: string; | ||
only_login_type?: 0 | 1; | ||
qr_code?: string; | ||
} | ||
/** | ||
* 【API 参数】INTL 账号登录(使用自建账号) | ||
*/ | ||
export interface IntlSignInParams extends OpenIdMeta { | ||
@@ -26,4 +40,10 @@ account_plat_type: number; | ||
} | ||
/** | ||
* 【API 参数】获取自建账号个人信息 | ||
*/ | ||
export interface QueryUserInfoParams extends UidMeta { | ||
} | ||
/** | ||
* 【API 回包】获取自建账号个人信息 | ||
*/ | ||
export interface QueryUserInfoResp extends ModifyProfileResp, UpdateUserAgreementMeta, PhoneMeta { | ||
@@ -34,5 +54,11 @@ account_type: AccountType; | ||
} | ||
/** | ||
* 【API 参数】修改自建账号个人信息 | ||
*/ | ||
export interface ModifyProfileParams extends PersonalInfoMeta, OpenIdMeta { | ||
user_lang_type?: string; | ||
} | ||
/** | ||
* 【API 回包】修改自建账号个人信息 | ||
*/ | ||
export interface ModifyProfileResp extends RespMeta, PersonalInfoMeta, PhoneMeta { | ||
@@ -42,10 +68,22 @@ email: string; | ||
} | ||
/** | ||
* 【API 参数】检查用户名是否被注册(自建账号) | ||
*/ | ||
export interface QueryUserNameStatusParams { | ||
user_name: string; | ||
} | ||
/** | ||
* 【API 回包】检查用户名是否被注册(自建账号) | ||
*/ | ||
export interface QueryUserNameStatusResp extends RespMeta { | ||
username_available: UsernameAvailableType; | ||
} | ||
/** | ||
* 【API 参数】修改用户信息隐私政策、服务条款版本号(自建账号) | ||
*/ | ||
export interface ModifyUserAgreementParams extends UserAgreementMeta, OpenIdMeta { | ||
} | ||
/** | ||
* 【API 回包】修改用户信息隐私政策、服务条款版本号(自建账号) | ||
*/ | ||
export interface ModifyUserAgreementResp extends RespMeta, UserAgreementMeta { | ||
@@ -55,20 +93,44 @@ } | ||
} | ||
/** | ||
* 【API 回包】查询账号是否被注册(自建账号) | ||
*/ | ||
export interface QueryRegisterStatusResp extends RespMeta { | ||
is_register: RegisterType; | ||
} | ||
/** | ||
* 【API 参数】自建账号密码注册 | ||
*/ | ||
export interface RegisterParams extends VerifyCodeRegisterParams { | ||
user_lang_type?: string; | ||
} | ||
/** | ||
* 【API 回包】自建账号密码注册 | ||
*/ | ||
export interface RegisterResp extends RespMeta, UidExpireRespMeta { | ||
} | ||
/** | ||
* 【API 参数】自建账号验证码注册 | ||
*/ | ||
export interface VerifyCodeRegisterParams extends PersonalInfoMeta, PasswordParams { | ||
} | ||
/** | ||
* 【API 回包】自建账号验证码注册 | ||
*/ | ||
export interface VerifyCodeRegisterResp extends RespMeta, UidExpireRespMeta { | ||
} | ||
/** | ||
* 【API 参数】发送邮箱/手机验证码 | ||
*/ | ||
export interface RequestVerifyCodeParams extends MachineCheckParams { | ||
code_type: CodeType; | ||
} | ||
/** | ||
* 【API 回包】发送邮箱/手机验证码 | ||
*/ | ||
export interface RequestVerifyCodeResp extends RespMeta { | ||
expire_time: number; | ||
} | ||
/** | ||
* 【API 参数】检查验证码是否正确 | ||
*/ | ||
export interface QueryCodeStatusParams extends AccountMeta { | ||
@@ -78,4 +140,10 @@ code_type: CodeType; | ||
} | ||
/** | ||
* 【API 回包】检查验证码是否正确 | ||
*/ | ||
export interface QueryCodeStatusResp extends RespMeta { | ||
} | ||
/** | ||
* 【API 回包】获取图形验证码 | ||
*/ | ||
export interface RequestVerifyImageResp extends BasicRespMeta { | ||
@@ -85,2 +153,5 @@ sessionid: string; | ||
} | ||
/** | ||
* 【API 参数】修改密码 | ||
*/ | ||
export interface ResetPasswordParams extends PasswordParams { | ||
@@ -90,4 +161,10 @@ verify_type: VerifyType; | ||
} | ||
/** | ||
* 【API 参数】登出 | ||
*/ | ||
export interface LogoutParams extends UidMeta { | ||
} | ||
/** | ||
* 【API 参数】修改自建账号信息 | ||
*/ | ||
export interface ModifyAccountInfoParams extends MachineCheckParams { | ||
@@ -104,4 +181,14 @@ verify_type: VerifyType; | ||
} | ||
/** | ||
* 【API 回包】修改自建账号信息 | ||
*/ | ||
export interface ModifyAccountInfoResp extends RespMeta { | ||
} | ||
/** | ||
* 【API 参数】绑定 | ||
* For Garena binding,there are two situations for binding. One is for Binding Channel and Guest. Another is binding channel and channel. | ||
* For binding Guest and channel, please input channel token into bind_channel_info, so that we can bind guest and this channel. | ||
* For binding channel and channel, please into the secondary channel access token intobind_channel_info, so that we can bind this chanel to the original one | ||
* Moreover, for the binding between channels, please set it as true, however, when binding guest and channel, you can set it as false or just ignore it. | ||
*/ | ||
export interface BindParams { | ||
@@ -117,19 +204,16 @@ openid?: string; | ||
} | ||
/** | ||
* 【API 参数】解绑 | ||
*/ | ||
export interface UnbindParams { | ||
openid: string; | ||
token?: string; | ||
token: string; | ||
unbind_channelid: number; | ||
oauth_channelid: number; | ||
uid?: string; | ||
silence_days?: number; | ||
} | ||
export interface SubscribeEmailParams { | ||
email: string; | ||
openid?: string; | ||
from?: string; | ||
country?: string; | ||
lang: string; | ||
tag?: string[]; | ||
subscribe_state: number; | ||
extra?: ExtraMeta[]; | ||
} | ||
/** | ||
* 【API 参数】Intl退出登录 | ||
*/ | ||
export interface intlLogoutParams { | ||
@@ -136,0 +220,0 @@ openid: string; |
import { CustomAccountChannelInfo, DelAccountStatusType } from './cacc-common.type'; | ||
import { ThirdChannelInfo } from './third-common.type'; | ||
import { ThirdChannelInfo, ThirdChannelName } from './third-common.type'; | ||
/** | ||
* 性别 | ||
* 0:未定义 1:男 2:女 | ||
*/ | ||
export type GenderType = 0 | 1 | 2; | ||
/** | ||
* 是否首次登录 | ||
* -1:未知 0:否 1:是 | ||
*/ | ||
export type FirstLoginStatusType = -1 | 0 | 1; | ||
/** | ||
* Uid参数 | ||
*/ | ||
export interface UidMeta { | ||
@@ -9,2 +20,5 @@ uid: string; | ||
} | ||
/** | ||
* OpenId参数 | ||
*/ | ||
export interface OpenIdMeta { | ||
@@ -14,2 +28,5 @@ token: string; | ||
} | ||
/** | ||
* 后台返回通用数据 | ||
*/ | ||
export interface BasicRespMeta { | ||
@@ -19,5 +36,11 @@ ret: number; | ||
} | ||
/** | ||
* 后台返回数据 | ||
*/ | ||
export interface RespMeta extends BasicRespMeta { | ||
seq?: string; | ||
} | ||
/** | ||
* 验证码类型 | ||
*/ | ||
export declare enum CodeType { | ||
@@ -29,2 +52,5 @@ register = 0, | ||
} | ||
/** | ||
* 是否支持人机验证 | ||
*/ | ||
export declare enum SUPPORT_CAPTCHA_TYPE { | ||
@@ -34,2 +60,5 @@ YES = 1, | ||
} | ||
/** | ||
* 人机验证参数 | ||
*/ | ||
export interface MachineCheckMeta { | ||
@@ -43,4 +72,10 @@ machine_check_type?: 1 | 2 | 3; | ||
} | ||
/** | ||
* Intl渠道信息 合并自建账号、第三方渠道 | ||
*/ | ||
export interface IntlChannelInfo extends ThirdChannelInfo, CustomAccountChannelInfo { | ||
} | ||
/** | ||
* INTL授权返回的信息 | ||
*/ | ||
export interface IntlSignInResp<T extends keyof IntlChannelInfo = any> extends RespMeta { | ||
@@ -90,2 +125,5 @@ email: string; | ||
} | ||
/** | ||
* 【API 参数】获取Game Name | ||
*/ | ||
export interface QueryGameNameParams { | ||
@@ -96,5 +134,11 @@ region?: string; | ||
} | ||
/** | ||
* 【API 回包】获取Game Name | ||
*/ | ||
export interface QueryGameNameResp extends RespMeta { | ||
game_name: string; | ||
} | ||
/** | ||
* 邮件订阅 自定义参数 | ||
*/ | ||
export interface ExtraMeta { | ||
@@ -109,2 +153,9 @@ field_name: string; | ||
config?: Record<string, any>; | ||
headers?: Record<string, any>; | ||
} | ||
export interface RedirectResultRes extends RespMeta { | ||
msgType: ThirdChannelName; | ||
} | ||
export interface CredentialFromResultRes extends RespMeta { | ||
thirdType: ThirdChannelName; | ||
} |
@@ -9,1 +9,6 @@ export interface DecryptAESParams { | ||
} | ||
export interface GetBindChannelsByOpenIDParams { | ||
openid: string; | ||
token: string; | ||
channel_id: string | number; | ||
} |
@@ -0,1 +1,9 @@ | ||
/** | ||
* 三方渠道 channel ID enum | ||
* | ||
* FIXME: 因为 account-api 只有一个 default 导出,所以不能导出 enum 类型 | ||
*/ | ||
/** | ||
* 三方渠道: 渠道名称 enum | ||
*/ | ||
declare enum ThirdChannelNameEnum { | ||
@@ -20,3 +28,11 @@ facebook = "facebook", | ||
} | ||
/** | ||
* 三方渠道: 渠道名称 | ||
*/ | ||
export type ThirdChannelName = keyof typeof ThirdChannelNameEnum; | ||
/** | ||
* 三方渠道: 渠道参数 | ||
* 渠道的登录信息,不同渠道内容不同, 详见渠道信息说明 | ||
* https://developers.intlgame.com/docs/intlsdk/zh/JS/Info/DataTypeDefinition#ChannelInfo | ||
*/ | ||
export interface ThirdChannelInfo { | ||
@@ -44,11 +60,24 @@ facebook: FacebookChannelInfo; | ||
export type Assertion = AssertKeysEqual<ShapeOf<typeof ThirdChannelNameEnum>, ThirdChannelInfo>; | ||
/** | ||
* 三方渠道: issuerId | ||
* 用于识别要调用的sony环境;QA:8, PROD:256, DEV:1 | ||
*/ | ||
export interface IssuerIdMeta { | ||
issuerId?: number; | ||
} | ||
/** | ||
* 三方渠道: Facebook channelInfo | ||
*/ | ||
export interface FacebookChannelInfo { | ||
access_token: string; | ||
} | ||
/** | ||
* 三方渠道: Google channelInfo | ||
*/ | ||
export interface GoogleChannelInfo { | ||
code: string; | ||
} | ||
/** | ||
* 三方渠道: Xbox channelInfo | ||
*/ | ||
export interface XboxChannelInfo { | ||
@@ -58,5 +87,11 @@ auth_token: string; | ||
} | ||
/** | ||
* 三方渠道: Garena channelInfo | ||
*/ | ||
export interface GarenaChannelInfo { | ||
access_token: string; | ||
} | ||
/** | ||
* 三方渠道: Twitter channelInfo | ||
*/ | ||
export interface TwitterChannelInfo { | ||
@@ -66,2 +101,5 @@ oauth_token: string; | ||
} | ||
/** | ||
* 三方渠道: Line channelInfo | ||
*/ | ||
export interface LineChannelInfo { | ||
@@ -71,2 +109,5 @@ access_token: string; | ||
} | ||
/** | ||
* 三方渠道: Apple channelInfo | ||
*/ | ||
export interface AppleChannelInfo { | ||
@@ -76,5 +117,11 @@ code: string; | ||
} | ||
/** | ||
* 三方渠道: VK channelInfo | ||
*/ | ||
export interface VKChannelInfo { | ||
token: string; | ||
} | ||
/** | ||
* 三方渠道: Steam channelInfo | ||
*/ | ||
export interface SteamChannelInfo { | ||
@@ -92,2 +139,5 @@ 'openid.ns': string; | ||
} | ||
/** | ||
* 三方渠道: Epic channelInfo | ||
*/ | ||
export interface EpicChannelInfo { | ||
@@ -101,2 +151,5 @@ openid: string; | ||
} | ||
/** | ||
* 三方渠道: Discord channelInfo | ||
*/ | ||
export interface DiscordChannelInfo { | ||
@@ -108,2 +161,5 @@ access_token: string; | ||
} | ||
/** | ||
* 三方渠道: PlayStation 5 channelInfo | ||
*/ | ||
export interface PlayStation5ChannelInfo extends IssuerIdMeta { | ||
@@ -113,2 +169,5 @@ code: string; | ||
} | ||
/** | ||
* 三方渠道: Twitch channelInfo | ||
*/ | ||
export interface TwitchChannelInfo { | ||
@@ -120,5 +179,11 @@ access_token: string; | ||
} | ||
/** | ||
* 三方渠道: Facebook Instant Game channelInfo | ||
*/ | ||
export interface FacebookInstantGameChannelInfo { | ||
signature: string; | ||
} | ||
/** | ||
* 三方渠道: Kakao v3 channelInfo | ||
*/ | ||
export interface KakaoV3ChannelInfo { | ||
@@ -125,0 +190,0 @@ zat: string; |
@@ -0,3 +1,7 @@ | ||
/** 三方渠道 API 类型 */ | ||
import { ThirdChannelName, ThirdChannelInfo, WindowOpenType, UxMode } from './third-common.type'; | ||
import { BasicRespMeta, IntlSignInResp } from './common.type'; | ||
/** | ||
* 【API 参数】第三方渠道授权 | ||
*/ | ||
export interface ThirdAuthorizeParams { | ||
@@ -29,5 +33,11 @@ third_type: ThirdChannelName; | ||
} | ||
/** | ||
* 【API 回包】第三方渠道授权 | ||
*/ | ||
export interface ThirdAuthorizeResp extends BasicRespMeta { | ||
access_token: string; | ||
} | ||
/** | ||
* 【API 参数】INTL 账号授权 | ||
*/ | ||
export interface IntlAuthorizeParams<T extends keyof ThirdChannelInfo> { | ||
@@ -37,2 +47,5 @@ third_type: T; | ||
} | ||
/** | ||
* 【API 参数】获取access_token | ||
*/ | ||
export interface GetThirdAccessTokenParams { | ||
@@ -46,2 +59,5 @@ gameid: string; | ||
} | ||
/** | ||
* 【API 回包】获取access_token | ||
*/ | ||
export interface GetThirdAccessTokenResp extends BasicRespMeta { | ||
@@ -53,2 +69,5 @@ access_token: string; | ||
} | ||
/** | ||
* 【API 参数】第三方渠道登录 | ||
*/ | ||
export interface LoginParams<T extends keyof ThirdChannelInfo> { | ||
@@ -58,2 +77,5 @@ third_type: T; | ||
} | ||
/** | ||
* 【API 回包】第三方渠道登录 | ||
*/ | ||
export interface LoginResp extends ThirdAuthorizeResp, IntlSignInResp { | ||
@@ -73,4 +95,3 @@ } | ||
export interface getRedirectResultParams { | ||
third_type: ThirdChannelName; | ||
extra?: ThirdAuthorizeParams['extra']; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { ClientOptions } from '../../src/type'; | ||
import { ClientOptions } from '../type'; | ||
import { SDKConfig } from '../config'; | ||
@@ -3,0 +3,0 @@ export declare function handleHost(config: SDKConfig, options: ClientOptions): SDKConfig; |
export declare const IFRAME_LOGINCALL_TRANS_PATH = "jssdk/logincallback_transmitter.html"; | ||
export declare const IFRAME_AUTH_HELPER = "jssdk/iframe_authHelper.html"; | ||
interface OpenIframeOptions { | ||
@@ -4,0 +3,0 @@ where: HTMLElement; |
export declare function getUrlParams(search?: string): any; | ||
/** | ||
* | ||
* TODO: 使用开源方案替换 | ||
* @param url | ||
* @returns | ||
*/ | ||
export declare function urlParse(url: string): any; |
import Aegis from 'aegis-web-mini-sdk'; | ||
import { ClientOptions, ThirdChannelName } from '../type'; | ||
/** | ||
* uin: openid (优先级高)或 uin | ||
* | ||
* ext1: 一般是参数 | ||
* ext2: gameID | ||
* ext3: scene | ||
*/ | ||
/** | ||
* 初始化 aegis 上报 SDK | ||
* | ||
*/ | ||
export declare function initReport(options: ClientOptions): Aegis; | ||
/** | ||
* 上报初始化事件 | ||
*/ | ||
export declare function reportJSSDKInit({ options }: { | ||
options: ClientOptions; | ||
}): void; | ||
/** | ||
* 上报跳转到三方渠道页面 | ||
* @param param0 | ||
*/ | ||
export declare function reportRedirectToThirdChannel({ thirdType, authlink, state, }: { | ||
@@ -12,2 +30,5 @@ thirdType: ThirdChannelName; | ||
}): void; | ||
/** | ||
* 上报请求接口获取三方渠道的 token | ||
*/ | ||
export declare function reportGetChannelToken({ thirdType, params, state, }: { | ||
@@ -18,2 +39,7 @@ thirdType: ThirdChannelName; | ||
}): void; | ||
/** | ||
* | ||
* 上报请求接口获取三方渠道的 token 时, 入参异常情况 | ||
* @param reqParams | ||
*/ | ||
export declare function reportGetChannelTokenParamsError({ thirdType, params, state, }: { | ||
@@ -24,2 +50,5 @@ thirdType: ThirdChannelName; | ||
}): void; | ||
/** | ||
* 上报请求接口获取三方渠道的 token 时接口返回异常 | ||
*/ | ||
export declare function reportGetChannelTokenError({ thirdType, params, resp, }: { | ||
@@ -30,2 +59,6 @@ thirdType: ThirdChannelName; | ||
}): void; | ||
/** | ||
* 一般传递 openid, 如果没有 openid 则传递 uid | ||
* @param openid | ||
*/ | ||
export declare function setReportUin(openid: string): void; |
@@ -12,3 +12,13 @@ import { ThirdChannelInfo, ThirdChannelName, UxMode } from '../type'; | ||
callbackurl: string; | ||
state: string; | ||
} | ||
/** | ||
* | ||
* 引导用户跳转到渠道的页面进行授权,一般只能通过 state 参数传递信息,渠道授权成功后会返回 state | ||
* 1. popup 模式,没有 callbackurl | ||
* 2. self 模式(重定向模式),需要把 state 参数的值设置成 callbackurl 这样通用的三方渠道回调页才知道要重定向回哪里。 | ||
* | ||
* 如果有 callbackrul, 则替换 authlink 中的 state | ||
* @param options | ||
*/ | ||
export declare function transformStateInAuthlink(options: TransformStateInAuthlinkOptions): string; | ||
@@ -20,8 +30,48 @@ interface TansformDisPlayModeInAuthlinkOptions { | ||
} | ||
/** | ||
* | ||
* 修改 authlink, 如果是弹窗模式,根据渠道修改 authlink 链接参数,让渠道方展示弹窗样式 | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare function transformDisPlayModeInAuthlink(options: TansformDisPlayModeInAuthlinkOptions): string; | ||
/** | ||
* ps5 渠道需要传 issuer_id,用于识别要调用的 sony 环境;QA:8, PROD:256, DEV:1 | ||
* @param channelInfo | ||
* @param hostThird | ||
* @returns | ||
*/ | ||
export declare function addPS5IssuerIdToChannelInfo(channelInfo: ThirdChannelInfo['ps5'], hostThird: string): import("../type").PlayStation5ChannelInfo; | ||
/** | ||
* 生成 twiiter 的回调地址 | ||
* | ||
* 1. 根据环境生成回调地址 | ||
* 2. 如果有业务回调地址,那么放在 state 里 | ||
* 3. 如果没有业务回调地址,那么 state 就是随机数 | ||
* | ||
* @param env | ||
* @param callbackurl | ||
* @returns | ||
*/ | ||
export declare function getTwitterLoginCallbackUrl(env: string, callbackurl: string): string; | ||
export declare function getStateFromAuthlink(authlink: string): string; | ||
/** | ||
* 检查是否使用新窗口打开 三方渠道授权页 | ||
* | ||
* 如果不是明确说明 _self 模式,那么默认使用新窗口打开 | ||
* @param windowOpenType | ||
* @returns | ||
*/ | ||
export declare function checkIfUseNewWindow(windowOpenType: string | undefined): boolean; | ||
/** | ||
* | ||
* 检查是否使用 popup 模式(最小弹出窗口)打开 三方渠道授权页 | ||
* | ||
* 如果不是明确说明用 fullScreen 模式,那么默认使用最小弹出窗口 (popup 模式) | ||
* @param uxMode | ||
* @returns | ||
*/ | ||
export declare function checkIsPopupMode(uxMode: UxMode | undefined): boolean; | ||
/** | ||
* 设置新窗口打开的 target | ||
*/ | ||
export declare function setNewWindowTarget({ ifUseNewWindow }: { | ||
@@ -28,0 +78,0 @@ ifUseNewWindow: boolean; |
@@ -0,4 +1,35 @@ | ||
/** | ||
* 获取查询参数 | ||
* @param url | ||
* @returns | ||
* | ||
* 获取到的 query 会被 searchParams 自动 decode 一次 | ||
* | ||
*/ | ||
export declare function getQueryParams(url: string): Record<string, string>; | ||
/** | ||
* 增加查询参数 | ||
* @param url | ||
* @param key | ||
* @param value value 注意不需要自己进行编码 encode | ||
* @returns | ||
*/ | ||
export declare function addQueryParam(url: string, key: string, value: string): string; | ||
/** | ||
* 删除查询参数 | ||
* @param url | ||
* @param key | ||
* @returns | ||
*/ | ||
export declare function deleteQueryParam(url: string, key: string): string; | ||
/** | ||
* 设置查询参数 | ||
* @param url | ||
* @param key | ||
* @param value value 注意不需要自己进行编码 encode | ||
* @returns | ||
* | ||
* @important 注意:浏览器的 URLSearchParams API 会自动进行编解码。 | ||
* | ||
*/ | ||
export declare function setQueryParam(url: string, key: string, value: string): string; |
export declare function arrayBufferToBase64(buffer?: never[]): string; | ||
/** | ||
* 删除对象的空白属性,如 null, undefined, '', 0, [], {} | ||
* @param obj | ||
* @returns | ||
*/ | ||
export declare function compacted(obj: Record<string, any>): {}; |
{ | ||
"name": "@intlsdk/account-api", | ||
"version": "1.18.0", | ||
"version": "1.19.0", | ||
"main": "dist/index.js", | ||
@@ -30,4 +30,3 @@ "typings": "dist/src/index.d.ts", | ||
"lodash-es": "^4.17.21", | ||
"md5": "^2.3.0", | ||
"nanoid": "^4.0.0" | ||
"md5": "^2.3.0" | ||
}, | ||
@@ -34,0 +33,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
632392
6
41
5160
- Removednanoid@^4.0.0
- Removednanoid@4.0.2(transitive)