import Vnmf from '../../index' declare module '../../index' { namespace createRewardedVideoAd { interface Option { /** Advertising unit id */ adUnitId: string /** Whether to enable multi -example mode * @default false */ multiton?: boolean } } namespace createInterstitialAd { interface Option { /** Advertising unit id */ adUnitId: string } } /** * Insert screen advertising component 。Plug -screen advertising component is a native component ,The level is higher than ordinary components 。Each time the screen advertising component is created, a brand new example will be returned (Intestinal ads on the applet side are not allowed to use across pages ),The default is hidden ,Need to call InterstitialAd.show() Display it 。 * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html */ interface InterstitialAd { /** Destroyed screen ads example 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html */ destroy(): void /** Cancel the monitoring and inserting screen ads to close the event * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html */ offClose(callback: InterstitialAd.OffCloseCallback): void /** Cancel the incidental incident of listening to the screen * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html */ offError(callback: InterstitialAd.OffErrorCallback): void /** Cancellation of monitoring screen ads loading events * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html */ offLoad(callback: InterstitialAd.OffLoadCallback): void /** Surveillance plug -in advertisement closure event 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html */ onClose(callback: InterstitialAd.OnCloseCallback): void /** Surveying the screen error event 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html */ onError(callback: InterstitialAd.OnErrorCallback): void /** Surveillance plug -in advertisement loading event 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html */ onLoad(callback: InterstitialAd.OnLoadCallback): void /** Load the screen ads 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html */ load(): Promise /** Display ads 。 * * **Error code information table ** * * If the screen ads shows failure ,InterstitialAd.show() The method will return one rejected Promise,Developers can get the error code and the corresponding error message 。 * * | Code | abnormal situation | cause | * | ------ | -------------- | -------------------------- | * | 2001 | Trigger frequency limit | The small program starts for a certain period of time and does not allow displayed screen ads within a certain period of time | * | 2002 | Trigger frequency limit | Insufficient interval between the last broadcast of the video ads or the inspiration video advertisement from the applet or incentive video advertisement ,Display screen ads are not allowed | * | 2003 | Trigger frequency limit | Currently playing incentive video ads or screen ads ,Do not allow displayed screen ads again | * | 2004 | Advertising rendering failed | This error is not an abnormal situation of the developer ,Or the advertising rendering fails due to the small program page surface switching | * | 2005 | Advertising calls abnormal | Insert screen ads not allowed cross -page to call | * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html */ show(): Promise } namespace InterstitialAd { /** Plug -screen advertisement closure event recovery function */ type OffCloseCallback = (res: VnmfGeneral.CallbackResult) => void /** The callback function of the screen error event */ type OffErrorCallback = (res: VnmfGeneral.CallbackResult) => void /** The callback function of the screen ads loading event */ type OffLoadCallback = (res: VnmfGeneral.CallbackResult) => void /** Plug -screen advertisement closure event recovery function */ type OnCloseCallback = (res: VnmfGeneral.CallbackResult) => void /** The callback function of the screen error event */ type OnErrorCallback = (result: OnErrorCallbackResult) => void /** The callback function of the screen ads loading event */ type OnLoadCallback = (res: VnmfGeneral.CallbackResult) => void interface OnErrorCallbackResult extends VnmfGeneral.CallbackResult { /** error code * @see /docs/apis/General#aderrcode */ errCode: keyof VnmfGeneral.AdErrCode /** Error message */ errMsg: string } } /** * Incentive video advertising component 。Incentive video advertising component is a native component ,The level is higher than ordinary components 。Incentive video advertisement is a single example (The mini -game side is a global single example ,The applet is a single example in the page ,Single objects on the applet are not allowed to use across pages ),The default is hidden ,Need to call RewardedVideoAd.show() Display it 。 * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.html */ interface RewardedVideoAd { /** Loading incentive video ads 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.load.html */ load(): Promise /** Display incentive video ads 。Incentive video ads will be pushed in from below the screen 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.show.html */ show(): Promise /** Destroy incentive video advertising example 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.destroy.html */ destroy(): void /** Cancel the monitoring user click `Close the advertisement ` Button event * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html */ offClose(callback: RewardedVideoAd.OffCloseCallback): void /** Cancel the incident of listening incentive video errors * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html */ offError(callback: RewardedVideoAd.OffErrorCallback): void /** Cancellation of monitoring incentive video advertising loading events * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html */ offLoad(callback: RewardedVideoAd.OffLoadCallback): void /** Surveillance user click `Close the advertisement ` Button event 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html */ onClose(callback: RewardedVideoAd.OnCloseCallback): void /** * Monitoring incentive video error event 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html */ onError(callback: RewardedVideoAd.OnErrorCallback): void /** Surveying incentive video advertisement loading event 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html */ onLoad(callback: RewardedVideoAd.OnLoadCallback): void } namespace RewardedVideoAd { interface OnErrorCallbackResult extends VnmfGeneral.CallbackResult { /** error code * @see /docs/apis/General#aderrcode */ errCode: keyof VnmfGeneral.AdErrCode /** Error message */ errMsg: string } interface OnCloseCallbackResult { /** Whether the video is closed when the user is completely watched */ isEnded: boolean } /** User clicks `Close the advertisement ` The callback function of the button event */ type OffCloseCallback = (res: VnmfGeneral.CallbackResult) => void /** Incentive Video error event recovery function */ type OffErrorCallback = (res: VnmfGeneral.CallbackResult) => void /** Incentive video advertising loading event recovery function */ type OffLoadCallback = (res: VnmfGeneral.CallbackResult) => void /** User clicks `Close the advertisement ` The callback function of the button event */ type OnCloseCallback = (result: OnCloseCallbackResult) => void /** Incentive Video error event recovery function */ type OnErrorCallback = (result: OnErrorCallbackResult) => void /** Incentive video advertising loading event recovery function */ type OnLoadCallback = (res: VnmfGeneral.CallbackResult) => void } interface VnmfStatic { /** Create an incentive video advertising component 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createRewardedVideoAd.html */ createRewardedVideoAd (option: createRewardedVideoAd.Option): RewardedVideoAd /** Create a screen -screen advertising component 。 * Request getSystemInfoSync Returned SDKVersion Use the basic library version number before using it API。Every time this method is called to create a screen ads, a brand new example will be returned (Intestinal ads on the applet side are not allowed to use across pages )。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html */ createInterstitialAd (option: createInterstitialAd.Option): InterstitialAd } }