@bi-nova/ui-taro 1.3.2 → 1.4.0-beta.202610221551

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { A as AdvertTrackerLike } from '../tracking-gZKFD2A6.mjs';
3
+ import '@bi-nova/core';
2
4
 
3
5
  /**
4
6
  * @Description Taro 广告组件公共类型定义
@@ -137,6 +139,11 @@ interface BiBannerAdFeedbackDetail extends BiBannerAdEventDetail {
137
139
  }
138
140
  /** Banner 广告组件属性 */
139
141
  interface BiBannerAdProps {
142
+ pageId?: string;
143
+ moduleId?: string;
144
+ placementId?: string;
145
+ sdkKey?: string;
146
+ tracker?: AdvertTrackerLike | null;
140
147
  unitId?: string;
141
148
  customAd?: BiBannerCustomAd | null;
142
149
  priority?: DisplayAdPriority;
@@ -178,6 +185,11 @@ interface BiSplashAdEventDetail extends BiBaseAdEventDetail, BiCustomMediaErrorD
178
185
  }
179
186
  /** 开屏广告组件属性 */
180
187
  interface BiSplashAdProps {
188
+ pageId?: string;
189
+ moduleId?: string;
190
+ placementId?: string;
191
+ sdkKey?: string;
192
+ tracker?: AdvertTrackerLike | null;
181
193
  unitId?: string;
182
194
  customAd?: BiSplashCustomAd | null;
183
195
  priority?: DisplayAdPriority;
@@ -247,6 +259,12 @@ interface BiDisplayCustomAd extends BiDisplayCustomAd$1 {
247
259
  */
248
260
  interface BiDisplayAdProps {
249
261
  adId?: string;
262
+ /** 宿主页面稳定 BI 编码;未传时按平台解析当前页面。 */
263
+ pageId?: string;
264
+ /** 页面内展示模块编码;未传时不携带 moduleId。 */
265
+ moduleId?: string;
266
+ /** 运营配置位编码,优先于 adOptions.placementId。 */
267
+ placementId?: string;
250
268
  unitId?: string;
251
269
  type?: BiDisplayAdType | string;
252
270
  customAd?: BiDisplayCustomAd | null;
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { A as AdvertTrackerLike } from '../tracking-gZKFD2A6.js';
3
+ import '@bi-nova/core';
2
4
 
3
5
  /**
4
6
  * @Description Taro 广告组件公共类型定义
@@ -137,6 +139,11 @@ interface BiBannerAdFeedbackDetail extends BiBannerAdEventDetail {
137
139
  }
138
140
  /** Banner 广告组件属性 */
139
141
  interface BiBannerAdProps {
142
+ pageId?: string;
143
+ moduleId?: string;
144
+ placementId?: string;
145
+ sdkKey?: string;
146
+ tracker?: AdvertTrackerLike | null;
140
147
  unitId?: string;
141
148
  customAd?: BiBannerCustomAd | null;
142
149
  priority?: DisplayAdPriority;
@@ -178,6 +185,11 @@ interface BiSplashAdEventDetail extends BiBaseAdEventDetail, BiCustomMediaErrorD
178
185
  }
179
186
  /** 开屏广告组件属性 */
180
187
  interface BiSplashAdProps {
188
+ pageId?: string;
189
+ moduleId?: string;
190
+ placementId?: string;
191
+ sdkKey?: string;
192
+ tracker?: AdvertTrackerLike | null;
181
193
  unitId?: string;
182
194
  customAd?: BiSplashCustomAd | null;
183
195
  priority?: DisplayAdPriority;
@@ -247,6 +259,12 @@ interface BiDisplayCustomAd extends BiDisplayCustomAd$1 {
247
259
  */
248
260
  interface BiDisplayAdProps {
249
261
  adId?: string;
262
+ /** 宿主页面稳定 BI 编码;未传时按平台解析当前页面。 */
263
+ pageId?: string;
264
+ /** 页面内展示模块编码;未传时不携带 moduleId。 */
265
+ moduleId?: string;
266
+ /** 运营配置位编码,优先于 adOptions.placementId。 */
267
+ placementId?: string;
250
268
  unitId?: string;
251
269
  type?: BiDisplayAdType | string;
252
270
  customAd?: BiDisplayCustomAd | null;
package/dist/ad/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var pt=Object.create;var Le=Object.defineProperty,mt=Object.defineProperties,gt=Object.getOwnPropertyDescriptor,ft=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertyNames,Xe=Object.getOwnPropertySymbols,yt=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable;var Ze=(e,n,r)=>n in e?Le(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,h=(e,n)=>{for(var r in n||(n={}))et.call(n,r)&&Ze(e,r,n[r]);if(Xe)for(var r of Xe(n))At.call(n,r)&&Ze(e,r,n[r]);return e},E=(e,n)=>mt(e,ft(n));var Bt=(e,n)=>{for(var r in n)Le(e,r,{get:n[r],enumerable:!0})},tt=(e,n,r,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of ht(n))!et.call(e,d)&&d!==r&&Le(e,d,{get:()=>n[d],enumerable:!(p=gt(n,d))||p.enumerable});return e};var Qe=(e,n,r)=>(r=e!=null?pt(yt(e)):{},tt(n||!e||!e.__esModule?Le(r,"default",{value:e,enumerable:!0}):r,e)),St=e=>tt(Le({},"__esModule",{value:!0}),e);var Rt={};Bt(Rt,{BiBannerAd:()=>je,BiDisplayAd:()=>dt,BiSplashAd:()=>Ge});module.exports=St(Rt);var tr=require("./banner/index.scss"),rr=require("./splash/index.scss");var B=require("react"),ae=require("@tarojs/components"),ct=Qe(require("@tarojs/taro"));var Dt=Qe(require("@tarojs/components")),Oe;function $e(){if(Oe!==void 0)return Oe;try{let e=Dt;Oe=(e==null?void 0:e.AdCustom)||null}catch(e){Oe=null}return Oe}var Ne=Qe(require("@tarojs/taro"));function We(){return typeof wx!="undefined"?wx:null}function Se(e,n){let r=e==null?void 0:e.detail;return r&&typeof r=="object"?h(h({},n),r):e&&typeof e=="object"?h(h({},n),e):h({},n)}function nt(e){return e?e.mediaType==="video"?e.video||"":e.mediaType==="image"?e.image||"":e.video||e.image||"":""}function it(e,n=""){return e&&(e.poster||e.image||n)||""}function at(e,n=""){return e?e.mediaType==="video"?!1:e.mediaType==="image"?!0:e.video?!1:e.image?!0:/\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(String(n).trim()):!0}function ot(e){return String((e==null?void 0:e.fitMode)||"").trim().toLowerCase()==="contain"?"contain":"cover"}function qe(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function st(e,n=5){let r=e==null?void 0:e.jumpSeconds,p=r!=null?r:n;return Math.min(99,Math.max(0,Number(p)||0))}function He(e){var r;let n=(r=e==null?void 0:e.loadTimeout)!=null?r:e==null?void 0:e.timeout;return Math.max(1e3,Number(n)||5e3)}function Ct(e,n=!1){var r,p,d,D;if(!e)return"none";if(n){let M=String(((r=e.action)==null?void 0:r.type)||e.jumpType||"").trim().toLowerCase();if(M==="miniprogram")return"miniProgram";if(M==="internal")return"internal";if(M==="web")return"web";if(M==="api")return"api";if(M==="none")return"none"}return n&&((p=e.action)!=null&&p.appId||e.targetAppId)||e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":n&&((d=e.action)!=null&&d.path||e.targetPath)||e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":n&&((D=e.action)!=null&&D.url||e.jumpUrl)||e.url||e.webUrl||e.h5Url?"web":"none"}function bt(e,n=!1){var r;return e&&((n?((r=e.action)==null?void 0:r.appId)||e.targetAppId:"")||e.appId||e.miniProgramAppId||e.jumpAppId)||""}function wt(e,n=!1){var r;return e&&((n?((r=e.action)==null?void 0:r.path)||e.targetPath:"")||e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function _t(e,n=!1){var p;if(!e)return"full";let r=(n?(p=e.action)==null?void 0:p.miniProgramOpenMode:"")||e.miniProgramOpenMode;return String(r||"").trim().toLowerCase()==="half"?"half":"full"}function vt(e,n=!1){var r;return e&&((n?((r=e.action)==null?void 0:r.url)||e.jumpUrl:"")||e.url||e.webUrl||e.h5Url)||""}function It(e){return e!=null&&e!==""}function rt(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Tt(e,n){let r=e.indexOf("#"),p=r>=0?e.slice(r):"",d=r>=0?e.slice(0,r):e,D=Object.keys(n).map(V=>`${encodeURIComponent(V)}=${encodeURIComponent(String(n[V]))}`).join("&");if(!D)return e;let M=d.includes("?")?/[?&]$/.test(d)?"":"&":"?";return`${d}${M}${D}${p}`}function Pt(e,n){var V;let r=rt(e==null?void 0:e.data)?e.data:null,p=rt(r==null?void 0:r.body)?r.body:null,d=String((p==null?void 0:p.appId)||"").trim(),D=String((p==null?void 0:p.url)||"").trim().replace(/^\/+/,"");if(String((r==null?void 0:r.code)||"")!=="200"||!d||!D){(V=n.onError)==null||V.call(n,E(h({},n.actionDetail),{errCode:n.apiRequestErrorCode||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:String((r==null?void 0:r.message)||"\u5E7F\u544A\u63A5\u53E3\u54CD\u5E94\u5F02\u5E38")}));return}Ue(E(h({},n),{customAd:{action:{type:"miniProgram",appId:d,path:D,miniProgramOpenMode:"half"}},preferStandardFields:!0}))}function Ue(e){let{customAd:n,actionDetail:r,onOpenWebview:p,onError:d,miniProgramErrorCode:D,navigateErrorCode:M,miniProgramUnsupportedErrorCode:V,apiRequestErrorCode:ne,apiRequestParams:$,preferStandardFields:X=!1}=e;if(!n)return;let Q=Ct(n,X),z=bt(n,X),T=wt(n,X),f=vt(n,X);if(Q==="miniProgram"&&z){let g=We(),H=_t(n,X),k=H==="half"?g==null?void 0:g.openEmbeddedMiniProgram:g==null?void 0:g.navigateToMiniProgram;if(!g||typeof k!="function"){d==null||d(E(h({},r),{errCode:V||D,errMsg:H==="half"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u534A\u5C4F\u6253\u5F00\u5176\u4ED6\u5C0F\u7A0B\u5E8F":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}k.call(g,{appId:z,path:T||"",fail:u=>{d==null||d(E(h({},r),{errCode:D,errMsg:(u==null?void 0:u.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(Q==="internal"&&T){Ne.navigateTo({url:T,fail:g=>{d==null||d(E(h({},r),{errCode:M,errMsg:(g==null?void 0:g.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}if(Q==="web"&&f){p==null||p(E(h({},r),{url:f}));return}if(Q==="api"&&f){let g=$||{},k=["configId","equipmentValue","userId"].filter(v=>{let ie=g[v];return v==="userId"?!Number.isInteger(ie)||Number(ie)<=0:!It(ie)});if(k.length){d==null||d(E(h({},r),{errCode:ne||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:`\u63A5\u53E3\u578B\u5E7F\u544A\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570\u6216\u53C2\u6570\u503C\u65E0\u6548\uFF1A${k.join("\u3001")}`}));return}let u=Tt(f,{configId:g.configId,equipmentValue:g.equipmentValue,userId:g.userId});Ne.request({url:u,method:"GET",success:v=>{Pt(v,e)},fail:v=>{d==null||d(E(h({},r),{errCode:ne||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:(v==null?void 0:v.errMsg)||"\u5E7F\u544A\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25"}))}})}}function lt(){var g;let e=We(),n=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},r=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof Ne.getSystemInfoSync=="function"?Ne.getSystemInfoSync():{},p=Number(r.windowHeight||0),d=Number(r.screenHeight||0),D=!!(p&&d&&p===d),M=16,V=16,ne=16,$=32,X=D&&n.top?n.top:Math.max(M,Number(r.statusBarHeight||0)+4),Q=D&&n.height?n.height:$,z=D&&n.top?n.top:M,T=D&&n.height?n.height:$,f=Math.max(ne,Number(((g=r.safeArea)==null?void 0:g.left)||0)+ne);return{isFullScreen:D,skipStyle:{top:`${z}px`,width:"156rpx",height:`${T}px`,lineHeight:`${T}px`,borderRadius:`${Math.round(T/2)}px`,left:D?`${ne}px`:void 0,right:D?void 0:`${V}px`},disclosureStyle:{top:`${z}px`,left:`${f}px`,height:`${T}px`,lineHeight:`${T}px`},combinedControlStyle:{top:`${X}px`,left:`${f}px`,height:`${Q}px`}}}var J=require("react/jsx-runtime"),Et=[{label:"\u4E0E\u6211\u65E0\u5173",value:"irrelevant"},{label:"\u91CD\u590D\u6536\u5230\u591A\u6B21",value:"repeated"},{label:"\u5185\u5BB9\u592A\u5DEE",value:"poorContent"}];function Nt(e,n,r){return e&&n?r==="custom-first"||r==="custom-only"?"custom":"wechat":e?"wechat":n?"custom":null}var je=({unitId:e="",customAd:n,priority:r="wechat-first",adIntervals:p=30,equipmentValue:d="",userId:D=0,className:M,onLoad:V,onError:ne,onClose:$,onAction:X,onFeedback:Q,onOpenWebview:z})=>{let T=(0,B.useMemo)(()=>$e(),[]),f=n||null,g=!!(f!=null&&f.image),H=!!(e&&T),k=Nt(H,g,r),u=JSON.stringify([e,f,r,!!T]),[v,ie]=(0,B.useState)(!!k),[Z,pe]=(0,B.useState)(k),[se,De]=(0,B.useState)(!1),[me,ee]=(0,B.useState)("primary"),O=(0,B.useRef)(k),U=(0,B.useRef)({wechat:!1,custom:!1}),F=(0,B.useRef)(!1),K=(0,B.useRef)(null),I=(0,B.useRef)(V),A=(0,B.useRef)(ne),b=(0,B.useRef)($),ge=(0,B.useRef)(X),x=(0,B.useRef)(Q),Y=(0,B.useRef)(z);(0,B.useEffect)(()=>{I.current=V,A.current=ne,b.current=$,ge.current=X,x.current=Q,Y.current=z},[X,$,ne,Q,V,z]);let R=(0,B.useCallback)(a=>{let s=a==="custom"&&f?{configId:f.configId,placementId:f.placementId,configName:f.configName,advertPlatform:f.advertPlatform}:{};return h({provider:a,type:"banner"},s)},[f]),w=(0,B.useCallback)(()=>{K.current&&(clearTimeout(K.current),K.current=null)},[]),te=(0,B.useCallback)(()=>{De(!1),ee("primary")},[]),fe=(0,B.useCallback)(a=>{w(),O.current=a,F.current=!1,pe(a),ie(!0),te()},[w,te]),he=(0,B.useCallback)((a,s)=>{var G;let y=!!e&&g?"allProvidersFailed":a==="wechat"?"wechatAdLoadFail":"customMediaLoadFail";w(),O.current=null,pe(null),ie(!1),te(),(G=b.current)==null||G.call(b,{provider:a,type:"banner",reason:y,error:s})},[w,te,g,e]),ye=(0,B.useCallback)((a,s,m,y)=>{var _e;if(O.current!=="custom"||U.current.custom)return;w();let G=Se(a,R("custom")),ce=E(h({},G),{errorType:s,errCode:m,errMsg:y,mediaType:"image",rawErrCode:G.errCode,rawErrMsg:G.errMsg});if(U.current.custom=!0,(_e=A.current)==null||_e.call(A,ce),H&&!U.current.wechat){fe("wechat");return}he("custom",ce)},[H,w,R,he,fe]);(0,B.useEffect)(()=>(w(),U.current={wechat:!1,custom:!1},F.current=!1,O.current=k,pe(k),ie(!!k),te(),w),[w,te,u,k]),(0,B.useEffect)(()=>{if(w(),!(!v||Z!=="custom"||!g))return K.current=setTimeout(()=>{F.current||O.current!=="custom"||ye(void 0,"CUSTOM_MEDIA_LOAD_TIMEOUT","BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6")},He(f)),w},[w,ye,g,Z,f,v]),(0,B.useEffect)(()=>{var s,m;if(!e||T)return;let a=E(h({},R("wechat")),{errCode:"BI_BANNER_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"});(s=A.current)==null||s.call(A,a),g||(m=b.current)==null||m.call(b,E(h({},R("wechat")),{reason:"wechatAdLoadFail",error:a}))},[T,R,g,e]);let W=a=>{var s;O.current==="wechat"&&((s=I.current)==null||s.call(I,Se(a,R("wechat"))))},q=a=>{var y;if(O.current!=="wechat"||U.current.wechat)return;let s=a!=null&&a.detail&&typeof a.detail=="object"?a.detail:{},m=E(h({},Se(a,R("wechat"))),{errCode:"BI_BANNER_WECHAT_AD_LOAD_FAIL",errMsg:String(s.errMsg||"\u5FAE\u4FE1 Banner \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:s.errCode,rawErrMsg:s.errMsg});if(U.current.wechat=!0,(y=A.current)==null||y.call(A,m),g&&!U.current.custom){fe("custom");return}he("wechat",m)},le=a=>{var s;O.current==="wechat"&&((s=b.current)==null||s.call(b,Se(a,R("wechat"))))},j=()=>{var a;O.current!=="custom"||F.current||(w(),F.current=!0,(a=I.current)==null||a.call(I,R("custom")))},Ce=()=>{var s;if(se){te();return}let a=R("custom");(s=ge.current)==null||s.call(ge,a),Ue({customAd:f,actionDetail:a,onOpenWebview:m=>{var y;return(y=Y.current)==null?void 0:y.call(Y,m)},onError:m=>{var y;return(y=A.current)==null?void 0:y.call(A,m)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL",apiRequestErrorCode:"BI_BANNER_API_REQUEST_FAIL",apiRequestParams:{configId:f==null?void 0:f.configId,equipmentValue:d,userId:D},preferStandardFields:!0})},Me=a=>{var s;(s=a.stopPropagation)==null||s.call(a),De(m=>!m),ee("primary")},be=a=>{var s;(s=a.stopPropagation)==null||s.call(a)},Be=a=>{var s,m;(s=a.stopPropagation)==null||s.call(a),te(),(m=x.current)==null||m.call(x,E(h({},R("custom")),{provider:"custom",action:"report"})),ct.showToast({title:"\u5DF2\u6536\u5230\u60A8\u7684\u53CD\u9988\uFF0C\u6211\u4EEC\u4F1A\u5C3D\u5FEB\u5904\u7406~",icon:"none",duration:2e3})},Ae=(a,s)=>{var y,G,ce;(y=a.stopPropagation)==null||y.call(a);let m=E(h({},R("custom")),{provider:"custom",action:"dislike",reason:s.value,reasonText:s.label});w(),O.current=null,pe(null),ie(!1),te(),(G=x.current)==null||G.call(x,m),(ce=b.current)==null||ce.call(b,E(h({},R("custom")),{reason:"notInterested",feedbackReason:s.value,feedbackReasonText:s.label}))},we=`bi-banner-ad${M?` ${M}`:""}`;return!v||!Z?null:Z==="wechat"&&T?(0,J.jsx)(T,{className:we,unitId:e,adIntervals:p,onLoad:W,onError:q,onClose:le}):Z!=="custom"||!(f!=null&&f.image)?null:(0,J.jsxs)(ae.View,{className:we,children:[(0,J.jsx)(ae.View,{className:"bi-banner-ad__surface",onClick:Ce,children:(0,J.jsx)(ae.Image,{className:"bi-banner-ad__image",src:f.image,mode:"widthFix",onLoad:j,onError:a=>ye(a,"CUSTOM_MEDIA_LOAD_FAIL","BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")})}),(0,J.jsxs)(ae.View,{className:"bi-banner-ad__badge",onClick:Me,children:[(0,J.jsx)(ae.Text,{children:qe(f)}),(0,J.jsx)(ae.View,{className:"bi-banner-ad__badge-arrow"})]}),se?(0,J.jsx)(ae.View,{className:"bi-banner-ad__feedback-panel",onClick:be,children:me==="primary"?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ae.View,{className:"bi-banner-ad__feedback-source",children:"\u7531\u8D5E\u52A9\u5546\u63D0\u4F9B\u7684\u5185\u5BB9"}),(0,J.jsx)(ae.View,{className:"bi-banner-ad__feedback-item",onClick:a=>{var s;(s=a.stopPropagation)==null||s.call(a),ee("dislike")},children:"\u4E0D\u611F\u5174\u8DA3"}),(0,J.jsx)(ae.View,{className:"bi-banner-ad__feedback-item",onClick:Be,children:"\u53CD\u9988\u95EE\u9898"})]}):Et.map(a=>(0,J.jsx)(ae.View,{className:"bi-banner-ad__feedback-item",onClick:s=>Ae(s,a),children:a.label},a.value))}):null]})};var l=require("react"),S=require("@tarojs/components");var C=require("react/jsx-runtime");function Mt(e,n,r){return e&&n?r==="custom-first"||r==="custom-only"?"custom":"wechat":e?"wechat":n?"custom":null}var Ge=({unitId:e="",customAd:n,priority:r="wechat-first",show:p=!0,zIndex:d=999,pictureInPicture:D=!1,checkNativeSplash:M=!0,jumpSeconds:V=5,equipmentValue:ne="",userId:$=0,className:X,onLoad:Q,onError:z,onClose:T,onAction:f,onHide:g,onOpenWebview:H})=>{let k=(0,l.useMemo)(()=>$e(),[]),u=n||null,v=(0,l.useMemo)(()=>nt(u),[u]),ie=(0,l.useMemo)(()=>it(u,v),[v,u]),Z=(0,l.useMemo)(()=>at(u,v),[v,u]),pe=(0,l.useMemo)(()=>ot(u),[u]),se=(0,l.useMemo)(()=>st(u,V),[V,u]),De=(0,l.useMemo)(()=>qe(u),[u]),me=(0,l.useMemo)(()=>lt(),[]),ee=!!(e&&k),O=!!(v||u!=null&&u.mediaType),U=!!v,F=Mt(ee,O,r),K=JSON.stringify([e,u,r,!!k]),[I,A]=(0,l.useState)(!1),[b,ge]=(0,l.useState)(F),[x,Y]=(0,l.useState)(!1),[R,w]=(0,l.useState)(0),[te,fe]=(0,l.useState)(!1),[he,ye]=(0,l.useState)(!1),W=(0,l.useRef)(F),q=(0,l.useRef)({wechat:!1,custom:!1}),le=(0,l.useRef)(!1),j=(0,l.useRef)(!1),Ce=(0,l.useRef)(!1),Me=(0,l.useRef)({identity:K,show:!1}),be=(0,l.useRef)(0),Be=(0,l.useRef)(null),Ae=(0,l.useRef)(null),we=(0,l.useRef)(null),a=(0,l.useRef)(null),s=(0,l.useRef)(Q),m=(0,l.useRef)(z),y=(0,l.useRef)(T),G=(0,l.useRef)(f),ce=(0,l.useRef)(g),_e=(0,l.useRef)(H);(0,l.useEffect)(()=>{s.current=Q,m.current=z,y.current=T,G.current=f,ce.current=g,_e.current=H},[f,T,z,g,Q,H]),(0,l.useEffect)(()=>{var t;!p||!e||k||(t=m.current)==null||t.call(m,{provider:"wechat",type:"splash",errCode:"BI_SPLASH_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"})},[k,p,e]);let oe=t=>{let c=t==="custom"&&u?{configId:u.configId,placementId:u.placementId,configName:u.configName,advertPlatform:u.advertPlatform}:{};return h({provider:t,type:"splash"},c)},L=(0,l.useCallback)(()=>{Be.current&&clearInterval(Be.current),Ae.current&&clearTimeout(Ae.current),we.current&&clearTimeout(we.current),a.current&&clearTimeout(a.current),Be.current=null,Ae.current=null,we.current=null,a.current=null},[]),ue=(0,l.useCallback)((t,c)=>{L(),W.current=t,le.current=!1,ge(t),A(c),Y(!1),w(se),fe(!1),ye(!1)},[L,se]),Ie=(0,l.useCallback)((t,c)=>{var Re;let Ee=O&&(t==="custom"||ee&&q.current.wechat&&q.current.custom),ke=Ee?"allProvidersFailed":"wechatAdLoadFail";L(),A(!1),Y(!1),w(0),fe(!1),ye(!1),(Re=y.current)==null||Re.call(y,{provider:Ee?"none":t,type:"splash",reason:ke,error:c})},[ee,L,O]),ve=(0,l.useCallback)(()=>{if(!(Be.current||!W.current)){if(fe(!0),se<=0){w(0);return}w(se),Be.current=setInterval(()=>{w(t=>Math.max(0,t-1))},1e3)}},[se]),xe=(0,l.useCallback)(()=>{U&&(Ae.current=setTimeout(()=>{var c;if(le.current||W.current!=="custom")return;let t=E(h({},oe("custom")),{errorType:"CUSTOM_MEDIA_LOAD_TIMEOUT",errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6",mediaType:Z?"image":"video",rawErrCode:void 0,rawErrMsg:void 0});(c=m.current)==null||c.call(m,t),q.current.custom=!0,ee&&!q.current.wechat?(ue("wechat",!0),ve()):Ie("custom",t)},He(u)))},[ee,Ie,U,Z,ue,u,ve]),Te=(0,l.useCallback)(t=>{ue(t,!0),t==="wechat"?ve():U&&xe()},[U,ue,ve,xe]),Pe=(0,l.useCallback)((t,c,P,_)=>{var Re;if(W.current!=="custom"||q.current.custom)return;let Ee=Se(t,oe("custom")),ke=E(h({},Ee),{errorType:c,errCode:P,errMsg:_,mediaType:Z?"image":"video",rawErrCode:Ee.errCode,rawErrMsg:Ee.errMsg});(Re=m.current)==null||Re.call(m,ke),q.current.custom=!0,ee&&!q.current.wechat?Te("wechat"):Ie("custom",ke)},[ee,Ie,Z,Te]),de=(0,l.useCallback)(()=>{var t;if(j.current){A(!1);return}if(!F){ue(null,!1),Ce.current||(Ce.current=!0,(t=y.current)==null||t.call(y,{provider:"none",type:"splash",reason:"noAd"}));return}Te(F),F==="custom"&&!U&&Pe(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")},[Pe,U,F,ue,Te]),Fe=(0,l.useCallback)(()=>{if(!p||j.current)return;if(!M){de();return}let t=We();if(!(t!=null&&t.getShowSplashAdStatus)||be.current>=3){de();return}t.getShowSplashAdStatus({success:c=>{var P;if((c==null?void 0:c.code)===-1){be.current+=1,we.current=setTimeout(Fe,300);return}if((c==null?void 0:c.code)===1){L(),j.current=!0,A(!1),(P=s.current)==null||P.call(s,{provider:"wechat",type:"splash",nativeSplash:!0});return}de()},fail:de})},[de,M,L,p]);(0,l.useEffect)(()=>{let t=Me.current,c=p&&!t.show||t.identity!==K;if(Me.current={identity:K,show:p},!p){j.current=!1,Ce.current=!1,q.current={wechat:!1,custom:!1},ue(F,!1);return}if(!j.current)return c&&(Ce.current=!1),q.current={wechat:!1,custom:!1},j.current=!1,be.current=0,ue(F,!1),Fe(),L},[Fe,L,K,F,ue,p]),(0,l.useEffect)(()=>{var c;if(!te||R!==0||!I||x||!W.current)return;let t=W.current;if(D){L(),ye(!0),a.current=setTimeout(()=>{var P;Y(!0),ye(!1),(P=ce.current)==null||P.call(ce,oe(t))},280);return}L(),A(!1),(c=y.current)==null||c.call(y,oe(t))},[L,te,D,R,x,I]);let Ke=t=>{var c;W.current==="wechat"&&(ve(),(c=s.current)==null||c.call(s,Se(t,oe("wechat"))))},Ye=t=>{var _;if(W.current!=="wechat"||q.current.wechat)return;let c=t!=null&&t.detail&&typeof t.detail=="object"?t.detail:{},P=E(h({},Se(t,oe("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(c.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:c.errCode,rawErrMsg:c.errMsg});(_=m.current)==null||_.call(m,P),q.current.wechat=!0,O&&!q.current.custom?(Te("custom"),U||Pe(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")):Ie("wechat",P)},re=()=>{var t;W.current!=="custom"||le.current||(Ae.current&&clearTimeout(Ae.current),Ae.current=null,le.current=!0,ve(),(t=s.current)==null||t.call(s,oe("custom")))},Je=t=>{var P;(P=t==null?void 0:t.stopPropagation)==null||P.call(t),W.current&&(fe(!0),w(0))},Ve=()=>{var c;if(W.current!=="custom")return;let t=oe("custom");(c=G.current)==null||c.call(G,t),Ue({customAd:u,actionDetail:t,onOpenWebview:P=>{var _;return(_=_e.current)==null?void 0:_.call(_e,P)},onError:P=>{var _;return(_=m.current)==null?void 0:_.call(m,P)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL",apiRequestErrorCode:"BI_SPLASH_API_REQUEST_FAIL",apiRequestParams:{configId:u==null?void 0:u.configId,equipmentValue:ne,userId:$},preferStandardFields:!0})},i=t=>{var c;L(),A(!1),Y(!1),w(0),fe(!1),(c=y.current)==null||c.call(y,t)},o=["bi-splash-ad",x?"bi-splash-ad--pip":"",he?"bi-splash-ad--pip-animating":"",X||""].filter(Boolean).join(" ");return!I||!b?null:(0,C.jsxs)(S.View,{className:o,style:{zIndex:d},children:[b==="wechat"&&k?(0,C.jsx)(S.View,{className:"bi-splash-ad__popup",children:(0,C.jsx)(S.View,{className:`bi-splash-ad__media-wrapper${x?" bi-splash-ad__media-wrapper--pip":""}`,children:(0,C.jsx)(k,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:Ke,onError:Ye,onClose:t=>i(Se(t,oe("wechat")))})})}):b==="custom"&&U?(0,C.jsx)(S.View,{className:"bi-splash-ad__popup bi-splash-ad__custom",children:(0,C.jsxs)(S.View,{className:"bi-splash-ad__media-shell",onClick:Ve,children:[Z?(0,C.jsx)(S.Image,{className:"bi-splash-ad__media",src:v,mode:pe==="cover"?"aspectFill":"aspectFit",onLoad:re,onError:t=>Pe(t,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}):(0,C.jsx)(S.Video,{className:"bi-splash-ad__video",src:v,poster:ie,autoplay:!0,muted:(u==null?void 0:u.muted)!==!1,loop:!0,objectFit:pe,showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:re,onError:t=>Pe(t,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}),x?(0,C.jsx)(S.View,{className:"bi-splash-ad__pip-mask"}):null,!x&&!me.isFullScreen?(0,C.jsxs)(S.View,{className:"bi-splash-ad__disclosure",style:me.disclosureStyle,children:[(0,C.jsx)(S.Text,{children:De}),(0,C.jsx)(S.View,{className:"bi-splash-ad__disclosure-arrow"})]}):null,!x&&(u!=null&&u.bottomImage)?(0,C.jsx)(S.Image,{className:"bi-splash-ad__bottom-image",src:u.bottomImage,mode:"widthFix"}):null]})}):null,x?(0,C.jsx)(S.View,{className:"bi-splash-ad__pip-close",onClick:()=>i(oe(b)),children:(0,C.jsx)(S.View,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,!x&&me.isFullScreen&&b==="custom"?(0,C.jsxs)(S.View,{className:"bi-splash-ad__combined-control",style:me.combinedControlStyle,children:[(0,C.jsxs)(S.View,{className:"bi-splash-ad__combined-capsule",children:[(0,C.jsxs)(S.View,{className:"bi-splash-ad__combined-disclosure",children:[(0,C.jsx)(S.Text,{children:De}),(0,C.jsx)(S.View,{className:"bi-splash-ad__disclosure-arrow"})]}),(0,C.jsx)(S.View,{className:"bi-splash-ad__combined-divider"}),(0,C.jsx)(S.View,{className:"bi-splash-ad__combined-skip",onClick:Je,children:"\u8DF3\u8FC7"})]}),(0,C.jsxs)(S.Text,{className:"bi-splash-ad__combined-countdown",children:[R," \u79D2"]})]}):x?null:(0,C.jsxs)(S.View,{className:"bi-splash-ad__skip",style:me.skipStyle,onClick:Je,children:[(0,C.jsxs)(S.Text,{children:[R,"s"]}),(0,C.jsx)(S.View,{className:"bi-splash-ad__skip-divider"}),(0,C.jsx)(S.Text,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};var N=require("react");var ze=require("react/jsx-runtime"),kt="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",xt=300*1e3,ut=["banner","splash"],dt=({adId:e="",unitId:n,type:r="banner",customAd:p,priority:d="wechat-first",adOptions:D=null,sdkKey:M="biNova",autoLoad:V=!0,adIntervals:ne=30,show:$=!0,zIndex:X=999,pictureInPicture:Q=!1,checkNativeSplash:z=!0,nativeSplashCache:T=!0,jumpSeconds:f=5,equipmentValue:g="",userId:H=0,className:k,onLoad:u,onError:v,onClose:ie,onAction:Z,onFeedback:pe,onHide:se,onOpenWebview:De,onConfigLoad:me,onConfigError:ee})=>{var Ve;let O=(0,N.useRef)(0),U=(0,N.useRef)(""),F=(0,N.useRef)(null),K=(0,N.useRef)(u),I=(0,N.useRef)(v),A=(0,N.useRef)(ie),b=(0,N.useRef)(Z),ge=(0,N.useRef)(pe),x=(0,N.useRef)(se),Y=(0,N.useRef)(De),R=(0,N.useRef)(me),w=(0,N.useRef)(ee),te=(0,N.useRef)($),[fe,he]=(0,N.useState)(!1),[ye,W]=(0,N.useState)(!1),[q,le]=(0,N.useState)(null);(0,N.useEffect)(()=>{K.current=u,I.current=v,A.current=ie,b.current=Z,ge.current=pe,x.current=se,Y.current=De,R.current=me,w.current=ee,te.current=$},[Z,ie,ee,me,v,pe,se,u,De,$]);let j=(0,N.useMemo)(()=>ut.includes(r)?r:"banner",[r]),Ce=()=>!!(V&&e),Me=()=>{var c;let i=globalThis.getApp,o=typeof i=="function"?i():null;if(!o)return null;let t=o;return t[M]||((c=t.globalData)==null?void 0:c[M])||null},be=()=>{var i;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let o=wx.getAccountInfoSync();return((i=o==null?void 0:o.miniProgram)==null?void 0:i.appId)||""}}catch(o){return""}return""},Be=(i,o)=>`${kt}_${o||"unknown"}_${i||"empty"}`,Ae=(i,o)=>{if(!T||!i||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let t=Be(i,o),c=Number(wx.getStorageSync(t)||0),P=Date.now()-c;return c>0&&P>=0&&P<=xt}catch(t){return!1}},we=()=>{if(T&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let i=Be(e,be());wx.setStorageSync(i,Date.now())}catch(i){}},a=()=>{O.current+=1,U.current="",he(!1),W(!1),le(null)},s=()=>{let i=D&&typeof D=="object"?D:{},o=be(),t=E(h({},i),{adId:e,placementId:i.placementId||e,appId:i.appId||o,type:j});return Number.isInteger(H)&&H>0?t.userId=H:delete t.userId,t},m=i=>{try{return JSON.stringify(i||{})}catch(o){return`${String(i.appId||"")}_${String(i.placementId||"")}`}},y=i=>{let o=(i==null?void 0:i.unitId)||"",t=(i==null?void 0:i.customAd)||(i==null?void 0:i.custom)||null,c=typeof(i==null?void 0:i.show)=="boolean"?i.show:!!(o||t);return{unitId:o,customAd:t,priority:(i==null?void 0:i.priority)||"wechat-first",show:c}},G=i=>{var o,t;(o=w.current)==null||o.call(w,i),(t=I.current)==null||t.call(I,i)},ce=i=>{var o;(o=A.current)==null||o.call(A,{type:j,adId:e||i.adId||"",provider:"none",reason:"noAd"})},_e=async()=>{var P;if(!Ce())return;let i=s(),o=m(i);if(U.current===o&&(fe||ye))return;let t=Me();if(!(t!=null&&t.ads)||typeof t.ads.getDisplayAdConfig!="function"){a(),G({type:j,adId:e,errCode:"DISPLAY_AD_SDK_NOT_READY",errMsg:"\u672A\u83B7\u53D6\u5230\u53EF\u7528\u7684\u5E7F\u544A\u670D\u52A1 SDK\uFF0C\u8BF7\u5148\u6CE8\u5165\u5168\u5C40 biNova \u5B9E\u4F8B"});return}let c=O.current+1;O.current=c,U.current=o,he(!0),W(!1),le(null);try{let _=await t.ads.getDisplayAdConfig(i);if(c!==O.current)return;if(!_||_.code!==0||!_.data){he(!1),W(!0),le(null),G({type:j,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(_==null?void 0:_.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:_||null});return}let Ee=y(_.data),ke=!!(te.current&&!Ee.show);he(!1),W(!0),le(_.data),(P=R.current)==null||P.call(R,{type:j,adId:e,requestOptions:i,data:_.data}),ke&&ce(_.data)}catch(_){if(c!==O.current)return;he(!1),W(!0),le(null),G({type:j,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:_ instanceof Error?_.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:_})}};(0,N.useEffect)(()=>{var i;ut.includes(r)||(i=I.current)==null||i.call(I,{type:"banner",errCode:"UNSUPPORTED_DISPLAY_AD_TYPE",errMsg:`\u4E0D\u652F\u6301\u7684\u5C55\u793A\u5E7F\u544A\u7C7B\u578B\uFF1A${r}\uFF0C\u8BF7\u4F7F\u7528 "banner" \u6216 "splash"`})},[r]),(0,N.useEffect)(()=>{if(!e){a();return}_e()},[e,D,V,j,M,H]);let oe=Ce(),L=oe?y(q):null,ue=L?L.unitId:n||"",Ie=L?L.customAd:p||null,ve=L?L.priority:d,xe=!!($&&(!oe||!e||ye&&(L!=null&&L.show))),Te=be(),Pe=JSON.stringify([j,Te,e,z,T]),de=F.current;!!(!de||de.identity!==Pe||!de.show&&$)?F.current={identity:Pe,show:$,shouldCheck:!!(z&&!Ae(e,Te))}:de&&de.show!==$&&(F.current=E(h({},de),{show:$}));let Ke=!!((Ve=F.current)!=null&&Ve.shouldCheck),Ye=e||(q==null?void 0:q.adId)||"",re=i=>h({adId:Ye},i);return j==="splash"?(0,ze.jsx)(Ge,h({},{unitId:ue,customAd:Ie,priority:ve,show:xe,zIndex:X,pictureInPicture:Q,checkNativeSplash:Ke,jumpSeconds:f,equipmentValue:g,userId:H,className:k,onLoad:o=>{var t;o&&typeof o=="object"&&o.nativeSplash===!0&&we(),(t=K.current)==null||t.call(K,re(o))},onError:o=>{var t;(t=I.current)==null||t.call(I,re(o))},onClose:o=>{var t;(t=A.current)==null||t.call(A,re(o))},onAction:o=>{var t;(t=b.current)==null||t.call(b,re(o))},onHide:o=>{var t;(t=x.current)==null||t.call(x,re(o))},onOpenWebview:o=>{var t;(t=Y.current)==null||t.call(Y,re(o))}})):xe?(0,ze.jsx)(je,h({},{unitId:ue,customAd:Ie,priority:ve,adIntervals:ne,equipmentValue:g,userId:H,className:k,onLoad:i=>{var o;(o=K.current)==null||o.call(K,re(i))},onError:i=>{var o;(o=I.current)==null||o.call(I,re(i))},onClose:i=>{var o;(o=A.current)==null||o.call(A,re(i))},onAction:i=>{var o;(o=b.current)==null||o.call(b,re(i))},onFeedback:i=>{var o;(o=ge.current)==null||o.call(ge,re(i))},onOpenWebview:i=>{var o;(o=Y.current)==null||o.call(Y,re(i))}})):null};0&&(module.exports={BiBannerAd,BiDisplayAd,BiSplashAd});
1
+ "use strict";var br=Object.create;var Qe=Object.defineProperty,Cr=Object.defineProperties,Ir=Object.getOwnPropertyDescriptor,kr=Object.getOwnPropertyDescriptors,Er=Object.getOwnPropertyNames,lr=Object.getOwnPropertySymbols,Pr=Object.getPrototypeOf,dr=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable;var ur=(e,t,n)=>t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))dr.call(t,n)&&ur(e,n,t[n]);if(lr)for(var n of lr(t))Mr.call(t,n)&&ur(e,n,t[n]);return e},_=(e,t)=>Cr(e,kr(t));var Nr=(e,t)=>{for(var n in t)Qe(e,n,{get:t[n],enumerable:!0})},pr=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of Er(t))!dr.call(e,m)&&m!==n&&Qe(e,m,{get:()=>t[m],enumerable:!(u=Ir(t,m))||u.enumerable});return e};var qe=(e,t,n)=>(n=e!=null?br(Pr(e)):{},pr(t||!e||!e.__esModule?Qe(n,"default",{value:e,enumerable:!0}):n,e)),xr=e=>pr(Qe({},"__esModule",{value:!0}),e);var zr={};Nr(zr,{BiBannerAd:()=>ir,BiDisplayAd:()=>Dr,BiSplashAd:()=>ar});module.exports=xr(zr);var Ze=require("@bi-nova/core");typeof process!="undefined"&&process.env.TARO_ENV==="weapp"?(0,Ze.setQtResolver)("wechat",async function(){let{QT:t}=await import("@leyaoyao/qt-hook-wechat");return new t}):typeof process!="undefined"&&process.env.TARO_ENV==="alipay"?(0,Ze.setQtResolver)("alipay",async function(){let{QT:t}=await import("@leyaoyao/qt-hook-alipay");return new t}):typeof process!="undefined"&&process.env.TARO_ENV==="h5"&&(0,Ze.setQtResolver)("h5",async function(){let{QT:t}=await import("@leyaoyao/qt-hook-h5");return new t});var Bt=require("./banner/index.scss"),wt=require("./splash/index.scss");var y=require("react"),ye=require("@tarojs/components"),Sr=qe(require("@tarojs/taro"));var Rr=qe(require("@tarojs/components")),Ge;function er(){if(Ge!==void 0)return Ge;try{let e=Rr;Ge=(e==null?void 0:e.AdCustom)||null}catch(e){Ge=null}return Ge}var Ve=qe(require("@tarojs/taro"));function rr(){return typeof wx!="undefined"?wx:null}function Ne(e,t){let n=e==null?void 0:e.detail;return n&&typeof n=="object"?d(d({},t),n):e&&typeof e=="object"?d(d({},t),e):d({},t)}function gr(e){return e?e.mediaType==="video"?e.video||"":e.mediaType==="image"?e.image||"":e.video||e.image||"":""}function fr(e,t=""){return e&&(e.poster||e.image||t)||""}function yr(e,t=""){return e?e.mediaType==="video"?!1:e.mediaType==="image"?!0:e.video?!1:e.image?!0:/\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(String(t).trim()):!0}function hr(e){return String((e==null?void 0:e.fitMode)||"").trim().toLowerCase()==="contain"?"contain":"cover"}function tr(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function _r(e,t=5){let n=e==null?void 0:e.jumpSeconds,u=n!=null?n:t;return Math.min(99,Math.max(0,Number(u)||0))}function nr(e){var n;let t=(n=e==null?void 0:e.loadTimeout)!=null?n:e==null?void 0:e.timeout;return Math.max(1e3,Number(t)||5e3)}function Lr(e,t=!1){var n,u,m,s;if(!e)return"none";if(t){let N=String(((n=e.action)==null?void 0:n.type)||e.jumpType||"").trim().toLowerCase();if(N==="miniprogram")return"miniProgram";if(N==="internal")return"internal";if(N==="web")return"web";if(N==="api")return"api";if(N==="none")return"none"}return t&&((u=e.action)!=null&&u.appId||e.targetAppId)||e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":t&&((m=e.action)!=null&&m.path||e.targetPath)||e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":t&&((s=e.action)!=null&&s.url||e.jumpUrl)||e.url||e.webUrl||e.h5Url?"web":"none"}function Or(e,t=!1){var n;return e&&((t?((n=e.action)==null?void 0:n.appId)||e.targetAppId:"")||e.appId||e.miniProgramAppId||e.jumpAppId)||""}function Ur(e,t=!1){var n;return e&&((t?((n=e.action)==null?void 0:n.path)||e.targetPath:"")||e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function Fr(e,t=!1){var u;if(!e)return"full";let n=(t?(u=e.action)==null?void 0:u.miniProgramOpenMode:"")||e.miniProgramOpenMode;return String(n||"").trim().toLowerCase()==="half"?"half":"full"}function Vr(e,t=!1){var n;return e&&((t?((n=e.action)==null?void 0:n.url)||e.jumpUrl:"")||e.url||e.webUrl||e.h5Url)||""}function $r(e){return e!=null&&e!==""}function mr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function qr(e,t){let n=e.indexOf("#"),u=n>=0?e.slice(n):"",m=n>=0?e.slice(0,n):e,s=Object.keys(t).map(Q=>`${encodeURIComponent(Q)}=${encodeURIComponent(String(t[Q]))}`).join("&");if(!s)return e;let N=m.includes("?")?/[?&]$/.test(m)?"":"&":"?";return`${m}${N}${s}${u}`}function Hr(e,t){var Q;let n=mr(e==null?void 0:e.data)?e.data:null,u=mr(n==null?void 0:n.body)?n.body:null,m=String((u==null?void 0:u.appId)||"").trim(),s=String((u==null?void 0:u.url)||"").trim().replace(/^\/+/,"");if(String((n==null?void 0:n.code)||"")!=="200"||!m||!s){(Q=t.onError)==null||Q.call(t,_(d({},t.actionDetail),{errCode:t.apiRequestErrorCode||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:String((n==null?void 0:n.message)||"\u5E7F\u544A\u63A5\u53E3\u54CD\u5E94\u5F02\u5E38")}));return}Je(_(d({},t),{customAd:{action:{type:"miniProgram",appId:m,path:s,miniProgramOpenMode:"half"}},preferStandardFields:!0}))}function Je(e){let{customAd:t,actionDetail:n,onExternalLaunch:u,onOpenWebview:m,onError:s,miniProgramErrorCode:N,navigateErrorCode:Q,miniProgramUnsupportedErrorCode:T,apiRequestErrorCode:G,apiRequestParams:be,preferStandardFields:oe=!1}=e;if(!t)return;let x=Lr(t,oe),ee=Or(t,oe),ue=Ur(t,oe),re=Vr(t,oe);if(x==="miniProgram"&&ee){let S=rr(),he=Fr(t,oe),W=he==="half"?S==null?void 0:S.openEmbeddedMiniProgram:S==null?void 0:S.navigateToMiniProgram;if(!S||typeof W!="function"){s==null||s(_(d({},n),{errCode:T||N,errMsg:he==="half"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u534A\u5C4F\u6253\u5F00\u5176\u4ED6\u5C0F\u7A0B\u5E8F":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}u==null||u(_(d({},n),{launchType:"mini_program",status:"triggered"})),W.call(S,{appId:ee,path:ue||"",fail:g=>{s==null||s(_(d({},n),{errCode:N,errMsg:(g==null?void 0:g.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(x==="internal"&&ue){Ve.navigateTo({url:ue,fail:S=>{s==null||s(_(d({},n),{errCode:Q,errMsg:(S==null?void 0:S.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}if(x==="web"&&re){m==null||m(_(d({},n),{url:re}));return}if(x==="api"&&re){let S=be||{},W=["configId","equipmentValue","userId"].filter(E=>{let ie=S[E];return E==="userId"?!Number.isInteger(ie)||Number(ie)<=0:!$r(ie)});if(W.length){s==null||s(_(d({},n),{errCode:G||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:`\u63A5\u53E3\u578B\u5E7F\u544A\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570\u6216\u53C2\u6570\u503C\u65E0\u6548\uFF1A${W.join("\u3001")}`}));return}let g=qr(re,{configId:S.configId,equipmentValue:S.equipmentValue,userId:S.userId});Ve.request({url:g,method:"GET",success:E=>{Hr(E,e)},fail:E=>{s==null||s(_(d({},n),{errCode:G||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:(E==null?void 0:E.errMsg)||"\u5E7F\u544A\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25"}))}})}}function vr(){var re;let e=rr(),t=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},n=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof Ve.getSystemInfoSync=="function"?Ve.getSystemInfoSync():{},u=Number(n.windowHeight||0),m=Number(n.screenHeight||0),s=!!(u&&m&&u===m),N=16,Q=16,T=16,G=32,be=s&&t.top?t.top:Math.max(N,Number(n.statusBarHeight||0)+4),oe=s&&t.height?t.height:G,x=s&&t.top?t.top:N,ee=s&&t.height?t.height:G,ue=Math.max(T,Number(((re=n.safeArea)==null?void 0:re.left)||0)+T);return{isFullScreen:s,skipStyle:{top:`${x}px`,width:"156rpx",height:`${ee}px`,lineHeight:`${ee}px`,borderRadius:`${Math.round(ee/2)}px`,left:s?`${T}px`:void 0,right:s?void 0:`${Q}px`},disclosureStyle:{top:`${x}px`,left:`${ue}px`,height:`${ee}px`,lineHeight:`${ee}px`},combinedControlStyle:{top:`${be}px`,left:`${ue}px`,height:`${oe}px`}}}var Ar=require("@bi-nova/core");function Wr(e="biNova"){var s;let t=globalThis.getApp,u=typeof t=="function"?t():null,m=(u==null?void 0:u[e])||((s=u==null?void 0:u.globalData)==null?void 0:s[e]);return(m==null?void 0:m.tracking)||(0,Ar.getRegisteredAdvertTracker)()}function or(e){let t=e.tracker||Wr(e.sdkKey);if(!t)return!1;let n=t.resolvePage(e.pageId),u=_(d({key:e.key,featureId:e.featureId||"advert_product_slot"},e.moduleId?{moduleId:e.moduleId}:{}),{pageId:n.pageId,pageIdSource:n.pageIdSource,pageUrl:n.pageUrl,attr:d(_(d({},e.attr||{}),{displayId:e.displayId}),e.placementId?{placementId:e.placementId}:{})});return t.track(u),!0}var Z=require("react/jsx-runtime"),jr=[{label:"\u4E0E\u6211\u65E0\u5173",value:"irrelevant"},{label:"\u91CD\u590D\u6536\u5230\u591A\u6B21",value:"repeated"},{label:"\u5185\u5BB9\u592A\u5DEE",value:"poorContent"}];function Qr(e,t,n){return e&&t?n==="custom-first"||n==="custom-only"?"custom":"wechat":e?"wechat":t?"custom":null}var ir=({pageId:e,moduleId:t,placementId:n,sdkKey:u="biNova",tracker:m,unitId:s="",customAd:N,priority:Q="wechat-first",adIntervals:T=30,equipmentValue:G="",userId:be=0,className:oe,onLoad:x,onError:ee,onClose:ue,onAction:re,onFeedback:S,onOpenWebview:he})=>{let W=(0,y.useMemo)(()=>er(),[]),g=N||null,E=!!(g!=null&&g.image),ie=!!(s&&W),J=Qr(ie,E,Q),p=JSON.stringify([s,g,Q,!!W]),[te,ke]=(0,y.useState)(!!J),[ae,Ce]=(0,y.useState)(J),[we,xe]=(0,y.useState)(!1),[_e,se]=(0,y.useState)("primary"),F=(0,y.useRef)(J),P=(0,y.useRef)({wechat:!1,custom:!1}),B=(0,y.useRef)(!1),V=(0,y.useRef)(null),j=(0,y.useRef)(x),k=(0,y.useRef)(ee),M=(0,y.useRef)(ue),de=(0,y.useRef)(re),R=(0,y.useRef)(S),pe=(0,y.useRef)(he),Ee=(0,y.useRef)(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),ce=(0,y.useRef)(new Set),b=(0,y.useCallback)((i,c={},f=!1)=>{if(f&&ce.current.has(i))return;let I=or({key:i,pageId:e,moduleId:t,placementId:n,sdkKey:u,tracker:m,displayId:Ee.current,attr:c});f&&I&&ce.current.add(i)},[t,e,n,u,m]);(0,y.useEffect)(()=>{j.current=x,k.current=ee,M.current=ue,de.current=re,R.current=S,pe.current=he},[re,ue,ee,S,x,he]),(0,y.useEffect)(()=>{Ee.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,ce.current.clear()},[p]);let L=(0,y.useCallback)(i=>{let c=i==="custom"&&g?{configId:g.configId,placementId:g.placementId,configName:g.configName,advertPlatform:g.advertPlatform}:{};return d({provider:i,type:"banner"},c)},[g]),Y=(0,y.useCallback)(()=>{V.current&&(clearTimeout(V.current),V.current=null)},[]),q=(0,y.useCallback)(()=>{xe(!1),se("primary")},[]),H=(0,y.useCallback)(i=>{let c=F.current;c&&c!==i&&b("advert_slot_fallback",{fallbackType:"channel",fromChannel:c,toChannel:i,resultCode:"provider_load_fail"}),Y(),F.current=i,B.current=!1,Ce(i),ke(!0),q()},[Y,q,b]),O=(0,y.useCallback)((i,c)=>{var X;let I=!!s&&E?"allProvidersFailed":i==="wechat"?"wechatAdLoadFail":"customMediaLoadFail";Y(),F.current=null,Ce(null),ke(!1),q(),b("advert_slot_close",{closeType:I,provider:i},!0),(X=M.current)==null||X.call(M,{provider:i,type:"banner",reason:I,error:c})},[Y,q,E,b,s]),ve=(0,y.useCallback)((i,c,f,I)=>{var h;if(F.current!=="custom"||P.current.custom)return;Y();let X=Ne(i,L("custom")),Ae=_(d({},X),{errorType:c,errCode:f,errMsg:I,mediaType:"image",rawErrCode:X.errCode,rawErrMsg:X.errMsg});if(P.current.custom=!0,b("advert_slot_error",{errorLayer:"render",errorType:Ae.errCode,provider:"custom"}),(h=k.current)==null||h.call(k,Ae),ie&&!P.current.wechat){H("wechat");return}O("custom",Ae)},[ie,Y,L,O,H]);(0,y.useEffect)(()=>(Y(),P.current={wechat:!1,custom:!1},B.current=!1,F.current=J,Ce(J),ke(!!J),q(),Y),[Y,q,p,J]),(0,y.useEffect)(()=>{if(Y(),!(!te||ae!=="custom"||!E))return V.current=setTimeout(()=>{B.current||F.current!=="custom"||ve(void 0,"CUSTOM_MEDIA_LOAD_TIMEOUT","BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6")},nr(g)),Y},[Y,ve,E,ae,g,te]),(0,y.useEffect)(()=>{var c,f;if(!s||W)return;let i=_(d({},L("wechat")),{errCode:"BI_BANNER_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"});b("advert_slot_error",{errorLayer:"render",errorType:i.errCode,provider:"wechat"}),(c=k.current)==null||c.call(k,i),E||(b("advert_slot_close",{closeType:"wechatAdLoadFail",provider:"wechat"},!0),(f=M.current)==null||f.call(M,_(d({},L("wechat")),{reason:"wechatAdLoadFail",error:i})))},[W,L,E,b,s]);let me=i=>{var c;F.current==="wechat"&&(b("advert_slot_render",{displayMode:"banner",provider:"wechat"},!0),b("advert_slot_exposure",{displayMode:"banner",provider:"wechat",exposureMethod:"onLoad"},!0),(c=j.current)==null||c.call(j,Ne(i,L("wechat"))))},K=i=>{var I;if(F.current!=="wechat"||P.current.wechat)return;let c=i!=null&&i.detail&&typeof i.detail=="object"?i.detail:{},f=_(d({},Ne(i,L("wechat"))),{errCode:"BI_BANNER_WECHAT_AD_LOAD_FAIL",errMsg:String(c.errMsg||"\u5FAE\u4FE1 Banner \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:c.errCode,rawErrMsg:c.errMsg});if(b("advert_slot_error",{errorLayer:"render",errorType:f.errCode,provider:"wechat"}),P.current.wechat=!0,(I=k.current)==null||I.call(k,f),E&&!P.current.custom){H("custom");return}O("wechat",f)},Oe=i=>{var c;F.current==="wechat"&&(b("advert_slot_close",{closeType:"close",provider:"wechat"},!0),(c=M.current)==null||c.call(M,Ne(i,L("wechat"))))},De=()=>{var i;F.current!=="custom"||B.current||(Y(),B.current=!0,b("advert_slot_render",{displayMode:"banner",provider:"custom"},!0),b("advert_slot_exposure",{displayMode:"banner",provider:"custom",exposureMethod:"onLoad"},!0),(i=j.current)==null||i.call(j,L("custom")))},Pe=()=>{var c;if(we){q();return}let i=L("custom");b("product_ui_action",{actionType:"primary_click",provider:"custom"}),(c=de.current)==null||c.call(de,i),Je({customAd:g,actionDetail:i,onExternalLaunch:f=>{b("product_external_launch",{launchType:f.launchType,status:f.status,provider:"custom"})},onOpenWebview:f=>{var I;b("product_external_launch",{launchType:"h5",status:"triggered",provider:"custom"}),(I=pe.current)==null||I.call(pe,f)},onError:f=>{var I;b("advert_slot_error",{errorLayer:"action",errorType:f.errCode,provider:"custom"}),(I=k.current)==null||I.call(k,f)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL",apiRequestErrorCode:"BI_BANNER_API_REQUEST_FAIL",apiRequestParams:{configId:g==null?void 0:g.configId,equipmentValue:G,userId:be},preferStandardFields:!0})},ge=i=>{var c;(c=i.stopPropagation)==null||c.call(i),xe(f=>!f),se("primary")},Me=i=>{var c;(c=i.stopPropagation)==null||c.call(i)},Re=i=>{var c,f;(c=i.stopPropagation)==null||c.call(i),q(),(f=R.current)==null||f.call(R,_(d({},L("custom")),{provider:"custom",action:"report"})),b("product_feedback",{actionType:"report",provider:"custom"}),Sr.showToast({title:"\u5DF2\u6536\u5230\u60A8\u7684\u53CD\u9988\uFF0C\u6211\u4EEC\u4F1A\u5C3D\u5FEB\u5904\u7406~",icon:"none",duration:2e3})},fe=(i,c)=>{var I,X,Ae;(I=i.stopPropagation)==null||I.call(i);let f=_(d({},L("custom")),{provider:"custom",action:"dislike",reason:c.value,reasonText:c.label});Y(),F.current=null,Ce(null),ke(!1),q(),(X=R.current)==null||X.call(R,f),b("product_feedback",{actionType:"dislike",reason:c.value,provider:"custom"}),b("advert_slot_close",{closeType:"notInterested",provider:"custom"},!0),(Ae=M.current)==null||Ae.call(M,_(d({},L("custom")),{reason:"notInterested",feedbackReason:c.value,feedbackReasonText:c.label}))},$=`bi-banner-ad${oe?` ${oe}`:""}`;return!te||!ae?null:ae==="wechat"&&W?(0,Z.jsx)(W,{className:$,unitId:s,adIntervals:T,onLoad:me,onError:K,onClose:Oe}):ae!=="custom"||!(g!=null&&g.image)?null:(0,Z.jsxs)(ye.View,{className:$,children:[(0,Z.jsx)(ye.View,{className:"bi-banner-ad__surface",onClick:Pe,children:(0,Z.jsx)(ye.Image,{className:"bi-banner-ad__image",src:g.image,mode:"widthFix",onLoad:De,onError:i=>ve(i,"CUSTOM_MEDIA_LOAD_FAIL","BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")})}),(0,Z.jsxs)(ye.View,{className:"bi-banner-ad__badge",onClick:ge,children:[(0,Z.jsx)(ye.Text,{children:tr(g)}),(0,Z.jsx)(ye.View,{className:"bi-banner-ad__badge-arrow"})]}),we?(0,Z.jsx)(ye.View,{className:"bi-banner-ad__feedback-panel",onClick:Me,children:_e==="primary"?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ye.View,{className:"bi-banner-ad__feedback-source",children:"\u7531\u8D5E\u52A9\u5546\u63D0\u4F9B\u7684\u5185\u5BB9"}),(0,Z.jsx)(ye.View,{className:"bi-banner-ad__feedback-item",onClick:i=>{var c;(c=i.stopPropagation)==null||c.call(i),se("dislike")},children:"\u4E0D\u611F\u5174\u8DA3"}),(0,Z.jsx)(ye.View,{className:"bi-banner-ad__feedback-item",onClick:Re,children:"\u53CD\u9988\u95EE\u9898"})]}):jr.map(i=>(0,Z.jsx)(ye.View,{className:"bi-banner-ad__feedback-item",onClick:c=>fe(c,i),children:i.label},i.value))}):null]})};var l=require("react"),A=require("@tarojs/components");var D=require("react/jsx-runtime");function Gr(e,t,n){return e&&t?n==="custom-first"||n==="custom-only"?"custom":"wechat":e?"wechat":t?"custom":null}var ar=({pageId:e,moduleId:t,placementId:n,sdkKey:u="biNova",tracker:m,unitId:s="",customAd:N,priority:Q="wechat-first",show:T=!0,zIndex:G=999,pictureInPicture:be=!1,checkNativeSplash:oe=!0,jumpSeconds:x=5,equipmentValue:ee="",userId:ue=0,className:re,onLoad:S,onError:he,onClose:W,onAction:g,onHide:E,onOpenWebview:ie})=>{let J=(0,l.useMemo)(()=>er(),[]),p=N||null,te=(0,l.useMemo)(()=>gr(p),[p]),ke=(0,l.useMemo)(()=>fr(p,te),[te,p]),ae=(0,l.useMemo)(()=>yr(p,te),[te,p]),Ce=(0,l.useMemo)(()=>hr(p),[p]),we=(0,l.useMemo)(()=>_r(p,x),[x,p]),xe=(0,l.useMemo)(()=>tr(p),[p]),_e=(0,l.useMemo)(()=>vr(),[]),se=!!(s&&J),F=!!(te||p!=null&&p.mediaType),P=!!te,B=Gr(se,F,Q),V=JSON.stringify([s,p,Q,!!J]),[j,k]=(0,l.useState)(!1),[M,de]=(0,l.useState)(B),[R,pe]=(0,l.useState)(!1),[Ee,ce]=(0,l.useState)(0),[b,L]=(0,l.useState)(!1),[Y,q]=(0,l.useState)(!1),H=(0,l.useRef)(B),O=(0,l.useRef)({wechat:!1,custom:!1}),ve=(0,l.useRef)(!1),me=(0,l.useRef)(!1),K=(0,l.useRef)(!1),Oe=(0,l.useRef)({identity:V,show:!1}),De=(0,l.useRef)(0),Pe=(0,l.useRef)(null),ge=(0,l.useRef)(null),Me=(0,l.useRef)(null),Re=(0,l.useRef)(null),fe=(0,l.useRef)(S),$=(0,l.useRef)(he),i=(0,l.useRef)(W),c=(0,l.useRef)(g),f=(0,l.useRef)(E),I=(0,l.useRef)(ie),X=(0,l.useRef)(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),Ae=(0,l.useRef)(new Set),h=(0,l.useCallback)((r,o={},a=!1)=>{if(a&&Ae.current.has(r))return;let w=or({key:r,pageId:e,moduleId:t,placementId:n,sdkKey:u,tracker:m,displayId:X.current,attr:o});a&&w&&Ae.current.add(r)},[t,e,n,u,m]);(0,l.useEffect)(()=>{fe.current=S,$.current=he,i.current=W,c.current=g,f.current=E,I.current=ie},[g,W,he,E,S,ie]),(0,l.useEffect)(()=>{X.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,Ae.current.clear()},[V]),(0,l.useEffect)(()=>{var r;!T||!s||J||(h("advert_slot_error",{errorLayer:"render",errorType:"BI_SPLASH_NATIVE_AD_UNSUPPORTED",provider:"wechat"}),(r=$.current)==null||r.call($,{provider:"wechat",type:"splash",errCode:"BI_SPLASH_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"}))},[J,T,h,s]);let Se=r=>{let o=r==="custom"&&p?{configId:p.configId,placementId:p.placementId,configName:p.configName,advertPlatform:p.advertPlatform}:{};return d({provider:r,type:"splash"},o)},U=(0,l.useCallback)(()=>{Pe.current&&clearInterval(Pe.current),ge.current&&clearTimeout(ge.current),Me.current&&clearTimeout(Me.current),Re.current&&clearTimeout(Re.current),Pe.current=null,ge.current=null,Me.current=null,Re.current=null},[]),Be=(0,l.useCallback)((r,o)=>{U(),H.current=r,ve.current=!1,de(r),k(o),pe(!1),ce(we),L(!1),q(!1)},[U,we]),ne=(0,l.useCallback)((r,o)=>{!r||r===o||h("advert_slot_fallback",{fallbackType:"channel",fromChannel:r,toChannel:o,resultCode:"provider_load_fail"})},[h]),Ue=(0,l.useCallback)((r,o)=>{var Ie;let z=F&&(r==="custom"||se&&O.current.wechat&&O.current.custom),v=z?"allProvidersFailed":"wechatAdLoadFail";U(),k(!1),pe(!1),ce(0),L(!1),q(!1),h("advert_slot_close",{closeType:v,provider:z?"none":r},!0),(Ie=i.current)==null||Ie.call(i,{provider:z?"none":r,type:"splash",reason:v,error:o})},[se,U,F,h]),Le=(0,l.useCallback)(()=>{if(!(Pe.current||!H.current)){if(L(!0),we<=0){ce(0);return}ce(we),Pe.current=setInterval(()=>{ce(r=>Math.max(0,r-1))},1e3)}},[we]),He=(0,l.useCallback)(()=>{P&&(ge.current=setTimeout(()=>{var o;if(ve.current||H.current!=="custom")return;let r=_(d({},Se("custom")),{errorType:"CUSTOM_MEDIA_LOAD_TIMEOUT",errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6",mediaType:ae?"image":"video",rawErrCode:void 0,rawErrMsg:void 0});h("advert_slot_error",{errorLayer:"render",errorType:r.errCode,provider:"custom"}),(o=$.current)==null||o.call($,r),O.current.custom=!0,se&&!O.current.wechat?(ne("custom","wechat"),Be("wechat",!0),Le()):Ue("custom",r)},nr(p)))},[se,Ue,P,ae,Be,p,Le,h,ne]),Fe=(0,l.useCallback)(r=>{ne(H.current,r),Be(r,!0),r==="wechat"?Le():P&&He()},[P,Be,Le,He,ne]),Te=(0,l.useCallback)((r,o,a,w)=>{var Ie;if(H.current!=="custom"||O.current.custom)return;let z=Ne(r,Se("custom")),v=_(d({},z),{errorType:o,errCode:a,errMsg:w,mediaType:ae?"image":"video",rawErrCode:z.errCode,rawErrMsg:z.errMsg});h("advert_slot_error",{errorLayer:"render",errorType:v.errCode,provider:"custom"}),(Ie=$.current)==null||Ie.call($,v),O.current.custom=!0,se&&!O.current.wechat?Fe("wechat"):Ue("custom",v)},[se,Ue,ae,Fe,h]),$e=(0,l.useCallback)(()=>{var r;if(me.current){k(!1);return}if(!B){Be(null,!1),K.current||(K.current=!0,h("advert_slot_close",{closeType:"noAd",provider:"none"},!0),(r=i.current)==null||r.call(i,{provider:"none",type:"splash",reason:"noAd"}));return}Fe(B),B==="custom"&&!P&&Te(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")},[Te,P,B,Be,Fe,h]),We=(0,l.useCallback)(()=>{if(!T||me.current)return;if(!oe){$e();return}let r=rr();if(!(r!=null&&r.getShowSplashAdStatus)||De.current>=3){$e();return}r.getShowSplashAdStatus({success:o=>{var a;if((o==null?void 0:o.code)===-1){De.current+=1,Me.current=setTimeout(We,300);return}if((o==null?void 0:o.code)===1){U(),me.current=!0,k(!1),h("advert_slot_render",{displayMode:"splash",provider:"wechat",nativeSplash:!0},!0),h("advert_slot_exposure",{displayMode:"splash",provider:"wechat",exposureMethod:"nativeSplash"},!0),(a=fe.current)==null||a.call(fe,{provider:"wechat",type:"splash",nativeSplash:!0});return}$e()},fail:$e})},[$e,oe,U,T,h]);(0,l.useEffect)(()=>{let r=Oe.current,o=T&&!r.show||r.identity!==V;if(Oe.current={identity:V,show:T},!T){me.current=!1,K.current=!1,O.current={wechat:!1,custom:!1},Be(B,!1);return}if(!me.current)return o&&(K.current=!1,X.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,Ae.current.clear(),H.current=null),O.current={wechat:!1,custom:!1},me.current=!1,De.current=0,Be(B,!1),We(),U},[We,U,V,B,Be,T]),(0,l.useEffect)(()=>{var o;if(!b||Ee!==0||!j||R||!H.current)return;let r=H.current;if(be){U(),q(!0),Re.current=setTimeout(()=>{var a;pe(!0),q(!1),h("advert_slot_hide",{displayMode:"splash",provider:r}),(a=f.current)==null||a.call(f,Se(r))},280);return}U(),k(!1),h("advert_slot_close",{closeType:"close",provider:r},!0),(o=i.current)==null||o.call(i,Se(r))},[U,b,be,Ee,R,h,j]);let Ye=r=>{var o;H.current==="wechat"&&(Le(),h("advert_slot_render",{displayMode:"splash",provider:"wechat"},!0),h("advert_slot_exposure",{displayMode:"splash",provider:"wechat",exposureMethod:"onLoad"},!0),(o=fe.current)==null||o.call(fe,Ne(r,Se("wechat"))))},sr=r=>{var w;if(H.current!=="wechat"||O.current.wechat)return;let o=r!=null&&r.detail&&typeof r.detail=="object"?r.detail:{},a=_(d({},Ne(r,Se("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(o.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:o.errCode,rawErrMsg:o.errMsg});h("advert_slot_error",{errorLayer:"render",errorType:a.errCode,provider:"wechat"}),(w=$.current)==null||w.call($,a),O.current.wechat=!0,F&&!O.current.custom?(Fe("custom"),P||Te(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")):Ue("wechat",a)},le=()=>{var r;H.current!=="custom"||ve.current||(ge.current&&clearTimeout(ge.current),ge.current=null,ve.current=!0,Le(),h("advert_slot_render",{displayMode:"splash",provider:"custom"},!0),h("advert_slot_exposure",{displayMode:"splash",provider:"custom",exposureMethod:"onLoad"},!0),(r=fe.current)==null||r.call(fe,Se("custom")))},Ke=r=>{var a;(a=r==null?void 0:r.stopPropagation)==null||a.call(r),H.current&&(L(!0),ce(0))},ze=()=>{var o;if(H.current!=="custom")return;let r=Se("custom");h("product_ui_action",{actionType:"primary_click",provider:"custom"}),(o=c.current)==null||o.call(c,r),Je({customAd:p,actionDetail:r,onExternalLaunch:a=>{h("product_external_launch",{launchType:a.launchType,status:a.status,provider:"custom"})},onOpenWebview:a=>{var w;h("product_external_launch",{launchType:"h5",status:"triggered",provider:"custom"}),(w=I.current)==null||w.call(I,a)},onError:a=>{var w;h("advert_slot_error",{errorLayer:"action",errorType:a.errCode,provider:"custom"}),(w=$.current)==null||w.call($,a)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL",apiRequestErrorCode:"BI_SPLASH_API_REQUEST_FAIL",apiRequestParams:{configId:p==null?void 0:p.configId,equipmentValue:ee,userId:ue},preferStandardFields:!0})},je=r=>{var o;U(),k(!1),pe(!1),ce(0),L(!1),h("advert_slot_close",{closeType:(r==null?void 0:r.reason)||"close",provider:(r==null?void 0:r.provider)||"custom"},!0),(o=i.current)==null||o.call(i,r)},Xe=["bi-splash-ad",R?"bi-splash-ad--pip":"",Y?"bi-splash-ad--pip-animating":"",re||""].filter(Boolean).join(" ");return!j||!M?null:(0,D.jsxs)(A.View,{className:Xe,style:{zIndex:G},children:[M==="wechat"&&J?(0,D.jsx)(A.View,{className:"bi-splash-ad__popup",children:(0,D.jsx)(A.View,{className:`bi-splash-ad__media-wrapper${R?" bi-splash-ad__media-wrapper--pip":""}`,children:(0,D.jsx)(J,{className:"bi-splash-ad__wechat-unit",unitId:s,onLoad:Ye,onError:sr,onClose:r=>je(Ne(r,Se("wechat")))})})}):M==="custom"&&P?(0,D.jsx)(A.View,{className:"bi-splash-ad__popup bi-splash-ad__custom",children:(0,D.jsxs)(A.View,{className:"bi-splash-ad__media-shell",onClick:ze,children:[ae?(0,D.jsx)(A.Image,{className:"bi-splash-ad__media",src:te,mode:Ce==="cover"?"aspectFill":"aspectFit",onLoad:le,onError:r=>Te(r,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}):(0,D.jsx)(A.Video,{className:"bi-splash-ad__video",src:te,poster:ke,autoplay:!0,muted:(p==null?void 0:p.muted)!==!1,loop:!0,objectFit:Ce,showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:le,onError:r=>Te(r,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}),R?(0,D.jsx)(A.View,{className:"bi-splash-ad__pip-mask"}):null,!R&&!_e.isFullScreen?(0,D.jsxs)(A.View,{className:"bi-splash-ad__disclosure",style:_e.disclosureStyle,children:[(0,D.jsx)(A.Text,{children:xe}),(0,D.jsx)(A.View,{className:"bi-splash-ad__disclosure-arrow"})]}):null,!R&&(p!=null&&p.bottomImage)?(0,D.jsx)(A.Image,{className:"bi-splash-ad__bottom-image",src:p.bottomImage,mode:"widthFix"}):null]})}):null,R?(0,D.jsx)(A.View,{className:"bi-splash-ad__pip-close",onClick:()=>je(Se(M)),children:(0,D.jsx)(A.View,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,!R&&_e.isFullScreen&&M==="custom"?(0,D.jsxs)(A.View,{className:"bi-splash-ad__combined-control",style:_e.combinedControlStyle,children:[(0,D.jsxs)(A.View,{className:"bi-splash-ad__combined-capsule",children:[(0,D.jsxs)(A.View,{className:"bi-splash-ad__combined-disclosure",children:[(0,D.jsx)(A.Text,{children:xe}),(0,D.jsx)(A.View,{className:"bi-splash-ad__disclosure-arrow"})]}),(0,D.jsx)(A.View,{className:"bi-splash-ad__combined-divider"}),(0,D.jsx)(A.View,{className:"bi-splash-ad__combined-skip",onClick:Ke,children:"\u8DF3\u8FC7"})]}),(0,D.jsxs)(A.Text,{className:"bi-splash-ad__combined-countdown",children:[Ee," \u79D2"]})]}):R?null:(0,D.jsxs)(A.View,{className:"bi-splash-ad__skip",style:_e.skipStyle,onClick:Ke,children:[(0,D.jsxs)(A.Text,{children:[Ee,"s"]}),(0,D.jsx)(A.View,{className:"bi-splash-ad__skip-divider"}),(0,D.jsx)(A.Text,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};var C=require("react"),wr=require("@bi-nova/core");var cr=require("react/jsx-runtime"),Jr="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",Yr=300*1e3;function Kr(e,t){var s,N;let n={},u=typeof(e==null?void 0:e.provider)=="string"?e.provider:"",m=(s=e==null?void 0:e.configId)!=null?s:t==null?void 0:t.configId;if(u&&(n.provider=u),(typeof m=="string"||typeof m=="number")&&(n.configId=m),u==="custom"&&t){let T=String(((N=t.action)==null?void 0:N.type)||t.jumpType||"").trim().toLowerCase(),G=T==="miniprogram"?"miniProgram":["internal","web","api","none"].includes(T)?T:"";G&&(n.jumpType=G)}return n}var Br=["banner","splash"],Dr=({adId:e="",pageId:t,moduleId:n,placementId:u,unitId:m,type:s="banner",customAd:N,priority:Q="wechat-first",adOptions:T=null,sdkKey:G="biNova",autoLoad:be=!0,adIntervals:oe=30,show:x=!0,zIndex:ee=999,pictureInPicture:ue=!1,checkNativeSplash:re=!0,nativeSplashCache:S=!0,jumpSeconds:he=5,equipmentValue:W="",userId:g=0,className:E,onLoad:ie,onError:J,onClose:p,onAction:te,onFeedback:ke,onHide:ae,onOpenWebview:Ce,onConfigLoad:we,onConfigError:xe})=>{var ze,je,Xe;let _e=(0,C.useRef)(0),se=(0,C.useRef)(""),F=(0,C.useRef)(null),P=(0,C.useRef)(ie),B=(0,C.useRef)(J),V=(0,C.useRef)(p),j=(0,C.useRef)(te),k=(0,C.useRef)(ke),M=(0,C.useRef)(ae),de=(0,C.useRef)(Ce),R=(0,C.useRef)(we),pe=(0,C.useRef)(xe),Ee=(0,C.useRef)(x),ce=(0,C.useRef)(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),b=(0,C.useRef)(new Set),L=(0,C.useRef)(!1),[Y,q]=(0,C.useState)(!1),[H,O]=(0,C.useState)(!1),[ve,me]=(0,C.useState)(null);(0,C.useEffect)(()=>{P.current=ie,B.current=J,V.current=p,j.current=te,k.current=ke,M.current=ae,de.current=Ce,R.current=we,pe.current=xe,Ee.current=x},[te,p,xe,we,J,ke,ae,ie,Ce,x]);let K=(0,C.useMemo)(()=>Br.includes(s)?s:"banner",[s]),Oe=u||(T&&typeof T.placementId=="string"?T.placementId:"")||e,De=(r,o,a={})=>{let w=ge(),z=(w==null?void 0:w.tracking)||(0,wr.getRegisteredAdvertTracker)();if(!z)return;let v=z.resolvePage(t);v.pageId==="page_unknown"&&!L.current&&(L.current=!0,z.track(_(d({key:"advert_slot_error",featureId:"advert_product_slot"},n?{moduleId:n}:{}),{pageId:v.pageId,pageIdSource:v.pageIdSource,pageUrl:v.pageUrl,attr:{errorLayer:"tracking",errorType:"page_not_resolved"}}))),z.track(_(d({key:r,featureId:o},n?{moduleId:n}:{}),{pageId:v.pageId,pageIdSource:v.pageIdSource,pageUrl:v.pageUrl,attr:_(d({},a),{displayId:ce.current,placementId:Oe})}))},Pe=()=>!!(be&&e),ge=()=>{var w;let r=globalThis.getApp,o=typeof r=="function"?r():null;if(!o)return null;let a=o;return a[G]||((w=a.globalData)==null?void 0:w[G])||null},Me=()=>{var r;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let o=wx.getAccountInfoSync();return((r=o==null?void 0:o.miniProgram)==null?void 0:r.appId)||""}}catch(o){return""}return""},Re=(r,o)=>`${Jr}_${o||"unknown"}_${r||"empty"}`,fe=(r,o)=>{if(!S||!r||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let a=Re(r,o),w=Number(wx.getStorageSync(a)||0),z=Date.now()-w;return w>0&&z>=0&&z<=Yr}catch(a){return!1}},$=()=>{if(S&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let r=Re(e,Me());wx.setStorageSync(r,Date.now())}catch(r){}},i=()=>{_e.current+=1,se.current="",q(!1),O(!1),me(null)},c=()=>{let r=T&&typeof T=="object"?T:{},o=Me(),a=_(d(d(_(d({},r),{adId:e,placementId:u||r.placementId||e,appId:r.appId||o,type:K}),t?{pageId:t}:{}),n?{moduleId:n}:{}),{trackingSource:"ui"});return Number.isInteger(g)&&g>0?a.userId=g:delete a.userId,a},f=r=>{try{return JSON.stringify(r||{})}catch(o){return`${String(r.appId||"")}_${String(r.placementId||"")}`}},I=r=>{let o=(r==null?void 0:r.unitId)||"",a=(r==null?void 0:r.customAd)||(r==null?void 0:r.custom)||null,w=typeof(r==null?void 0:r.show)=="boolean"?r.show:!!(o||a);return{unitId:o,customAd:a,priority:(r==null?void 0:r.priority)||"wechat-first",show:w}},X=r=>{var o,a;(o=pe.current)==null||o.call(pe,r),(a=B.current)==null||a.call(B,r)},Ae=r=>{var a;let o=`${ce.current}:advert_slot_close`;b.current.has(o)||(b.current.add(o),De("advert_slot_close","advert_product_slot",{closeType:"noAd",provider:"none"})),(a=V.current)==null||a.call(V,{type:K,adId:e||r.adId||"",provider:"none",reason:"noAd"})},h=async()=>{var z;if(!Pe())return;let r=c(),o=f(r);if(se.current===o&&(Y||H))return;De("advert_slot_config_request","advert_product_slot",{sceneCode:K,requestType:"remote_config"});let a=ge();if(!(a!=null&&a.ads)||typeof a.ads.getDisplayAdConfig!="function"){i(),X({type:K,adId:e,errCode:"DISPLAY_AD_SDK_NOT_READY",errMsg:"\u672A\u83B7\u53D6\u5230\u53EF\u7528\u7684\u5E7F\u544A\u670D\u52A1 SDK\uFF0C\u8BF7\u5148\u6CE8\u5165\u5168\u5C40 biNova \u5B9E\u4F8B"}),De("advert_slot_error","advert_product_slot",{errorLayer:"config",errorType:"sdk_not_ready"});return}let w=_e.current+1;_e.current=w,se.current=o,q(!0),O(!1),me(null);try{let v=await a.ads.getDisplayAdConfig(r);if(w!==_e.current)return;if(!v||v.code!==0||!v.data){q(!1),O(!0),me(null),X({type:K,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(v==null?void 0:v.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:v||null}),De("advert_slot_config_decision","advert_product_slot",{status:"no_config",errorType:"remote_config_fail"});return}let Ie=I(v.data),Tr=!!(Ee.current&&!Ie.show);q(!1),O(!0),me(v.data),(z=R.current)==null||z.call(R,{type:K,adId:e,requestOptions:r,data:v.data}),De("advert_slot_config_decision","advert_product_slot",d({status:Ie.show?"selected":"no_config"},Kr({provider:Ie.customAd?"custom":Ie.unitId?"wechat":"none"},Ie.customAd))),Tr&&Ae(v.data)}catch(v){if(w!==_e.current)return;q(!1),O(!0),me(null),X({type:K,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:v instanceof Error?v.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:v}),De("advert_slot_error","advert_product_slot",{errorLayer:"config",errorType:"remote_config_exception"})}};(0,C.useEffect)(()=>{var r;Br.includes(s)||(r=B.current)==null||r.call(B,{type:"banner",errCode:"UNSUPPORTED_DISPLAY_AD_TYPE",errMsg:`\u4E0D\u652F\u6301\u7684\u5C55\u793A\u5E7F\u544A\u7C7B\u578B\uFF1A${s}\uFF0C\u8BF7\u4F7F\u7528 "banner" \u6216 "splash"`})},[s]),(0,C.useEffect)(()=>{if(!e){i();return}h()},[e,T,be,K,G,g]);let Se=Pe(),U=Se?I(ve):null,Be=U?U.unitId:m||"",ne=U?U.customAd:N||null,Ue=U?U.priority:Q,Le=!!(x&&(!Se||!e||H&&(U!=null&&U.show))),He=Me(),Fe=JSON.stringify([K,He,e,re,S]),Te=F.current;!!(!Te||Te.identity!==Fe||!Te.show&&x)?F.current={identity:Fe,show:x,shouldCheck:!!(re&&!fe(e,He))}:Te&&Te.show!==x&&(F.current=_(d({},Te),{show:x}));let We=!!((ze=F.current)!=null&&ze.shouldCheck),Ye=e||(ve==null?void 0:ve.adId)||"",sr=JSON.stringify([Ye,K,Be,ne==null?void 0:ne.configId,ne==null?void 0:ne.image,ne==null?void 0:ne.video]);(0,C.useEffect)(()=>{ce.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,b.current.clear(),L.current=!1},[sr]);let le=r=>d({adId:Ye},r);if(K==="splash"){let r={pageId:t,moduleId:n,placementId:Oe,sdkKey:G,tracker:(je=ge())==null?void 0:je.tracking,unitId:Be,customAd:ne,priority:Ue,show:Le,zIndex:ee,pictureInPicture:ue,checkNativeSplash:We,jumpSeconds:he,equipmentValue:W,userId:g,className:E,onLoad:o=>{var a;o&&typeof o=="object"&&o.nativeSplash===!0&&$(),(a=P.current)==null||a.call(P,le(o))},onError:o=>{var a;(a=B.current)==null||a.call(B,le(o))},onClose:o=>{var a;(a=V.current)==null||a.call(V,le(o))},onAction:o=>{var a;(a=j.current)==null||a.call(j,le(o))},onHide:o=>{var a;(a=M.current)==null||a.call(M,le(o))},onOpenWebview:o=>{var a;(a=de.current)==null||a.call(de,le(o))}};return(0,cr.jsx)(ar,d({},r))}if(!Le)return null;let Ke={pageId:t,moduleId:n,placementId:Oe,sdkKey:G,tracker:(Xe=ge())==null?void 0:Xe.tracking,unitId:Be,customAd:ne,priority:Ue,adIntervals:oe,equipmentValue:W,userId:g,className:E,onLoad:r=>{var o;(o=P.current)==null||o.call(P,le(r))},onError:r=>{var o;(o=B.current)==null||o.call(B,le(r))},onClose:r=>{var o;(o=V.current)==null||o.call(V,le(r))},onAction:r=>{var o;(o=j.current)==null||o.call(j,le(r))},onFeedback:r=>{var o;(o=k.current)==null||o.call(k,le(r))},onOpenWebview:r=>{var o;(o=de.current)==null||o.call(de,le(r))}};return(0,cr.jsx)(ir,d({},Ke))};0&&(module.exports={BiBannerAd,BiDisplayAd,BiSplashAd});
package/dist/ad/index.mjs CHANGED
@@ -1 +1 @@
1
- var St=Object.defineProperty,Dt=Object.defineProperties;var Ct=Object.getOwnPropertyDescriptors;var st=Object.getOwnPropertySymbols;var bt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable;var lt=(e,n,r)=>n in e?St(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,f=(e,n)=>{for(var r in n||(n={}))bt.call(n,r)&&lt(e,r,n[r]);if(st)for(var r of st(n))wt.call(n,r)&&lt(e,r,n[r]);return e},v=(e,n)=>Dt(e,Ct(n));import"./banner/index.scss";import"./splash/index.scss";import{useCallback as Oe,useEffect as Qe,useMemo as xt,useRef as Ae,useState as ze}from"react";import{Image as Rt,Text as Lt,View as ve}from"@tarojs/components";import*as ht from"@tarojs/taro";import*as _t from"@tarojs/components";var $e;function Ge(){if($e!==void 0)return $e;try{let e=_t;$e=(e==null?void 0:e.AdCustom)||null}catch(e){$e=null}return $e}import*as xe from"@tarojs/taro";function Ke(){return typeof wx!="undefined"?wx:null}function ye(e,n){let r=e==null?void 0:e.detail;return r&&typeof r=="object"?f(f({},n),r):e&&typeof e=="object"?f(f({},n),e):f({},n)}function ut(e){return e?e.mediaType==="video"?e.video||"":e.mediaType==="image"?e.image||"":e.video||e.image||"":""}function dt(e,n=""){return e&&(e.poster||e.image||n)||""}function pt(e,n=""){return e?e.mediaType==="video"?!1:e.mediaType==="image"?!0:e.video?!1:e.image?!0:/\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(String(n).trim()):!0}function mt(e){return String((e==null?void 0:e.fitMode)||"").trim().toLowerCase()==="contain"?"contain":"cover"}function Ye(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function gt(e,n=5){let r=e==null?void 0:e.jumpSeconds,d=r!=null?r:n;return Math.min(99,Math.max(0,Number(d)||0))}function Je(e){var r;let n=(r=e==null?void 0:e.loadTimeout)!=null?r:e==null?void 0:e.timeout;return Math.max(1e3,Number(n)||5e3)}function vt(e,n=!1){var r,d,g,A;if(!e)return"none";if(n){let I=String(((r=e.action)==null?void 0:r.type)||e.jumpType||"").trim().toLowerCase();if(I==="miniprogram")return"miniProgram";if(I==="internal")return"internal";if(I==="web")return"web";if(I==="api")return"api";if(I==="none")return"none"}return n&&((d=e.action)!=null&&d.appId||e.targetAppId)||e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":n&&((g=e.action)!=null&&g.path||e.targetPath)||e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":n&&((A=e.action)!=null&&A.url||e.jumpUrl)||e.url||e.webUrl||e.h5Url?"web":"none"}function It(e,n=!1){var r;return e&&((n?((r=e.action)==null?void 0:r.appId)||e.targetAppId:"")||e.appId||e.miniProgramAppId||e.jumpAppId)||""}function Tt(e,n=!1){var r;return e&&((n?((r=e.action)==null?void 0:r.path)||e.targetPath:"")||e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function Pt(e,n=!1){var d;if(!e)return"full";let r=(n?(d=e.action)==null?void 0:d.miniProgramOpenMode:"")||e.miniProgramOpenMode;return String(r||"").trim().toLowerCase()==="half"?"half":"full"}function Et(e,n=!1){var r;return e&&((n?((r=e.action)==null?void 0:r.url)||e.jumpUrl:"")||e.url||e.webUrl||e.h5Url)||""}function Nt(e){return e!=null&&e!==""}function ct(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Mt(e,n){let r=e.indexOf("#"),d=r>=0?e.slice(r):"",g=r>=0?e.slice(0,r):e,A=Object.keys(n).map(R=>`${encodeURIComponent(R)}=${encodeURIComponent(String(n[R]))}`).join("&");if(!A)return e;let I=g.includes("?")?/[?&]$/.test(g)?"":"&":"?";return`${g}${I}${A}${d}`}function kt(e,n){var R;let r=ct(e==null?void 0:e.data)?e.data:null,d=ct(r==null?void 0:r.body)?r.body:null,g=String((d==null?void 0:d.appId)||"").trim(),A=String((d==null?void 0:d.url)||"").trim().replace(/^\/+/,"");if(String((r==null?void 0:r.code)||"")!=="200"||!g||!A){(R=n.onError)==null||R.call(n,v(f({},n.actionDetail),{errCode:n.apiRequestErrorCode||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:String((r==null?void 0:r.message)||"\u5E7F\u544A\u63A5\u53E3\u54CD\u5E94\u5F02\u5E38")}));return}We(v(f({},n),{customAd:{action:{type:"miniProgram",appId:g,path:A,miniProgramOpenMode:"half"}},preferStandardFields:!0}))}function We(e){let{customAd:n,actionDetail:r,onOpenWebview:d,onError:g,miniProgramErrorCode:A,navigateErrorCode:I,miniProgramUnsupportedErrorCode:R,apiRequestErrorCode:ee,apiRequestParams:L,preferStandardFields:J=!1}=e;if(!n)return;let K=vt(n,J),Y=It(n,J),w=Tt(n,J),m=Et(n,J);if(K==="miniProgram"&&Y){let p=Ke(),F=Pt(n,J),T=F==="half"?p==null?void 0:p.openEmbeddedMiniProgram:p==null?void 0:p.navigateToMiniProgram;if(!p||typeof T!="function"){g==null||g(v(f({},r),{errCode:R||A,errMsg:F==="half"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u534A\u5C4F\u6253\u5F00\u5176\u4ED6\u5C0F\u7A0B\u5E8F":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}T.call(p,{appId:Y,path:w||"",fail:c=>{g==null||g(v(f({},r),{errCode:A,errMsg:(c==null?void 0:c.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(K==="internal"&&w){xe.navigateTo({url:w,fail:p=>{g==null||g(v(f({},r),{errCode:I,errMsg:(p==null?void 0:p.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}if(K==="web"&&m){d==null||d(v(f({},r),{url:m}));return}if(K==="api"&&m){let p=L||{},T=["configId","equipmentValue","userId"].filter(C=>{let te=p[C];return C==="userId"?!Number.isInteger(te)||Number(te)<=0:!Nt(te)});if(T.length){g==null||g(v(f({},r),{errCode:ee||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:`\u63A5\u53E3\u578B\u5E7F\u544A\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570\u6216\u53C2\u6570\u503C\u65E0\u6548\uFF1A${T.join("\u3001")}`}));return}let c=Mt(m,{configId:p.configId,equipmentValue:p.equipmentValue,userId:p.userId});xe.request({url:c,method:"GET",success:C=>{kt(C,e)},fail:C=>{g==null||g(v(f({},r),{errCode:ee||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:(C==null?void 0:C.errMsg)||"\u5E7F\u544A\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25"}))}})}}function ft(){var p;let e=Ke(),n=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},r=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof xe.getSystemInfoSync=="function"?xe.getSystemInfoSync():{},d=Number(r.windowHeight||0),g=Number(r.screenHeight||0),A=!!(d&&g&&d===g),I=16,R=16,ee=16,L=32,J=A&&n.top?n.top:Math.max(I,Number(r.statusBarHeight||0)+4),K=A&&n.height?n.height:L,Y=A&&n.top?n.top:I,w=A&&n.height?n.height:L,m=Math.max(ee,Number(((p=r.safeArea)==null?void 0:p.left)||0)+ee);return{isFullScreen:A,skipStyle:{top:`${Y}px`,width:"156rpx",height:`${w}px`,lineHeight:`${w}px`,borderRadius:`${Math.round(w/2)}px`,left:A?`${ee}px`:void 0,right:A?void 0:`${R}px`},disclosureStyle:{top:`${Y}px`,left:`${m}px`,height:`${w}px`,lineHeight:`${w}px`},combinedControlStyle:{top:`${J}px`,left:`${m}px`,height:`${K}px`}}}import{Fragment as Ft,jsx as Be,jsxs as rt}from"react/jsx-runtime";var Ot=[{label:"\u4E0E\u6211\u65E0\u5173",value:"irrelevant"},{label:"\u91CD\u590D\u6536\u5230\u591A\u6B21",value:"repeated"},{label:"\u5185\u5BB9\u592A\u5DEE",value:"poorContent"}];function Ut(e,n,r){return e&&n?r==="custom-first"||r==="custom-only"?"custom":"wechat":e?"wechat":n?"custom":null}var nt=({unitId:e="",customAd:n,priority:r="wechat-first",adIntervals:d=30,equipmentValue:g="",userId:A=0,className:I,onLoad:R,onError:ee,onClose:L,onAction:J,onFeedback:K,onOpenWebview:Y})=>{let w=xt(()=>Ge(),[]),m=n||null,p=!!(m!=null&&m.image),F=!!(e&&w),T=Ut(F,p,r),c=JSON.stringify([e,m,r,!!w]),[C,te]=ze(!!T),[Q,ce]=ze(T),[ie,Se]=ze(!1),[ue,z]=ze("primary"),M=Ae(T),k=Ae({wechat:!1,custom:!1}),x=Ae(!1),H=Ae(null),b=Ae(R),y=Ae(ee),B=Ae(L),de=Ae(J),P=Ae(K),j=Ae(Y);Qe(()=>{b.current=R,y.current=ee,B.current=L,de.current=J,P.current=K,j.current=Y},[J,L,ee,K,R,Y]);let E=Oe(a=>{let s=a==="custom"&&m?{configId:m.configId,placementId:m.placementId,configName:m.configName,advertPlatform:m.advertPlatform}:{};return f({provider:a,type:"banner"},s)},[m]),S=Oe(()=>{H.current&&(clearTimeout(H.current),H.current=null)},[]),X=Oe(()=>{Se(!1),z("primary")},[]),pe=Oe(a=>{S(),M.current=a,x.current=!1,ce(a),te(!0),X()},[S,X]),me=Oe((a,s)=>{var $;let h=!!e&&p?"allProvidersFailed":a==="wechat"?"wechatAdLoadFail":"customMediaLoadFail";S(),M.current=null,ce(null),te(!1),X(),($=B.current)==null||$.call(B,{provider:a,type:"banner",reason:h,error:s})},[S,X,p,e]),ge=Oe((a,s,u,h)=>{var we;if(M.current!=="custom"||k.current.custom)return;S();let $=ye(a,E("custom")),oe=v(f({},$),{errorType:s,errCode:u,errMsg:h,mediaType:"image",rawErrCode:$.errCode,rawErrMsg:$.errMsg});if(k.current.custom=!0,(we=y.current)==null||we.call(y,oe),F&&!k.current.wechat){pe("wechat");return}me("custom",oe)},[F,S,E,me,pe]);Qe(()=>(S(),k.current={wechat:!1,custom:!1},x.current=!1,M.current=T,ce(T),te(!!T),X(),S),[S,X,c,T]),Qe(()=>{if(S(),!(!C||Q!=="custom"||!p))return H.current=setTimeout(()=>{x.current||M.current!=="custom"||ge(void 0,"CUSTOM_MEDIA_LOAD_TIMEOUT","BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6")},Je(m)),S},[S,ge,p,Q,m,C]),Qe(()=>{var s,u;if(!e||w)return;let a=v(f({},E("wechat")),{errCode:"BI_BANNER_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"});(s=y.current)==null||s.call(y,a),p||(u=B.current)==null||u.call(B,v(f({},E("wechat")),{reason:"wechatAdLoadFail",error:a}))},[w,E,p,e]);let O=a=>{var s;M.current==="wechat"&&((s=b.current)==null||s.call(b,ye(a,E("wechat"))))},U=a=>{var h;if(M.current!=="wechat"||k.current.wechat)return;let s=a!=null&&a.detail&&typeof a.detail=="object"?a.detail:{},u=v(f({},ye(a,E("wechat"))),{errCode:"BI_BANNER_WECHAT_AD_LOAD_FAIL",errMsg:String(s.errMsg||"\u5FAE\u4FE1 Banner \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:s.errCode,rawErrMsg:s.errMsg});if(k.current.wechat=!0,(h=y.current)==null||h.call(y,u),p&&!k.current.custom){pe("custom");return}me("wechat",u)},ae=a=>{var s;M.current==="wechat"&&((s=B.current)==null||s.call(B,ye(a,E("wechat"))))},V=()=>{var a;M.current!=="custom"||x.current||(S(),x.current=!0,(a=b.current)==null||a.call(b,E("custom")))},De=()=>{var s;if(ie){X();return}let a=E("custom");(s=de.current)==null||s.call(de,a),We({customAd:m,actionDetail:a,onOpenWebview:u=>{var h;return(h=j.current)==null?void 0:h.call(j,u)},onError:u=>{var h;return(h=y.current)==null?void 0:h.call(y,u)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL",apiRequestErrorCode:"BI_BANNER_API_REQUEST_FAIL",apiRequestParams:{configId:m==null?void 0:m.configId,equipmentValue:g,userId:A},preferStandardFields:!0})},Re=a=>{var s;(s=a.stopPropagation)==null||s.call(a),Se(u=>!u),z("primary")},Ce=a=>{var s;(s=a.stopPropagation)==null||s.call(a)},he=a=>{var s,u;(s=a.stopPropagation)==null||s.call(a),X(),(u=P.current)==null||u.call(P,v(f({},E("custom")),{provider:"custom",action:"report"})),ht.showToast({title:"\u5DF2\u6536\u5230\u60A8\u7684\u53CD\u9988\uFF0C\u6211\u4EEC\u4F1A\u5C3D\u5FEB\u5904\u7406~",icon:"none",duration:2e3})},fe=(a,s)=>{var h,$,oe;(h=a.stopPropagation)==null||h.call(a);let u=v(f({},E("custom")),{provider:"custom",action:"dislike",reason:s.value,reasonText:s.label});S(),M.current=null,ce(null),te(!1),X(),($=P.current)==null||$.call(P,u),(oe=B.current)==null||oe.call(B,v(f({},E("custom")),{reason:"notInterested",feedbackReason:s.value,feedbackReasonText:s.label}))},be=`bi-banner-ad${I?` ${I}`:""}`;return!C||!Q?null:Q==="wechat"&&w?Be(w,{className:be,unitId:e,adIntervals:d,onLoad:O,onError:U,onClose:ae}):Q!=="custom"||!(m!=null&&m.image)?null:rt(ve,{className:be,children:[Be(ve,{className:"bi-banner-ad__surface",onClick:De,children:Be(Rt,{className:"bi-banner-ad__image",src:m.image,mode:"widthFix",onLoad:V,onError:a=>ge(a,"CUSTOM_MEDIA_LOAD_FAIL","BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")})}),rt(ve,{className:"bi-banner-ad__badge",onClick:Re,children:[Be(Lt,{children:Ye(m)}),Be(ve,{className:"bi-banner-ad__badge-arrow"})]}),ie?Be(ve,{className:"bi-banner-ad__feedback-panel",onClick:Ce,children:ue==="primary"?rt(Ft,{children:[Be(ve,{className:"bi-banner-ad__feedback-source",children:"\u7531\u8D5E\u52A9\u5546\u63D0\u4F9B\u7684\u5185\u5BB9"}),Be(ve,{className:"bi-banner-ad__feedback-item",onClick:a=>{var s;(s=a.stopPropagation)==null||s.call(a),z("dislike")},children:"\u4E0D\u611F\u5174\u8DA3"}),Be(ve,{className:"bi-banner-ad__feedback-item",onClick:he,children:"\u53CD\u9988\u95EE\u9898"})]}):Ot.map(a=>Be(ve,{className:"bi-banner-ad__feedback-item",onClick:s=>fe(s,a),children:a.label},a.value))}):null]})};import{useCallback as Ie,useEffect as Xe,useMemo as ke,useRef as G,useState as Ue}from"react";import{Image as yt,Text as qe,Video as Vt,View as W}from"@tarojs/components";import{jsx as q,jsxs as Te}from"react/jsx-runtime";function $t(e,n,r){return e&&n?r==="custom-first"||r==="custom-only"?"custom":"wechat":e?"wechat":n?"custom":null}var it=({unitId:e="",customAd:n,priority:r="wechat-first",show:d=!0,zIndex:g=999,pictureInPicture:A=!1,checkNativeSplash:I=!0,jumpSeconds:R=5,equipmentValue:ee="",userId:L=0,className:J,onLoad:K,onError:Y,onClose:w,onAction:m,onHide:p,onOpenWebview:F})=>{let T=ke(()=>Ge(),[]),c=n||null,C=ke(()=>ut(c),[c]),te=ke(()=>dt(c,C),[C,c]),Q=ke(()=>pt(c,C),[C,c]),ce=ke(()=>mt(c),[c]),ie=ke(()=>gt(c,R),[R,c]),Se=ke(()=>Ye(c),[c]),ue=ke(()=>ft(),[]),z=!!(e&&T),M=!!(C||c!=null&&c.mediaType),k=!!C,x=$t(z,M,r),H=JSON.stringify([e,c,r,!!T]),[b,y]=Ue(!1),[B,de]=Ue(x),[P,j]=Ue(!1),[E,S]=Ue(0),[X,pe]=Ue(!1),[me,ge]=Ue(!1),O=G(x),U=G({wechat:!1,custom:!1}),ae=G(!1),V=G(!1),De=G(!1),Re=G({identity:H,show:!1}),Ce=G(0),he=G(null),fe=G(null),be=G(null),a=G(null),s=G(K),u=G(Y),h=G(w),$=G(m),oe=G(p),we=G(F);Xe(()=>{s.current=K,u.current=Y,h.current=w,$.current=m,oe.current=p,we.current=F},[m,w,Y,p,K,F]),Xe(()=>{var t;!d||!e||T||(t=u.current)==null||t.call(u,{provider:"wechat",type:"splash",errCode:"BI_SPLASH_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"})},[T,d,e]);let re=t=>{let l=t==="custom"&&c?{configId:c.configId,placementId:c.placementId,configName:c.configName,advertPlatform:c.advertPlatform}:{};return f({provider:t,type:"splash"},l)},N=Ie(()=>{he.current&&clearInterval(he.current),fe.current&&clearTimeout(fe.current),be.current&&clearTimeout(be.current),a.current&&clearTimeout(a.current),he.current=null,fe.current=null,be.current=null,a.current=null},[]),se=Ie((t,l)=>{N(),O.current=t,ae.current=!1,de(t),y(l),j(!1),S(ie),pe(!1),ge(!1)},[N,ie]),Pe=Ie((t,l)=>{var Ve;let Me=M&&(t==="custom"||z&&U.current.wechat&&U.current.custom),Le=Me?"allProvidersFailed":"wechatAdLoadFail";N(),y(!1),j(!1),S(0),pe(!1),ge(!1),(Ve=h.current)==null||Ve.call(h,{provider:Me?"none":t,type:"splash",reason:Le,error:l})},[z,N,M]),_e=Ie(()=>{if(!(he.current||!O.current)){if(pe(!0),ie<=0){S(0);return}S(ie),he.current=setInterval(()=>{S(t=>Math.max(0,t-1))},1e3)}},[ie]),Fe=Ie(()=>{k&&(fe.current=setTimeout(()=>{var l;if(ae.current||O.current!=="custom")return;let t=v(f({},re("custom")),{errorType:"CUSTOM_MEDIA_LOAD_TIMEOUT",errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6",mediaType:Q?"image":"video",rawErrCode:void 0,rawErrMsg:void 0});(l=u.current)==null||l.call(u,t),U.current.custom=!0,z&&!U.current.wechat?(se("wechat",!0),_e()):Pe("custom",t)},Je(c)))},[z,Pe,k,Q,se,c,_e]),Ee=Ie(t=>{se(t,!0),t==="wechat"?_e():k&&Fe()},[k,se,_e,Fe]),Ne=Ie((t,l,_,D)=>{var Ve;if(O.current!=="custom"||U.current.custom)return;let Me=ye(t,re("custom")),Le=v(f({},Me),{errorType:l,errCode:_,errMsg:D,mediaType:Q?"image":"video",rawErrCode:Me.errCode,rawErrMsg:Me.errMsg});(Ve=u.current)==null||Ve.call(u,Le),U.current.custom=!0,z&&!U.current.wechat?Ee("wechat"):Pe("custom",Le)},[z,Pe,Q,Ee]),le=Ie(()=>{var t;if(V.current){y(!1);return}if(!x){se(null,!1),De.current||(De.current=!0,(t=h.current)==null||t.call(h,{provider:"none",type:"splash",reason:"noAd"}));return}Ee(x),x==="custom"&&!k&&Ne(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")},[Ne,k,x,se,Ee]),He=Ie(()=>{if(!d||V.current)return;if(!I){le();return}let t=Ke();if(!(t!=null&&t.getShowSplashAdStatus)||Ce.current>=3){le();return}t.getShowSplashAdStatus({success:l=>{var _;if((l==null?void 0:l.code)===-1){Ce.current+=1,be.current=setTimeout(He,300);return}if((l==null?void 0:l.code)===1){N(),V.current=!0,y(!1),(_=s.current)==null||_.call(s,{provider:"wechat",type:"splash",nativeSplash:!0});return}le()},fail:le})},[le,I,N,d]);Xe(()=>{let t=Re.current,l=d&&!t.show||t.identity!==H;if(Re.current={identity:H,show:d},!d){V.current=!1,De.current=!1,U.current={wechat:!1,custom:!1},se(x,!1);return}if(!V.current)return l&&(De.current=!1),U.current={wechat:!1,custom:!1},V.current=!1,Ce.current=0,se(x,!1),He(),N},[He,N,H,x,se,d]),Xe(()=>{var l;if(!X||E!==0||!b||P||!O.current)return;let t=O.current;if(A){N(),ge(!0),a.current=setTimeout(()=>{var _;j(!0),ge(!1),(_=oe.current)==null||_.call(oe,re(t))},280);return}N(),y(!1),(l=h.current)==null||l.call(h,re(t))},[N,X,A,E,P,b]);let Ze=t=>{var l;O.current==="wechat"&&(_e(),(l=s.current)==null||l.call(s,ye(t,re("wechat"))))},et=t=>{var D;if(O.current!=="wechat"||U.current.wechat)return;let l=t!=null&&t.detail&&typeof t.detail=="object"?t.detail:{},_=v(f({},ye(t,re("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(l.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:l.errCode,rawErrMsg:l.errMsg});(D=u.current)==null||D.call(u,_),U.current.wechat=!0,M&&!U.current.custom?(Ee("custom"),k||Ne(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")):Pe("wechat",_)},Z=()=>{var t;O.current!=="custom"||ae.current||(fe.current&&clearTimeout(fe.current),fe.current=null,ae.current=!0,_e(),(t=s.current)==null||t.call(s,re("custom")))},tt=t=>{var _;(_=t==null?void 0:t.stopPropagation)==null||_.call(t),O.current&&(pe(!0),S(0))},je=()=>{var l;if(O.current!=="custom")return;let t=re("custom");(l=$.current)==null||l.call($,t),We({customAd:c,actionDetail:t,onOpenWebview:_=>{var D;return(D=we.current)==null?void 0:D.call(we,_)},onError:_=>{var D;return(D=u.current)==null?void 0:D.call(u,_)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL",apiRequestErrorCode:"BI_SPLASH_API_REQUEST_FAIL",apiRequestParams:{configId:c==null?void 0:c.configId,equipmentValue:ee,userId:L},preferStandardFields:!0})},i=t=>{var l;N(),y(!1),j(!1),S(0),pe(!1),(l=h.current)==null||l.call(h,t)},o=["bi-splash-ad",P?"bi-splash-ad--pip":"",me?"bi-splash-ad--pip-animating":"",J||""].filter(Boolean).join(" ");return!b||!B?null:Te(W,{className:o,style:{zIndex:g},children:[B==="wechat"&&T?q(W,{className:"bi-splash-ad__popup",children:q(W,{className:`bi-splash-ad__media-wrapper${P?" bi-splash-ad__media-wrapper--pip":""}`,children:q(T,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:Ze,onError:et,onClose:t=>i(ye(t,re("wechat")))})})}):B==="custom"&&k?q(W,{className:"bi-splash-ad__popup bi-splash-ad__custom",children:Te(W,{className:"bi-splash-ad__media-shell",onClick:je,children:[Q?q(yt,{className:"bi-splash-ad__media",src:C,mode:ce==="cover"?"aspectFill":"aspectFit",onLoad:Z,onError:t=>Ne(t,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}):q(Vt,{className:"bi-splash-ad__video",src:C,poster:te,autoplay:!0,muted:(c==null?void 0:c.muted)!==!1,loop:!0,objectFit:ce,showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:Z,onError:t=>Ne(t,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}),P?q(W,{className:"bi-splash-ad__pip-mask"}):null,!P&&!ue.isFullScreen?Te(W,{className:"bi-splash-ad__disclosure",style:ue.disclosureStyle,children:[q(qe,{children:Se}),q(W,{className:"bi-splash-ad__disclosure-arrow"})]}):null,!P&&(c!=null&&c.bottomImage)?q(yt,{className:"bi-splash-ad__bottom-image",src:c.bottomImage,mode:"widthFix"}):null]})}):null,P?q(W,{className:"bi-splash-ad__pip-close",onClick:()=>i(re(B)),children:q(W,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,!P&&ue.isFullScreen&&B==="custom"?Te(W,{className:"bi-splash-ad__combined-control",style:ue.combinedControlStyle,children:[Te(W,{className:"bi-splash-ad__combined-capsule",children:[Te(W,{className:"bi-splash-ad__combined-disclosure",children:[q(qe,{children:Se}),q(W,{className:"bi-splash-ad__disclosure-arrow"})]}),q(W,{className:"bi-splash-ad__combined-divider"}),q(W,{className:"bi-splash-ad__combined-skip",onClick:tt,children:"\u8DF3\u8FC7"})]}),Te(qe,{className:"bi-splash-ad__combined-countdown",children:[E," \u79D2"]})]}):P?null:Te(W,{className:"bi-splash-ad__skip",style:ue.skipStyle,onClick:tt,children:[Te(qe,{children:[E,"s"]}),q(W,{className:"bi-splash-ad__skip-divider"}),q(qe,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};import{useEffect as at,useMemo as Wt,useRef as ne,useState as ot}from"react";import{jsx as Bt}from"react/jsx-runtime";var qt="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",Ht=300*1e3,At=["banner","splash"],jt=({adId:e="",unitId:n,type:r="banner",customAd:d,priority:g="wechat-first",adOptions:A=null,sdkKey:I="biNova",autoLoad:R=!0,adIntervals:ee=30,show:L=!0,zIndex:J=999,pictureInPicture:K=!1,checkNativeSplash:Y=!0,nativeSplashCache:w=!0,jumpSeconds:m=5,equipmentValue:p="",userId:F=0,className:T,onLoad:c,onError:C,onClose:te,onAction:Q,onFeedback:ce,onHide:ie,onOpenWebview:Se,onConfigLoad:ue,onConfigError:z})=>{var je;let M=ne(0),k=ne(""),x=ne(null),H=ne(c),b=ne(C),y=ne(te),B=ne(Q),de=ne(ce),P=ne(ie),j=ne(Se),E=ne(ue),S=ne(z),X=ne(L),[pe,me]=ot(!1),[ge,O]=ot(!1),[U,ae]=ot(null);at(()=>{H.current=c,b.current=C,y.current=te,B.current=Q,de.current=ce,P.current=ie,j.current=Se,E.current=ue,S.current=z,X.current=L},[Q,te,z,ue,C,ce,ie,c,Se,L]);let V=Wt(()=>At.includes(r)?r:"banner",[r]),De=()=>!!(R&&e),Re=()=>{var l;let i=globalThis.getApp,o=typeof i=="function"?i():null;if(!o)return null;let t=o;return t[I]||((l=t.globalData)==null?void 0:l[I])||null},Ce=()=>{var i;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let o=wx.getAccountInfoSync();return((i=o==null?void 0:o.miniProgram)==null?void 0:i.appId)||""}}catch(o){return""}return""},he=(i,o)=>`${qt}_${o||"unknown"}_${i||"empty"}`,fe=(i,o)=>{if(!w||!i||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let t=he(i,o),l=Number(wx.getStorageSync(t)||0),_=Date.now()-l;return l>0&&_>=0&&_<=Ht}catch(t){return!1}},be=()=>{if(w&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let i=he(e,Ce());wx.setStorageSync(i,Date.now())}catch(i){}},a=()=>{M.current+=1,k.current="",me(!1),O(!1),ae(null)},s=()=>{let i=A&&typeof A=="object"?A:{},o=Ce(),t=v(f({},i),{adId:e,placementId:i.placementId||e,appId:i.appId||o,type:V});return Number.isInteger(F)&&F>0?t.userId=F:delete t.userId,t},u=i=>{try{return JSON.stringify(i||{})}catch(o){return`${String(i.appId||"")}_${String(i.placementId||"")}`}},h=i=>{let o=(i==null?void 0:i.unitId)||"",t=(i==null?void 0:i.customAd)||(i==null?void 0:i.custom)||null,l=typeof(i==null?void 0:i.show)=="boolean"?i.show:!!(o||t);return{unitId:o,customAd:t,priority:(i==null?void 0:i.priority)||"wechat-first",show:l}},$=i=>{var o,t;(o=S.current)==null||o.call(S,i),(t=b.current)==null||t.call(b,i)},oe=i=>{var o;(o=y.current)==null||o.call(y,{type:V,adId:e||i.adId||"",provider:"none",reason:"noAd"})},we=async()=>{var _;if(!De())return;let i=s(),o=u(i);if(k.current===o&&(pe||ge))return;let t=Re();if(!(t!=null&&t.ads)||typeof t.ads.getDisplayAdConfig!="function"){a(),$({type:V,adId:e,errCode:"DISPLAY_AD_SDK_NOT_READY",errMsg:"\u672A\u83B7\u53D6\u5230\u53EF\u7528\u7684\u5E7F\u544A\u670D\u52A1 SDK\uFF0C\u8BF7\u5148\u6CE8\u5165\u5168\u5C40 biNova \u5B9E\u4F8B"});return}let l=M.current+1;M.current=l,k.current=o,me(!0),O(!1),ae(null);try{let D=await t.ads.getDisplayAdConfig(i);if(l!==M.current)return;if(!D||D.code!==0||!D.data){me(!1),O(!0),ae(null),$({type:V,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(D==null?void 0:D.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:D||null});return}let Me=h(D.data),Le=!!(X.current&&!Me.show);me(!1),O(!0),ae(D.data),(_=E.current)==null||_.call(E,{type:V,adId:e,requestOptions:i,data:D.data}),Le&&oe(D.data)}catch(D){if(l!==M.current)return;me(!1),O(!0),ae(null),$({type:V,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:D instanceof Error?D.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:D})}};at(()=>{var i;At.includes(r)||(i=b.current)==null||i.call(b,{type:"banner",errCode:"UNSUPPORTED_DISPLAY_AD_TYPE",errMsg:`\u4E0D\u652F\u6301\u7684\u5C55\u793A\u5E7F\u544A\u7C7B\u578B\uFF1A${r}\uFF0C\u8BF7\u4F7F\u7528 "banner" \u6216 "splash"`})},[r]),at(()=>{if(!e){a();return}we()},[e,A,R,V,I,F]);let re=De(),N=re?h(U):null,se=N?N.unitId:n||"",Pe=N?N.customAd:d||null,_e=N?N.priority:g,Fe=!!(L&&(!re||!e||ge&&(N!=null&&N.show))),Ee=Ce(),Ne=JSON.stringify([V,Ee,e,Y,w]),le=x.current;!!(!le||le.identity!==Ne||!le.show&&L)?x.current={identity:Ne,show:L,shouldCheck:!!(Y&&!fe(e,Ee))}:le&&le.show!==L&&(x.current=v(f({},le),{show:L}));let Ze=!!((je=x.current)!=null&&je.shouldCheck),et=e||(U==null?void 0:U.adId)||"",Z=i=>f({adId:et},i);return V==="splash"?Bt(it,f({},{unitId:se,customAd:Pe,priority:_e,show:Fe,zIndex:J,pictureInPicture:K,checkNativeSplash:Ze,jumpSeconds:m,equipmentValue:p,userId:F,className:T,onLoad:o=>{var t;o&&typeof o=="object"&&o.nativeSplash===!0&&be(),(t=H.current)==null||t.call(H,Z(o))},onError:o=>{var t;(t=b.current)==null||t.call(b,Z(o))},onClose:o=>{var t;(t=y.current)==null||t.call(y,Z(o))},onAction:o=>{var t;(t=B.current)==null||t.call(B,Z(o))},onHide:o=>{var t;(t=P.current)==null||t.call(P,Z(o))},onOpenWebview:o=>{var t;(t=j.current)==null||t.call(j,Z(o))}})):Fe?Bt(nt,f({},{unitId:se,customAd:Pe,priority:_e,adIntervals:ee,equipmentValue:p,userId:F,className:T,onLoad:i=>{var o;(o=H.current)==null||o.call(H,Z(i))},onError:i=>{var o;(o=b.current)==null||o.call(b,Z(i))},onClose:i=>{var o;(o=y.current)==null||o.call(y,Z(i))},onAction:i=>{var o;(o=B.current)==null||o.call(B,Z(i))},onFeedback:i=>{var o;(o=de.current)==null||o.call(de,Z(i))},onOpenWebview:i=>{var o;(o=j.current)==null||o.call(j,Z(i))}})):null};export{nt as BiBannerAd,jt as BiDisplayAd,it as BiSplashAd};
1
+ var Mr=Object.defineProperty,Nr=Object.defineProperties;var xr=Object.getOwnPropertyDescriptors;var _r=Object.getOwnPropertySymbols;var Rr=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable;var vr=(e,n,o)=>n in e?Mr(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,u=(e,n)=>{for(var o in n||(n={}))Rr.call(n,o)&&vr(e,o,n[o]);if(_r)for(var o of _r(n))Lr.call(n,o)&&vr(e,o,n[o]);return e},y=(e,n)=>Nr(e,xr(n));import{setQtResolver as mr}from"@bi-nova/core";typeof process!="undefined"&&process.env.TARO_ENV==="weapp"?mr("wechat",async function(){let{QT:n}=await import("@leyaoyao/qt-hook-wechat");return new n}):typeof process!="undefined"&&process.env.TARO_ENV==="alipay"?mr("alipay",async function(){let{QT:n}=await import("@leyaoyao/qt-hook-alipay");return new n}):typeof process!="undefined"&&process.env.TARO_ENV==="h5"&&mr("h5",async function(){let{QT:n}=await import("@leyaoyao/qt-hook-h5");return new n});import"./banner/index.scss";import"./splash/index.scss";import{useCallback as We,useEffect as Xe,useMemo as Jr,useRef as we,useState as ur}from"react";import{Image as Yr,Text as Kr,View as Oe}from"@tarojs/components";import*as Cr from"@tarojs/taro";import*as Or from"@tarojs/components";var Ke;function ir(){if(Ke!==void 0)return Ke;try{let e=Or;Ke=(e==null?void 0:e.AdCustom)||null}catch(e){Ke=null}return Ke}import*as He from"@tarojs/taro";function ar(){return typeof wx!="undefined"?wx:null}function Me(e,n){let o=e==null?void 0:e.detail;return o&&typeof o=="object"?u(u({},n),o):e&&typeof e=="object"?u(u({},n),e):u({},n)}function Sr(e){return e?e.mediaType==="video"?e.video||"":e.mediaType==="image"?e.image||"":e.video||e.image||"":""}function Br(e,n=""){return e&&(e.poster||e.image||n)||""}function wr(e,n=""){return e?e.mediaType==="video"?!1:e.mediaType==="image"?!0:e.video?!1:e.image?!0:/\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(String(n).trim()):!0}function Dr(e){return String((e==null?void 0:e.fitMode)||"").trim().toLowerCase()==="contain"?"contain":"cover"}function sr(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function Tr(e,n=5){let o=e==null?void 0:e.jumpSeconds,l=o!=null?o:n;return Math.min(99,Math.max(0,Number(l)||0))}function cr(e){var o;let n=(o=e==null?void 0:e.loadTimeout)!=null?o:e==null?void 0:e.timeout;return Math.max(1e3,Number(n)||5e3)}function Ur(e,n=!1){var o,l,f,s;if(!e)return"none";if(n){let I=String(((o=e.action)==null?void 0:o.type)||e.jumpType||"").trim().toLowerCase();if(I==="miniprogram")return"miniProgram";if(I==="internal")return"internal";if(I==="web")return"web";if(I==="api")return"api";if(I==="none")return"none"}return n&&((l=e.action)!=null&&l.appId||e.targetAppId)||e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":n&&((f=e.action)!=null&&f.path||e.targetPath)||e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":n&&((s=e.action)!=null&&s.url||e.jumpUrl)||e.url||e.webUrl||e.h5Url?"web":"none"}function Fr(e,n=!1){var o;return e&&((n?((o=e.action)==null?void 0:o.appId)||e.targetAppId:"")||e.appId||e.miniProgramAppId||e.jumpAppId)||""}function Vr(e,n=!1){var o;return e&&((n?((o=e.action)==null?void 0:o.path)||e.targetPath:"")||e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function $r(e,n=!1){var l;if(!e)return"full";let o=(n?(l=e.action)==null?void 0:l.miniProgramOpenMode:"")||e.miniProgramOpenMode;return String(o||"").trim().toLowerCase()==="half"?"half":"full"}function qr(e,n=!1){var o;return e&&((n?((o=e.action)==null?void 0:o.url)||e.jumpUrl:"")||e.url||e.webUrl||e.h5Url)||""}function Hr(e){return e!=null&&e!==""}function Ar(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Wr(e,n){let o=e.indexOf("#"),l=o>=0?e.slice(o):"",f=o>=0?e.slice(0,o):e,s=Object.keys(n).map(q=>`${encodeURIComponent(q)}=${encodeURIComponent(String(n[q]))}`).join("&");if(!s)return e;let I=f.includes("?")?/[?&]$/.test(f)?"":"&":"?";return`${f}${I}${s}${l}`}function jr(e,n){var q;let o=Ar(e==null?void 0:e.data)?e.data:null,l=Ar(o==null?void 0:o.body)?o.body:null,f=String((l==null?void 0:l.appId)||"").trim(),s=String((l==null?void 0:l.url)||"").trim().replace(/^\/+/,"");if(String((o==null?void 0:o.code)||"")!=="200"||!f||!s){(q=n.onError)==null||q.call(n,y(u({},n.actionDetail),{errCode:n.apiRequestErrorCode||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:String((o==null?void 0:o.message)||"\u5E7F\u544A\u63A5\u53E3\u54CD\u5E94\u5F02\u5E38")}));return}ze(y(u({},n),{customAd:{action:{type:"miniProgram",appId:f,path:s,miniProgramOpenMode:"half"}},preferStandardFields:!0}))}function ze(e){let{customAd:n,actionDetail:o,onExternalLaunch:l,onOpenWebview:f,onError:s,miniProgramErrorCode:I,navigateErrorCode:q,miniProgramUnsupportedErrorCode:S,apiRequestErrorCode:H,apiRequestParams:De,preferStandardFields:te=!1}=e;if(!n)return;let k=Ur(n,te),z=Fr(n,te),ce=Vr(n,te),X=qr(n,te);if(k==="miniProgram"&&z){let _=ar(),ge=$r(n,te),F=ge==="half"?_==null?void 0:_.openEmbeddedMiniProgram:_==null?void 0:_.navigateToMiniProgram;if(!_||typeof F!="function"){s==null||s(y(u({},o),{errCode:S||I,errMsg:ge==="half"?"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u534A\u5C4F\u6253\u5F00\u5176\u4ED6\u5C0F\u7A0B\u5E8F":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}l==null||l(y(u({},o),{launchType:"mini_program",status:"triggered"})),F.call(_,{appId:z,path:ce||"",fail:p=>{s==null||s(y(u({},o),{errCode:I,errMsg:(p==null?void 0:p.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(k==="internal"&&ce){He.navigateTo({url:ce,fail:_=>{s==null||s(y(u({},o),{errCode:q,errMsg:(_==null?void 0:_.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}if(k==="web"&&X){f==null||f(y(u({},o),{url:X}));return}if(k==="api"&&X){let _=De||{},F=["configId","equipmentValue","userId"].filter(T=>{let ne=_[T];return T==="userId"?!Number.isInteger(ne)||Number(ne)<=0:!Hr(ne)});if(F.length){s==null||s(y(u({},o),{errCode:H||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:`\u63A5\u53E3\u578B\u5E7F\u544A\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570\u6216\u53C2\u6570\u503C\u65E0\u6548\uFF1A${F.join("\u3001")}`}));return}let p=Wr(X,{configId:_.configId,equipmentValue:_.equipmentValue,userId:_.userId});He.request({url:p,method:"GET",success:T=>{jr(T,e)},fail:T=>{s==null||s(y(u({},o),{errCode:H||"BI_CUSTOM_AD_API_REQUEST_FAIL",errMsg:(T==null?void 0:T.errMsg)||"\u5E7F\u544A\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25"}))}})}}function br(){var X;let e=ar(),n=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},o=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof He.getSystemInfoSync=="function"?He.getSystemInfoSync():{},l=Number(o.windowHeight||0),f=Number(o.screenHeight||0),s=!!(l&&f&&l===f),I=16,q=16,S=16,H=32,De=s&&n.top?n.top:Math.max(I,Number(o.statusBarHeight||0)+4),te=s&&n.height?n.height:H,k=s&&n.top?n.top:I,z=s&&n.height?n.height:H,ce=Math.max(S,Number(((X=o.safeArea)==null?void 0:X.left)||0)+S);return{isFullScreen:s,skipStyle:{top:`${k}px`,width:"156rpx",height:`${z}px`,lineHeight:`${z}px`,borderRadius:`${Math.round(z/2)}px`,left:s?`${S}px`:void 0,right:s?void 0:`${q}px`},disclosureStyle:{top:`${k}px`,left:`${ce}px`,height:`${z}px`,lineHeight:`${z}px`},combinedControlStyle:{top:`${De}px`,left:`${ce}px`,height:`${te}px`}}}import{getRegisteredAdvertTracker as Qr}from"@bi-nova/core";function Gr(e="biNova"){var s;let n=globalThis.getApp,l=typeof n=="function"?n():null,f=(l==null?void 0:l[e])||((s=l==null?void 0:l.globalData)==null?void 0:s[e]);return(f==null?void 0:f.tracking)||Qr()}function lr(e){let n=e.tracker||Gr(e.sdkKey);if(!n)return!1;let o=n.resolvePage(e.pageId),l=y(u({key:e.key,featureId:e.featureId||"advert_product_slot"},e.moduleId?{moduleId:e.moduleId}:{}),{pageId:o.pageId,pageIdSource:o.pageIdSource,pageUrl:o.pageUrl,attr:u(y(u({},e.attr||{}),{displayId:e.displayId}),e.placementId?{placementId:e.placementId}:{})});return n.track(l),!0}import{Fragment as Zr,jsx as Ne,jsxs as gr}from"react/jsx-runtime";var zr=[{label:"\u4E0E\u6211\u65E0\u5173",value:"irrelevant"},{label:"\u91CD\u590D\u6536\u5230\u591A\u6B21",value:"repeated"},{label:"\u5185\u5BB9\u592A\u5DEE",value:"poorContent"}];function Xr(e,n,o){return e&&n?o==="custom-first"||o==="custom-only"?"custom":"wechat":e?"wechat":n?"custom":null}var fr=({pageId:e,moduleId:n,placementId:o,sdkKey:l="biNova",tracker:f,unitId:s="",customAd:I,priority:q="wechat-first",adIntervals:S=30,equipmentValue:H="",userId:De=0,className:te,onLoad:k,onError:z,onClose:ce,onAction:X,onFeedback:_,onOpenWebview:ge})=>{let F=Jr(()=>ir(),[]),p=I||null,T=!!(p!=null&&p.image),ne=!!(s&&F),W=Xr(ne,T,q),d=JSON.stringify([s,p,q,!!F]),[Z,Ie]=ur(!!W),[oe,Te]=ur(W),[Ae,xe]=ur(!1),[fe,ie]=ur("primary"),x=we(W),b=we({wechat:!1,custom:!1}),v=we(!1),R=we(null),V=we(k),D=we(z),C=we(ce),le=we(X),E=we(_),ue=we(ge),ke=we(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),ae=we(new Set),B=We((i,c={},m=!1)=>{if(m&&ae.current.has(i))return;let w=lr({key:i,pageId:e,moduleId:n,placementId:o,sdkKey:l,tracker:f,displayId:ke.current,attr:c});m&&w&&ae.current.add(i)},[n,e,o,l,f]);Xe(()=>{V.current=k,D.current=z,C.current=ce,le.current=X,E.current=_,ue.current=ge},[X,ce,z,_,k,ge]),Xe(()=>{ke.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,ae.current.clear()},[d]);let P=We(i=>{let c=i==="custom"&&p?{configId:p.configId,placementId:p.placementId,configName:p.configName,advertPlatform:p.advertPlatform}:{};return u({provider:i,type:"banner"},c)},[p]),j=We(()=>{R.current&&(clearTimeout(R.current),R.current=null)},[]),O=We(()=>{xe(!1),ie("primary")},[]),U=We(i=>{let c=x.current;c&&c!==i&&B("advert_slot_fallback",{fallbackType:"channel",fromChannel:c,toChannel:i,resultCode:"provider_load_fail"}),j(),x.current=i,v.current=!1,Te(i),Ie(!0),O()},[j,O,B]),M=We((i,c)=>{var K;let w=!!s&&T?"allProvidersFailed":i==="wechat"?"wechatAdLoadFail":"customMediaLoadFail";j(),x.current=null,Te(null),Ie(!1),O(),B("advert_slot_close",{closeType:w,provider:i},!0),(K=C.current)==null||K.call(C,{provider:i,type:"banner",reason:w,error:c})},[j,O,T,B,s]),ye=We((i,c,m,w)=>{var g;if(x.current!=="custom"||b.current.custom)return;j();let K=Me(i,P("custom")),he=y(u({},K),{errorType:c,errCode:m,errMsg:w,mediaType:"image",rawErrCode:K.errCode,rawErrMsg:K.errMsg});if(b.current.custom=!0,B("advert_slot_error",{errorLayer:"render",errorType:he.errCode,provider:"custom"}),(g=D.current)==null||g.call(D,he),ne&&!b.current.wechat){U("wechat");return}M("custom",he)},[ne,j,P,M,U]);Xe(()=>(j(),b.current={wechat:!1,custom:!1},v.current=!1,x.current=W,Te(W),Ie(!!W),O(),j),[j,O,d,W]),Xe(()=>{if(j(),!(!Z||oe!=="custom"||!T))return R.current=setTimeout(()=>{v.current||x.current!=="custom"||ye(void 0,"CUSTOM_MEDIA_LOAD_TIMEOUT","BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6")},cr(p)),j},[j,ye,T,oe,p,Z]),Xe(()=>{var c,m;if(!s||F)return;let i=y(u({},P("wechat")),{errCode:"BI_BANNER_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"});B("advert_slot_error",{errorLayer:"render",errorType:i.errCode,provider:"wechat"}),(c=D.current)==null||c.call(D,i),T||(B("advert_slot_close",{closeType:"wechatAdLoadFail",provider:"wechat"},!0),(m=C.current)==null||m.call(C,y(u({},P("wechat")),{reason:"wechatAdLoadFail",error:i})))},[F,P,T,B,s]);let de=i=>{var c;x.current==="wechat"&&(B("advert_slot_render",{displayMode:"banner",provider:"wechat"},!0),B("advert_slot_exposure",{displayMode:"banner",provider:"wechat",exposureMethod:"onLoad"},!0),(c=V.current)==null||c.call(V,Me(i,P("wechat"))))},Q=i=>{var w;if(x.current!=="wechat"||b.current.wechat)return;let c=i!=null&&i.detail&&typeof i.detail=="object"?i.detail:{},m=y(u({},Me(i,P("wechat"))),{errCode:"BI_BANNER_WECHAT_AD_LOAD_FAIL",errMsg:String(c.errMsg||"\u5FAE\u4FE1 Banner \u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:c.errCode,rawErrMsg:c.errMsg});if(B("advert_slot_error",{errorLayer:"render",errorType:m.errCode,provider:"wechat"}),b.current.wechat=!0,(w=D.current)==null||w.call(D,m),T&&!b.current.custom){U("custom");return}M("wechat",m)},Fe=i=>{var c;x.current==="wechat"&&(B("advert_slot_close",{closeType:"close",provider:"wechat"},!0),(c=C.current)==null||c.call(C,Me(i,P("wechat"))))},Se=()=>{var i;x.current!=="custom"||v.current||(j(),v.current=!0,B("advert_slot_render",{displayMode:"banner",provider:"custom"},!0),B("advert_slot_exposure",{displayMode:"banner",provider:"custom",exposureMethod:"onLoad"},!0),(i=V.current)==null||i.call(V,P("custom")))},Ee=()=>{var c;if(Ae){O();return}let i=P("custom");B("product_ui_action",{actionType:"primary_click",provider:"custom"}),(c=le.current)==null||c.call(le,i),ze({customAd:p,actionDetail:i,onExternalLaunch:m=>{B("product_external_launch",{launchType:m.launchType,status:m.status,provider:"custom"})},onOpenWebview:m=>{var w;B("product_external_launch",{launchType:"h5",status:"triggered",provider:"custom"}),(w=ue.current)==null||w.call(ue,m)},onError:m=>{var w;B("advert_slot_error",{errorLayer:"action",errorType:m.errCode,provider:"custom"}),(w=D.current)==null||w.call(D,m)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL",apiRequestErrorCode:"BI_BANNER_API_REQUEST_FAIL",apiRequestParams:{configId:p==null?void 0:p.configId,equipmentValue:H,userId:De},preferStandardFields:!0})},pe=i=>{var c;(c=i.stopPropagation)==null||c.call(i),xe(m=>!m),ie("primary")},Pe=i=>{var c;(c=i.stopPropagation)==null||c.call(i)},Re=i=>{var c,m;(c=i.stopPropagation)==null||c.call(i),O(),(m=E.current)==null||m.call(E,y(u({},P("custom")),{provider:"custom",action:"report"})),B("product_feedback",{actionType:"report",provider:"custom"}),Cr.showToast({title:"\u5DF2\u6536\u5230\u60A8\u7684\u53CD\u9988\uFF0C\u6211\u4EEC\u4F1A\u5C3D\u5FEB\u5904\u7406~",icon:"none",duration:2e3})},me=(i,c)=>{var w,K,he;(w=i.stopPropagation)==null||w.call(i);let m=y(u({},P("custom")),{provider:"custom",action:"dislike",reason:c.value,reasonText:c.label});j(),x.current=null,Te(null),Ie(!1),O(),(K=E.current)==null||K.call(E,m),B("product_feedback",{actionType:"dislike",reason:c.value,provider:"custom"}),B("advert_slot_close",{closeType:"notInterested",provider:"custom"},!0),(he=C.current)==null||he.call(C,y(u({},P("custom")),{reason:"notInterested",feedbackReason:c.value,feedbackReasonText:c.label}))},L=`bi-banner-ad${te?` ${te}`:""}`;return!Z||!oe?null:oe==="wechat"&&F?Ne(F,{className:L,unitId:s,adIntervals:S,onLoad:de,onError:Q,onClose:Fe}):oe!=="custom"||!(p!=null&&p.image)?null:gr(Oe,{className:L,children:[Ne(Oe,{className:"bi-banner-ad__surface",onClick:Ee,children:Ne(Yr,{className:"bi-banner-ad__image",src:p.image,mode:"widthFix",onLoad:Se,onError:i=>ye(i,"CUSTOM_MEDIA_LOAD_FAIL","BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")})}),gr(Oe,{className:"bi-banner-ad__badge",onClick:pe,children:[Ne(Kr,{children:sr(p)}),Ne(Oe,{className:"bi-banner-ad__badge-arrow"})]}),Ae?Ne(Oe,{className:"bi-banner-ad__feedback-panel",onClick:Pe,children:fe==="primary"?gr(Zr,{children:[Ne(Oe,{className:"bi-banner-ad__feedback-source",children:"\u7531\u8D5E\u52A9\u5546\u63D0\u4F9B\u7684\u5185\u5BB9"}),Ne(Oe,{className:"bi-banner-ad__feedback-item",onClick:i=>{var c;(c=i.stopPropagation)==null||c.call(i),ie("dislike")},children:"\u4E0D\u611F\u5174\u8DA3"}),Ne(Oe,{className:"bi-banner-ad__feedback-item",onClick:Re,children:"\u53CD\u9988\u95EE\u9898"})]}):zr.map(i=>Ne(Oe,{className:"bi-banner-ad__feedback-item",onClick:c=>me(c,i),children:i.label},i.value))}):null]})};import{useCallback as Ce,useEffect as Ze,useMemo as qe,useRef as $,useState as Qe}from"react";import{Image as Ir,Text as er,Video as et,View as J}from"@tarojs/components";import{jsx as Y,jsxs as Ue}from"react/jsx-runtime";function rt(e,n,o){return e&&n?o==="custom-first"||o==="custom-only"?"custom":"wechat":e?"wechat":n?"custom":null}var yr=({pageId:e,moduleId:n,placementId:o,sdkKey:l="biNova",tracker:f,unitId:s="",customAd:I,priority:q="wechat-first",show:S=!0,zIndex:H=999,pictureInPicture:De=!1,checkNativeSplash:te=!0,jumpSeconds:k=5,equipmentValue:z="",userId:ce=0,className:X,onLoad:_,onError:ge,onClose:F,onAction:p,onHide:T,onOpenWebview:ne})=>{let W=qe(()=>ir(),[]),d=I||null,Z=qe(()=>Sr(d),[d]),Ie=qe(()=>Br(d,Z),[Z,d]),oe=qe(()=>wr(d,Z),[Z,d]),Te=qe(()=>Dr(d),[d]),Ae=qe(()=>Tr(d,k),[k,d]),xe=qe(()=>sr(d),[d]),fe=qe(()=>br(),[]),ie=!!(s&&W),x=!!(Z||d!=null&&d.mediaType),b=!!Z,v=rt(ie,x,q),R=JSON.stringify([s,d,q,!!W]),[V,D]=Qe(!1),[C,le]=Qe(v),[E,ue]=Qe(!1),[ke,ae]=Qe(0),[B,P]=Qe(!1),[j,O]=Qe(!1),U=$(v),M=$({wechat:!1,custom:!1}),ye=$(!1),de=$(!1),Q=$(!1),Fe=$({identity:R,show:!1}),Se=$(0),Ee=$(null),pe=$(null),Pe=$(null),Re=$(null),me=$(_),L=$(ge),i=$(F),c=$(p),m=$(T),w=$(ne),K=$(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),he=$(new Set),g=Ce((r,t={},a=!1)=>{if(a&&he.current.has(r))return;let A=lr({key:r,pageId:e,moduleId:n,placementId:o,sdkKey:l,tracker:f,displayId:K.current,attr:t});a&&A&&he.current.add(r)},[n,e,o,l,f]);Ze(()=>{me.current=_,L.current=ge,i.current=F,c.current=p,m.current=T,w.current=ne},[p,F,ge,T,_,ne]),Ze(()=>{K.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,he.current.clear()},[R]),Ze(()=>{var r;!S||!s||W||(g("advert_slot_error",{errorLayer:"render",errorType:"BI_SPLASH_NATIVE_AD_UNSUPPORTED",provider:"wechat"}),(r=L.current)==null||r.call(L,{provider:"wechat",type:"splash",errCode:"BI_SPLASH_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"}))},[W,S,g,s]);let _e=r=>{let t=r==="custom"&&d?{configId:d.configId,placementId:d.placementId,configName:d.configName,advertPlatform:d.advertPlatform}:{};return u({provider:r,type:"splash"},t)},N=Ce(()=>{Ee.current&&clearInterval(Ee.current),pe.current&&clearTimeout(pe.current),Pe.current&&clearTimeout(Pe.current),Re.current&&clearTimeout(Re.current),Ee.current=null,pe.current=null,Pe.current=null,Re.current=null},[]),ve=Ce((r,t)=>{N(),U.current=r,ye.current=!1,le(r),D(t),ue(!1),ae(Ae),P(!1),O(!1)},[N,Ae]),ee=Ce((r,t)=>{!r||r===t||g("advert_slot_fallback",{fallbackType:"channel",fromChannel:r,toChannel:t,resultCode:"provider_load_fail"})},[g]),Ve=Ce((r,t)=>{var be;let G=x&&(r==="custom"||ie&&M.current.wechat&&M.current.custom),h=G?"allProvidersFailed":"wechatAdLoadFail";N(),D(!1),ue(!1),ae(0),P(!1),O(!1),g("advert_slot_close",{closeType:h,provider:G?"none":r},!0),(be=i.current)==null||be.call(i,{provider:G?"none":r,type:"splash",reason:h,error:t})},[ie,N,x,g]),Le=Ce(()=>{if(!(Ee.current||!U.current)){if(P(!0),Ae<=0){ae(0);return}ae(Ae),Ee.current=setInterval(()=>{ae(r=>Math.max(0,r-1))},1e3)}},[Ae]),Ge=Ce(()=>{b&&(pe.current=setTimeout(()=>{var t;if(ye.current||U.current!=="custom")return;let r=y(u({},_e("custom")),{errorType:"CUSTOM_MEDIA_LOAD_TIMEOUT",errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6",mediaType:oe?"image":"video",rawErrCode:void 0,rawErrMsg:void 0});g("advert_slot_error",{errorLayer:"render",errorType:r.errCode,provider:"custom"}),(t=L.current)==null||t.call(L,r),M.current.custom=!0,ie&&!M.current.wechat?(ee("custom","wechat"),ve("wechat",!0),Le()):Ve("custom",r)},cr(d)))},[ie,Ve,b,oe,ve,d,Le,g,ee]),$e=Ce(r=>{ee(U.current,r),ve(r,!0),r==="wechat"?Le():b&&Ge()},[b,ve,Le,Ge,ee]),Be=Ce((r,t,a,A)=>{var be;if(U.current!=="custom"||M.current.custom)return;let G=Me(r,_e("custom")),h=y(u({},G),{errorType:t,errCode:a,errMsg:A,mediaType:oe?"image":"video",rawErrCode:G.errCode,rawErrMsg:G.errMsg});g("advert_slot_error",{errorLayer:"render",errorType:h.errCode,provider:"custom"}),(be=L.current)==null||be.call(L,h),M.current.custom=!0,ie&&!M.current.wechat?$e("wechat"):Ve("custom",h)},[ie,Ve,oe,$e,g]),je=Ce(()=>{var r;if(de.current){D(!1);return}if(!v){ve(null,!1),Q.current||(Q.current=!0,g("advert_slot_close",{closeType:"noAd",provider:"none"},!0),(r=i.current)==null||r.call(i,{provider:"none",type:"splash",reason:"noAd"}));return}$e(v),v==="custom"&&!b&&Be(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")},[Be,b,v,ve,$e,g]),Je=Ce(()=>{if(!S||de.current)return;if(!te){je();return}let r=ar();if(!(r!=null&&r.getShowSplashAdStatus)||Se.current>=3){je();return}r.getShowSplashAdStatus({success:t=>{var a;if((t==null?void 0:t.code)===-1){Se.current+=1,Pe.current=setTimeout(Je,300);return}if((t==null?void 0:t.code)===1){N(),de.current=!0,D(!1),g("advert_slot_render",{displayMode:"splash",provider:"wechat",nativeSplash:!0},!0),g("advert_slot_exposure",{displayMode:"splash",provider:"wechat",exposureMethod:"nativeSplash"},!0),(a=me.current)==null||a.call(me,{provider:"wechat",type:"splash",nativeSplash:!0});return}je()},fail:je})},[je,te,N,S,g]);Ze(()=>{let r=Fe.current,t=S&&!r.show||r.identity!==R;if(Fe.current={identity:R,show:S},!S){de.current=!1,Q.current=!1,M.current={wechat:!1,custom:!1},ve(v,!1);return}if(!de.current)return t&&(Q.current=!1,K.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,he.current.clear(),U.current=null),M.current={wechat:!1,custom:!1},de.current=!1,Se.current=0,ve(v,!1),Je(),N},[Je,N,R,v,ve,S]),Ze(()=>{var t;if(!B||ke!==0||!V||E||!U.current)return;let r=U.current;if(De){N(),O(!0),Re.current=setTimeout(()=>{var a;ue(!0),O(!1),g("advert_slot_hide",{displayMode:"splash",provider:r}),(a=m.current)==null||a.call(m,_e(r))},280);return}N(),D(!1),g("advert_slot_close",{closeType:"close",provider:r},!0),(t=i.current)==null||t.call(i,_e(r))},[N,B,De,ke,E,g,V]);let rr=r=>{var t;U.current==="wechat"&&(Le(),g("advert_slot_render",{displayMode:"splash",provider:"wechat"},!0),g("advert_slot_exposure",{displayMode:"splash",provider:"wechat",exposureMethod:"onLoad"},!0),(t=me.current)==null||t.call(me,Me(r,_e("wechat"))))},pr=r=>{var A;if(U.current!=="wechat"||M.current.wechat)return;let t=r!=null&&r.detail&&typeof r.detail=="object"?r.detail:{},a=y(u({},Me(r,_e("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(t.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:t.errCode,rawErrMsg:t.errMsg});g("advert_slot_error",{errorLayer:"render",errorType:a.errCode,provider:"wechat"}),(A=L.current)==null||A.call(L,a),M.current.wechat=!0,x&&!M.current.custom?($e("custom"),b||Be(void 0,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u4E3B\u7D20\u6750\u5730\u5740\u4E3A\u7A7A")):Ve("wechat",a)},se=()=>{var r;U.current!=="custom"||ye.current||(pe.current&&clearTimeout(pe.current),pe.current=null,ye.current=!0,Le(),g("advert_slot_render",{displayMode:"splash",provider:"custom"},!0),g("advert_slot_exposure",{displayMode:"splash",provider:"custom",exposureMethod:"onLoad"},!0),(r=me.current)==null||r.call(me,_e("custom")))},tr=r=>{var a;(a=r==null?void 0:r.stopPropagation)==null||a.call(r),U.current&&(P(!0),ae(0))},nr=()=>{var t;if(U.current!=="custom")return;let r=_e("custom");g("product_ui_action",{actionType:"primary_click",provider:"custom"}),(t=c.current)==null||t.call(c,r),ze({customAd:d,actionDetail:r,onExternalLaunch:a=>{g("product_external_launch",{launchType:a.launchType,status:a.status,provider:"custom"})},onOpenWebview:a=>{var A;g("product_external_launch",{launchType:"h5",status:"triggered",provider:"custom"}),(A=w.current)==null||A.call(w,a)},onError:a=>{var A;g("advert_slot_error",{errorLayer:"action",errorType:a.errCode,provider:"custom"}),(A=L.current)==null||A.call(L,a)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL",apiRequestErrorCode:"BI_SPLASH_API_REQUEST_FAIL",apiRequestParams:{configId:d==null?void 0:d.configId,equipmentValue:z,userId:ce},preferStandardFields:!0})},Ye=r=>{var t;N(),D(!1),ue(!1),ae(0),P(!1),g("advert_slot_close",{closeType:(r==null?void 0:r.reason)||"close",provider:(r==null?void 0:r.provider)||"custom"},!0),(t=i.current)==null||t.call(i,r)},or=["bi-splash-ad",E?"bi-splash-ad--pip":"",j?"bi-splash-ad--pip-animating":"",X||""].filter(Boolean).join(" ");return!V||!C?null:Ue(J,{className:or,style:{zIndex:H},children:[C==="wechat"&&W?Y(J,{className:"bi-splash-ad__popup",children:Y(J,{className:`bi-splash-ad__media-wrapper${E?" bi-splash-ad__media-wrapper--pip":""}`,children:Y(W,{className:"bi-splash-ad__wechat-unit",unitId:s,onLoad:rr,onError:pr,onClose:r=>Ye(Me(r,_e("wechat")))})})}):C==="custom"&&b?Y(J,{className:"bi-splash-ad__popup bi-splash-ad__custom",children:Ue(J,{className:"bi-splash-ad__media-shell",onClick:nr,children:[oe?Y(Ir,{className:"bi-splash-ad__media",src:Z,mode:Te==="cover"?"aspectFill":"aspectFit",onLoad:se,onError:r=>Be(r,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}):Y(et,{className:"bi-splash-ad__video",src:Z,poster:Ie,autoplay:!0,muted:(d==null?void 0:d.muted)!==!1,loop:!0,objectFit:Te,showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:se,onError:r=>Be(r,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}),E?Y(J,{className:"bi-splash-ad__pip-mask"}):null,!E&&!fe.isFullScreen?Ue(J,{className:"bi-splash-ad__disclosure",style:fe.disclosureStyle,children:[Y(er,{children:xe}),Y(J,{className:"bi-splash-ad__disclosure-arrow"})]}):null,!E&&(d!=null&&d.bottomImage)?Y(Ir,{className:"bi-splash-ad__bottom-image",src:d.bottomImage,mode:"widthFix"}):null]})}):null,E?Y(J,{className:"bi-splash-ad__pip-close",onClick:()=>Ye(_e(C)),children:Y(J,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,!E&&fe.isFullScreen&&C==="custom"?Ue(J,{className:"bi-splash-ad__combined-control",style:fe.combinedControlStyle,children:[Ue(J,{className:"bi-splash-ad__combined-capsule",children:[Ue(J,{className:"bi-splash-ad__combined-disclosure",children:[Y(er,{children:xe}),Y(J,{className:"bi-splash-ad__disclosure-arrow"})]}),Y(J,{className:"bi-splash-ad__combined-divider"}),Y(J,{className:"bi-splash-ad__combined-skip",onClick:tr,children:"\u8DF3\u8FC7"})]}),Ue(er,{className:"bi-splash-ad__combined-countdown",children:[ke," \u79D2"]})]}):E?null:Ue(J,{className:"bi-splash-ad__skip",style:fe.skipStyle,onClick:tr,children:[Ue(er,{children:[ke,"s"]}),Y(J,{className:"bi-splash-ad__skip-divider"}),Y(er,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};import{useEffect as dr,useMemo as tt,useRef as re,useState as hr}from"react";import{getRegisteredAdvertTracker as nt}from"@bi-nova/core";import{jsx as Er}from"react/jsx-runtime";var ot="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",it=300*1e3;function at(e,n){var s,I;let o={},l=typeof(e==null?void 0:e.provider)=="string"?e.provider:"",f=(s=e==null?void 0:e.configId)!=null?s:n==null?void 0:n.configId;if(l&&(o.provider=l),(typeof f=="string"||typeof f=="number")&&(o.configId=f),l==="custom"&&n){let S=String(((I=n.action)==null?void 0:I.type)||n.jumpType||"").trim().toLowerCase(),H=S==="miniprogram"?"miniProgram":["internal","web","api","none"].includes(S)?S:"";H&&(o.jumpType=H)}return o}var kr=["banner","splash"],st=({adId:e="",pageId:n,moduleId:o,placementId:l,unitId:f,type:s="banner",customAd:I,priority:q="wechat-first",adOptions:S=null,sdkKey:H="biNova",autoLoad:De=!0,adIntervals:te=30,show:k=!0,zIndex:z=999,pictureInPicture:ce=!1,checkNativeSplash:X=!0,nativeSplashCache:_=!0,jumpSeconds:ge=5,equipmentValue:F="",userId:p=0,className:T,onLoad:ne,onError:W,onClose:d,onAction:Z,onFeedback:Ie,onHide:oe,onOpenWebview:Te,onConfigLoad:Ae,onConfigError:xe})=>{var nr,Ye,or;let fe=re(0),ie=re(""),x=re(null),b=re(ne),v=re(W),R=re(d),V=re(Z),D=re(Ie),C=re(oe),le=re(Te),E=re(Ae),ue=re(xe),ke=re(k),ae=re(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),B=re(new Set),P=re(!1),[j,O]=hr(!1),[U,M]=hr(!1),[ye,de]=hr(null);dr(()=>{b.current=ne,v.current=W,R.current=d,V.current=Z,D.current=Ie,C.current=oe,le.current=Te,E.current=Ae,ue.current=xe,ke.current=k},[Z,d,xe,Ae,W,Ie,oe,ne,Te,k]);let Q=tt(()=>kr.includes(s)?s:"banner",[s]),Fe=l||(S&&typeof S.placementId=="string"?S.placementId:"")||e,Se=(r,t,a={})=>{let A=pe(),G=(A==null?void 0:A.tracking)||nt();if(!G)return;let h=G.resolvePage(n);h.pageId==="page_unknown"&&!P.current&&(P.current=!0,G.track(y(u({key:"advert_slot_error",featureId:"advert_product_slot"},o?{moduleId:o}:{}),{pageId:h.pageId,pageIdSource:h.pageIdSource,pageUrl:h.pageUrl,attr:{errorLayer:"tracking",errorType:"page_not_resolved"}}))),G.track(y(u({key:r,featureId:t},o?{moduleId:o}:{}),{pageId:h.pageId,pageIdSource:h.pageIdSource,pageUrl:h.pageUrl,attr:y(u({},a),{displayId:ae.current,placementId:Fe})}))},Ee=()=>!!(De&&e),pe=()=>{var A;let r=globalThis.getApp,t=typeof r=="function"?r():null;if(!t)return null;let a=t;return a[H]||((A=a.globalData)==null?void 0:A[H])||null},Pe=()=>{var r;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let t=wx.getAccountInfoSync();return((r=t==null?void 0:t.miniProgram)==null?void 0:r.appId)||""}}catch(t){return""}return""},Re=(r,t)=>`${ot}_${t||"unknown"}_${r||"empty"}`,me=(r,t)=>{if(!_||!r||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let a=Re(r,t),A=Number(wx.getStorageSync(a)||0),G=Date.now()-A;return A>0&&G>=0&&G<=it}catch(a){return!1}},L=()=>{if(_&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let r=Re(e,Pe());wx.setStorageSync(r,Date.now())}catch(r){}},i=()=>{fe.current+=1,ie.current="",O(!1),M(!1),de(null)},c=()=>{let r=S&&typeof S=="object"?S:{},t=Pe(),a=y(u(u(y(u({},r),{adId:e,placementId:l||r.placementId||e,appId:r.appId||t,type:Q}),n?{pageId:n}:{}),o?{moduleId:o}:{}),{trackingSource:"ui"});return Number.isInteger(p)&&p>0?a.userId=p:delete a.userId,a},m=r=>{try{return JSON.stringify(r||{})}catch(t){return`${String(r.appId||"")}_${String(r.placementId||"")}`}},w=r=>{let t=(r==null?void 0:r.unitId)||"",a=(r==null?void 0:r.customAd)||(r==null?void 0:r.custom)||null,A=typeof(r==null?void 0:r.show)=="boolean"?r.show:!!(t||a);return{unitId:t,customAd:a,priority:(r==null?void 0:r.priority)||"wechat-first",show:A}},K=r=>{var t,a;(t=ue.current)==null||t.call(ue,r),(a=v.current)==null||a.call(v,r)},he=r=>{var a;let t=`${ae.current}:advert_slot_close`;B.current.has(t)||(B.current.add(t),Se("advert_slot_close","advert_product_slot",{closeType:"noAd",provider:"none"})),(a=R.current)==null||a.call(R,{type:Q,adId:e||r.adId||"",provider:"none",reason:"noAd"})},g=async()=>{var G;if(!Ee())return;let r=c(),t=m(r);if(ie.current===t&&(j||U))return;Se("advert_slot_config_request","advert_product_slot",{sceneCode:Q,requestType:"remote_config"});let a=pe();if(!(a!=null&&a.ads)||typeof a.ads.getDisplayAdConfig!="function"){i(),K({type:Q,adId:e,errCode:"DISPLAY_AD_SDK_NOT_READY",errMsg:"\u672A\u83B7\u53D6\u5230\u53EF\u7528\u7684\u5E7F\u544A\u670D\u52A1 SDK\uFF0C\u8BF7\u5148\u6CE8\u5165\u5168\u5C40 biNova \u5B9E\u4F8B"}),Se("advert_slot_error","advert_product_slot",{errorLayer:"config",errorType:"sdk_not_ready"});return}let A=fe.current+1;fe.current=A,ie.current=t,O(!0),M(!1),de(null);try{let h=await a.ads.getDisplayAdConfig(r);if(A!==fe.current)return;if(!h||h.code!==0||!h.data){O(!1),M(!0),de(null),K({type:Q,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(h==null?void 0:h.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:h||null}),Se("advert_slot_config_decision","advert_product_slot",{status:"no_config",errorType:"remote_config_fail"});return}let be=w(h.data),Pr=!!(ke.current&&!be.show);O(!1),M(!0),de(h.data),(G=E.current)==null||G.call(E,{type:Q,adId:e,requestOptions:r,data:h.data}),Se("advert_slot_config_decision","advert_product_slot",u({status:be.show?"selected":"no_config"},at({provider:be.customAd?"custom":be.unitId?"wechat":"none"},be.customAd))),Pr&&he(h.data)}catch(h){if(A!==fe.current)return;O(!1),M(!0),de(null),K({type:Q,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:h instanceof Error?h.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:h}),Se("advert_slot_error","advert_product_slot",{errorLayer:"config",errorType:"remote_config_exception"})}};dr(()=>{var r;kr.includes(s)||(r=v.current)==null||r.call(v,{type:"banner",errCode:"UNSUPPORTED_DISPLAY_AD_TYPE",errMsg:`\u4E0D\u652F\u6301\u7684\u5C55\u793A\u5E7F\u544A\u7C7B\u578B\uFF1A${s}\uFF0C\u8BF7\u4F7F\u7528 "banner" \u6216 "splash"`})},[s]),dr(()=>{if(!e){i();return}g()},[e,S,De,Q,H,p]);let _e=Ee(),N=_e?w(ye):null,ve=N?N.unitId:f||"",ee=N?N.customAd:I||null,Ve=N?N.priority:q,Le=!!(k&&(!_e||!e||U&&(N!=null&&N.show))),Ge=Pe(),$e=JSON.stringify([Q,Ge,e,X,_]),Be=x.current;!!(!Be||Be.identity!==$e||!Be.show&&k)?x.current={identity:$e,show:k,shouldCheck:!!(X&&!me(e,Ge))}:Be&&Be.show!==k&&(x.current=y(u({},Be),{show:k}));let Je=!!((nr=x.current)!=null&&nr.shouldCheck),rr=e||(ye==null?void 0:ye.adId)||"",pr=JSON.stringify([rr,Q,ve,ee==null?void 0:ee.configId,ee==null?void 0:ee.image,ee==null?void 0:ee.video]);dr(()=>{ae.current=`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,B.current.clear(),P.current=!1},[pr]);let se=r=>u({adId:rr},r);if(Q==="splash"){let r={pageId:n,moduleId:o,placementId:Fe,sdkKey:H,tracker:(Ye=pe())==null?void 0:Ye.tracking,unitId:ve,customAd:ee,priority:Ve,show:Le,zIndex:z,pictureInPicture:ce,checkNativeSplash:Je,jumpSeconds:ge,equipmentValue:F,userId:p,className:T,onLoad:t=>{var a;t&&typeof t=="object"&&t.nativeSplash===!0&&L(),(a=b.current)==null||a.call(b,se(t))},onError:t=>{var a;(a=v.current)==null||a.call(v,se(t))},onClose:t=>{var a;(a=R.current)==null||a.call(R,se(t))},onAction:t=>{var a;(a=V.current)==null||a.call(V,se(t))},onHide:t=>{var a;(a=C.current)==null||a.call(C,se(t))},onOpenWebview:t=>{var a;(a=le.current)==null||a.call(le,se(t))}};return Er(yr,u({},r))}if(!Le)return null;let tr={pageId:n,moduleId:o,placementId:Fe,sdkKey:H,tracker:(or=pe())==null?void 0:or.tracking,unitId:ve,customAd:ee,priority:Ve,adIntervals:te,equipmentValue:F,userId:p,className:T,onLoad:r=>{var t;(t=b.current)==null||t.call(b,se(r))},onError:r=>{var t;(t=v.current)==null||t.call(v,se(r))},onClose:r=>{var t;(t=R.current)==null||t.call(R,se(r))},onAction:r=>{var t;(t=V.current)==null||t.call(V,se(r))},onFeedback:r=>{var t;(t=D.current)==null||t.call(D,se(r))},onOpenWebview:r=>{var t;(t=le.current)==null||t.call(le,se(r))}};return Er(fr,u({},tr))};export{fr as BiBannerAd,st as BiDisplayAd,yr as BiSplashAd};
@@ -0,0 +1,100 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * @Description Taro 支付宝碰一碰组件(微信原生组件薄包装)
5
+ * @Author: wutao
6
+ * @Date: 2026-10-21
7
+ * @LastEditors: wutao
8
+ * @LastEditTime: 2026-10-21
9
+ */
10
+
11
+ /** 碰一碰组件事件公共上下文 */
12
+ interface BiAlipayTouchEventContext {
13
+ /** 取号通道 */
14
+ mode: 'internal' | 'external';
15
+ /** 当前微信小程序 appId */
16
+ appid: string;
17
+ /** 插件广告位/场景编码 */
18
+ spaceCode: string;
19
+ /** 展示方式 */
20
+ displayMode: 'inline' | 'offscreen';
21
+ /** 宿主账户/登录周期标识 */
22
+ contextKey: string;
23
+ }
24
+ /** 取号就绪事件数据 */
25
+ interface BiAlipayTouchReadyDetail extends BiAlipayTouchEventContext {
26
+ }
27
+ /** 号码不可用事件数据 */
28
+ interface BiAlipayTouchUnavailableDetail extends BiAlipayTouchEventContext {
29
+ /** 不可用原因,后台未返回详细原因时不伪造 */
30
+ reason: 'notAvailable';
31
+ }
32
+ /** 插件成功事件数据,不承诺支付或奖励发放成功 */
33
+ interface BiAlipayTouchSuccessDetail extends BiAlipayTouchEventContext {
34
+ stage: 'plugin';
35
+ code: string | number;
36
+ message: string;
37
+ }
38
+ /** 组件错误事件数据 */
39
+ interface BiAlipayTouchErrorDetail extends BiAlipayTouchEventContext {
40
+ /** 错误阶段:配置 / 取号 / 插件 */
41
+ stage: 'config' | 'resolve' | 'plugin';
42
+ /** 错误码,SDK 错误码与插件错误码分域 */
43
+ code: string | number;
44
+ message: string;
45
+ }
46
+ /** external 模式身份参数,appid 可显式传入但必须与当前宿主一致 */
47
+ interface BiAlipayTouchRequestOptions {
48
+ /** 第三方平台标识 */
49
+ thirdPlatform: string;
50
+ /** 第三方平台用户 ID */
51
+ thirdPlatformUserId: string;
52
+ /** 用户在当前 appid 下的 openid */
53
+ openid: string;
54
+ /** 可选手机号,非空时为 11 位数字 */
55
+ phone?: string;
56
+ /** 显式声明的宿主 appId,与运行时不一致时组件直接报配置错误 */
57
+ appid?: string;
58
+ }
59
+ /**
60
+ * Taro 碰一碰组件属性,与原生组件 bi-alipay-touch 对齐。
61
+ *
62
+ * 事件统一为 onX(detail) 形式;包装层只渲染已注册的原生标签并映射事件,
63
+ * 不重复发取号请求。使用稳定 props 与 contextKey 避免重渲染导致组件重建。
64
+ */
65
+ interface BiAlipayTouchProps {
66
+ /** 插件广告位/场景编码,必填 */
67
+ spaceCode: string;
68
+ /** 取号通道,默认 internal */
69
+ mode?: 'internal' | 'external';
70
+ /** external 模式身份参数 */
71
+ requestOptions?: BiAlipayTouchRequestOptions | null;
72
+ /** 展示方式,默认 offscreen */
73
+ displayMode?: 'inline' | 'offscreen';
74
+ /** 是否允许挂载插件,默认 true */
75
+ show?: boolean;
76
+ /** 是否自动取号,默认 true;异步登录场景置 false 后通过原生实例 load() 手动取号 */
77
+ autoLoad?: boolean;
78
+ /** 全局 SDK 实例挂载键,默认 biNova */
79
+ sdkKey?: string;
80
+ /** 宿主账户/登录周期标识 */
81
+ contextKey?: string;
82
+ onReady?: (detail: BiAlipayTouchReadyDetail) => void;
83
+ onUnavailable?: (detail: BiAlipayTouchUnavailableDetail) => void;
84
+ onSuccess?: (detail: BiAlipayTouchSuccessDetail) => void;
85
+ onError?: (detail: BiAlipayTouchErrorDetail) => void;
86
+ }
87
+ /**
88
+ * Taro 支付宝碰一碰组件。
89
+ *
90
+ * 宿主需要:
91
+ * 1. 将 `@bi-nova/ui-weapp` 的 `src/alipay-touch` 原生目录复制到构建目标,
92
+ * 并在页面 usingComponents 注册 `bi-alipay-touch`;
93
+ * 2. 在小程序根目录提供 `exportToPlugin.js` 插件导出并声明 `ad-plugin` 插件;
94
+ * 3. 在 `app` / `app.globalData` 上挂载已安装 services 插件的 nova 实例。
95
+ *
96
+ * 详见 `@bi-nova/ui-weapp/alipay-touch` 组件文档。
97
+ */
98
+ declare const BiAlipayTouch: React.FC<BiAlipayTouchProps>;
99
+
100
+ export { BiAlipayTouch, type BiAlipayTouchErrorDetail, type BiAlipayTouchEventContext, type BiAlipayTouchProps, type BiAlipayTouchReadyDetail, type BiAlipayTouchRequestOptions, type BiAlipayTouchSuccessDetail, type BiAlipayTouchUnavailableDetail };
@@ -0,0 +1,100 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * @Description Taro 支付宝碰一碰组件(微信原生组件薄包装)
5
+ * @Author: wutao
6
+ * @Date: 2026-10-21
7
+ * @LastEditors: wutao
8
+ * @LastEditTime: 2026-10-21
9
+ */
10
+
11
+ /** 碰一碰组件事件公共上下文 */
12
+ interface BiAlipayTouchEventContext {
13
+ /** 取号通道 */
14
+ mode: 'internal' | 'external';
15
+ /** 当前微信小程序 appId */
16
+ appid: string;
17
+ /** 插件广告位/场景编码 */
18
+ spaceCode: string;
19
+ /** 展示方式 */
20
+ displayMode: 'inline' | 'offscreen';
21
+ /** 宿主账户/登录周期标识 */
22
+ contextKey: string;
23
+ }
24
+ /** 取号就绪事件数据 */
25
+ interface BiAlipayTouchReadyDetail extends BiAlipayTouchEventContext {
26
+ }
27
+ /** 号码不可用事件数据 */
28
+ interface BiAlipayTouchUnavailableDetail extends BiAlipayTouchEventContext {
29
+ /** 不可用原因,后台未返回详细原因时不伪造 */
30
+ reason: 'notAvailable';
31
+ }
32
+ /** 插件成功事件数据,不承诺支付或奖励发放成功 */
33
+ interface BiAlipayTouchSuccessDetail extends BiAlipayTouchEventContext {
34
+ stage: 'plugin';
35
+ code: string | number;
36
+ message: string;
37
+ }
38
+ /** 组件错误事件数据 */
39
+ interface BiAlipayTouchErrorDetail extends BiAlipayTouchEventContext {
40
+ /** 错误阶段:配置 / 取号 / 插件 */
41
+ stage: 'config' | 'resolve' | 'plugin';
42
+ /** 错误码,SDK 错误码与插件错误码分域 */
43
+ code: string | number;
44
+ message: string;
45
+ }
46
+ /** external 模式身份参数,appid 可显式传入但必须与当前宿主一致 */
47
+ interface BiAlipayTouchRequestOptions {
48
+ /** 第三方平台标识 */
49
+ thirdPlatform: string;
50
+ /** 第三方平台用户 ID */
51
+ thirdPlatformUserId: string;
52
+ /** 用户在当前 appid 下的 openid */
53
+ openid: string;
54
+ /** 可选手机号,非空时为 11 位数字 */
55
+ phone?: string;
56
+ /** 显式声明的宿主 appId,与运行时不一致时组件直接报配置错误 */
57
+ appid?: string;
58
+ }
59
+ /**
60
+ * Taro 碰一碰组件属性,与原生组件 bi-alipay-touch 对齐。
61
+ *
62
+ * 事件统一为 onX(detail) 形式;包装层只渲染已注册的原生标签并映射事件,
63
+ * 不重复发取号请求。使用稳定 props 与 contextKey 避免重渲染导致组件重建。
64
+ */
65
+ interface BiAlipayTouchProps {
66
+ /** 插件广告位/场景编码,必填 */
67
+ spaceCode: string;
68
+ /** 取号通道,默认 internal */
69
+ mode?: 'internal' | 'external';
70
+ /** external 模式身份参数 */
71
+ requestOptions?: BiAlipayTouchRequestOptions | null;
72
+ /** 展示方式,默认 offscreen */
73
+ displayMode?: 'inline' | 'offscreen';
74
+ /** 是否允许挂载插件,默认 true */
75
+ show?: boolean;
76
+ /** 是否自动取号,默认 true;异步登录场景置 false 后通过原生实例 load() 手动取号 */
77
+ autoLoad?: boolean;
78
+ /** 全局 SDK 实例挂载键,默认 biNova */
79
+ sdkKey?: string;
80
+ /** 宿主账户/登录周期标识 */
81
+ contextKey?: string;
82
+ onReady?: (detail: BiAlipayTouchReadyDetail) => void;
83
+ onUnavailable?: (detail: BiAlipayTouchUnavailableDetail) => void;
84
+ onSuccess?: (detail: BiAlipayTouchSuccessDetail) => void;
85
+ onError?: (detail: BiAlipayTouchErrorDetail) => void;
86
+ }
87
+ /**
88
+ * Taro 支付宝碰一碰组件。
89
+ *
90
+ * 宿主需要:
91
+ * 1. 将 `@bi-nova/ui-weapp` 的 `src/alipay-touch` 原生目录复制到构建目标,
92
+ * 并在页面 usingComponents 注册 `bi-alipay-touch`;
93
+ * 2. 在小程序根目录提供 `exportToPlugin.js` 插件导出并声明 `ad-plugin` 插件;
94
+ * 3. 在 `app` / `app.globalData` 上挂载已安装 services 插件的 nova 实例。
95
+ *
96
+ * 详见 `@bi-nova/ui-weapp/alipay-touch` 组件文档。
97
+ */
98
+ declare const BiAlipayTouch: React.FC<BiAlipayTouchProps>;
99
+
100
+ export { BiAlipayTouch, type BiAlipayTouchErrorDetail, type BiAlipayTouchEventContext, type BiAlipayTouchProps, type BiAlipayTouchReadyDetail, type BiAlipayTouchRequestOptions, type BiAlipayTouchSuccessDetail, type BiAlipayTouchUnavailableDetail };
@@ -0,0 +1 @@
1
+ "use strict";var P=Object.create;var d=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},E=(e,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of C(t))!O.call(e,a)&&a!==r&&d(e,a,{get:()=>t[a],enumerable:!(l=w(t,a))||l.enumerable});return e};var D=(e,t,r)=>(r=e!=null?P(N(e)):{},E(t||!e||!e.__esModule?d(r,"default",{value:e,enumerable:!0}):r,e)),_=e=>E(d({},"__esModule",{value:!0}),e);var V={};k(V,{BiAlipayTouch:()=>U});module.exports=_(V);var n=D(require("react")),x=D(require("@tarojs/taro"));function R(){try{if(typeof process!="undefined"&&process.env.TARO_ENV)return process.env.TARO_ENV==="weapp"}catch(e){}return x.default.getEnv()===x.default.ENV_TYPE.WEAPP}function T(e){let t=e==null?void 0:e.detail;return t&&typeof t=="object"?t:{}}var U=({spaceCode:e,mode:t="internal",requestOptions:r=null,displayMode:l="offscreen",show:a=!0,autoLoad:m=!0,sdkKey:b="biNova",contextKey:y="",onReady:f,onUnavailable:g,onSuccess:A,onError:h})=>{let s=(0,n.useRef)(f),u=(0,n.useRef)(g),p=(0,n.useRef)(A),c=(0,n.useRef)(h);(0,n.useEffect)(()=>{s.current=f,u.current=g,p.current=A,c.current=h},[f,g,A,h]);let B=R(),v=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{var o;B||v.current||(v.current=!0,(o=c.current)==null||o.call(c,{mode:t,appid:"",spaceCode:e||"",displayMode:l,contextKey:y||"",stage:"config",code:"ALIPAY_TOUCH_UNSUPPORTED_ENV",message:"\u5F53\u524D Taro \u76EE\u6807\u5E73\u53F0\u4E0D\u652F\u6301\u78B0\u4E00\u78B0\u7EC4\u4EF6\uFF0C\u4EC5\u652F\u6301\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F"}))},[B,t,e,l,y]),B?n.default.createElement("bi-alipay-touch",{spaceCode:e,mode:t,requestOptions:r,displayMode:l,show:a,autoLoad:m,sdkKey:b,contextKey:y,onReady:o=>{var i;(i=s.current)==null||i.call(s,T(o))},onUnavailable:o=>{var i;(i=u.current)==null||i.call(u,T(o))},onSuccess:o=>{var i;(i=p.current)==null||i.call(p,T(o))},onError:o=>{var i;(i=c.current)==null||i.call(c,T(o))}}):null};0&&(module.exports={BiAlipayTouch});
@@ -0,0 +1 @@
1
+ import m,{useEffect as h,useRef as o}from"react";import B from"@tarojs/taro";function b(){try{if(typeof process!="undefined"&&process.env.TARO_ENV)return process.env.TARO_ENV==="weapp"}catch(i){}return B.getEnv()===B.ENV_TYPE.WEAPP}function s(i){let n=i==null?void 0:i.detail;return n&&typeof n=="object"?n:{}}var C=({spaceCode:i,mode:n="internal",requestOptions:x=null,displayMode:u="offscreen",show:v=!0,autoLoad:E=!0,sdkKey:D="biNova",contextKey:p="",onReady:d,onUnavailable:T,onSuccess:y,onError:f})=>{let a=o(d),c=o(T),l=o(y),r=o(f);h(()=>{a.current=d,c.current=T,l.current=y,r.current=f},[d,T,y,f]);let g=b(),A=o(!1);return h(()=>{var t;g||A.current||(A.current=!0,(t=r.current)==null||t.call(r,{mode:n,appid:"",spaceCode:i||"",displayMode:u,contextKey:p||"",stage:"config",code:"ALIPAY_TOUCH_UNSUPPORTED_ENV",message:"\u5F53\u524D Taro \u76EE\u6807\u5E73\u53F0\u4E0D\u652F\u6301\u78B0\u4E00\u78B0\u7EC4\u4EF6\uFF0C\u4EC5\u652F\u6301\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F"}))},[g,n,i,u,p]),g?m.createElement("bi-alipay-touch",{spaceCode:i,mode:n,requestOptions:x,displayMode:u,show:v,autoLoad:E,sdkKey:D,contextKey:p,onReady:t=>{var e;(e=a.current)==null||e.call(a,s(t))},onUnavailable:t=>{var e;(e=c.current)==null||e.call(c,s(t))},onSuccess:t=>{var e;(e=l.current)==null||e.call(l,s(t))},onError:t=>{var e;(e=r.current)==null||e.call(r,s(t))}}):null};export{C as BiAlipayTouch};
package/dist/index.d.mts CHANGED
@@ -1,8 +1,12 @@
1
1
  import { FC } from 'react';
2
2
  import { BiAdCardProps as BiAdCardProps$1 } from '@bi-nova/ui';
3
+ import { A as AdvertTrackerLike } from './tracking-gZKFD2A6.mjs';
4
+ import '@bi-nova/core';
3
5
 
4
6
  interface BiAdCardProps extends BiAdCardProps$1 {
5
7
  className?: string;
8
+ sdkKey?: string;
9
+ tracker?: AdvertTrackerLike | null;
6
10
  }
7
11
  declare const BiAdCard: FC<BiAdCardProps>;
8
12
 
package/dist/index.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  import { FC } from 'react';
2
2
  import { BiAdCardProps as BiAdCardProps$1 } from '@bi-nova/ui';
3
+ import { A as AdvertTrackerLike } from './tracking-gZKFD2A6.js';
4
+ import '@bi-nova/core';
3
5
 
4
6
  interface BiAdCardProps extends BiAdCardProps$1 {
5
7
  className?: string;
8
+ sdkKey?: string;
9
+ tracker?: AdvertTrackerLike | null;
6
10
  }
7
11
  declare const BiAdCard: FC<BiAdCardProps>;
8
12
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var C=(d,a)=>{for(var o in a)s(d,o,{get:a[o],enumerable:!0})},_=(d,a,o,t)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of B(a))!n.call(d,e)&&e!==o&&s(d,e,{get:()=>a[e],enumerable:!(t=l(a,e))||t.enumerable});return d};var A=d=>_(s({},"__esModule",{value:!0}),d);var b={};C(b,{BiAdCard:()=>m});module.exports=A(b);var r=require("@tarojs/components"),x=require("./styles/ad-card.scss"),i=require("react/jsx-runtime"),m=({image:d,title:a="\u5E7F\u544A",description:o,buttonText:t="\u7ACB\u5373\u67E5\u770B",onClose:e,onAction:p,className:c})=>(0,i.jsxs)(r.View,{className:`bi-ad-card${c?` ${c}`:""}`,children:[(0,i.jsx)(r.Button,{className:"bi-ad-card__close","aria-label":"\u5173\u95ED",onClick:e,children:"\xD7"}),(0,i.jsx)(r.Image,{className:"bi-ad-card__image",src:d,mode:"aspectFill"}),(0,i.jsxs)(r.View,{className:"bi-ad-card__content",children:[(0,i.jsx)(r.Text,{className:"bi-ad-card__description",children:o}),(0,i.jsx)(r.Button,{className:"bi-ad-card__button",onClick:p,children:t})]})]});0&&(module.exports={BiAdCard});
1
+ "use strict";var P=Object.create;var o=Object.defineProperty,V=Object.defineProperties,F=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols,S=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var B=(e,r,t)=>r in e?o(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,i=(e,r)=>{for(var t in r||(r={}))N.call(r,t)&&B(e,t,r[t]);if(b)for(var t of b(r))$.call(r,t)&&B(e,t,r[t]);return e},m=(e,r)=>V(e,O(r));var D=(e,r)=>{for(var t in r)o(e,t,{get:r[t],enumerable:!0})},x=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let d of M(r))!N.call(e,d)&&d!==t&&o(e,d,{get:()=>r[d],enumerable:!(a=F(r,d))||a.enumerable});return e};var y=(e,r,t)=>(t=e!=null?P(S(e)):{},x(r||!e||!e.__esModule?o(t,"default",{value:e,enumerable:!0}):t,e)),U=e=>x(o({},"__esModule",{value:!0}),e);var H={};D(H,{BiAdCard:()=>C});module.exports=U(H);var u=require("@bi-nova/core");typeof process!="undefined"&&process.env.TARO_ENV==="weapp"?(0,u.setQtResolver)("wechat",async function(){let{QT:r}=await import("@leyaoyao/qt-hook-wechat");return new r}):typeof process!="undefined"&&process.env.TARO_ENV==="alipay"?(0,u.setQtResolver)("alipay",async function(){let{QT:r}=await import("@leyaoyao/qt-hook-alipay");return new r}):typeof process!="undefined"&&process.env.TARO_ENV==="h5"&&(0,u.setQtResolver)("h5",async function(){let{QT:r}=await import("@leyaoyao/qt-hook-h5");return new r});var p=require("react"),n=require("@tarojs/components");var R=require("@bi-nova/core");function G(e="biNova"){var s;let r=globalThis.getApp,a=typeof r=="function"?r():null,d=(a==null?void 0:a[e])||((s=a==null?void 0:a.globalData)==null?void 0:s[e]);return(d==null?void 0:d.tracking)||(0,R.getRegisteredAdvertTracker)()}function h(e){let r=e.tracker||G(e.sdkKey);if(!r)return!1;let t=r.resolvePage(e.pageId),a=m(i({key:e.key,featureId:e.featureId||"advert_product_slot"},e.moduleId?{moduleId:e.moduleId}:{}),{pageId:t.pageId,pageIdSource:t.pageIdSource,pageUrl:t.pageUrl,attr:i(m(i({},e.attr||{}),{displayId:e.displayId}),e.placementId?{placementId:e.placementId}:{})});return r.track(a),!0}var X=require("./styles/ad-card.scss");var c=require("react/jsx-runtime"),C=({image:e,title:r="\u5E7F\u544A",description:t,buttonText:a="\u7ACB\u5373\u67E5\u770B",pageId:d,moduleId:s,placementId:v,sdkKey:_="biNova",tracker:A,onClose:g,onAction:k,className:T})=>{let Q=(0,p.useRef)(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),I=(0,p.useRef)(new Set),l=(0,p.useCallback)((f,E={},w=!1)=>{if(w&&I.current.has(f))return;let L=h({key:f,featureId:"advert_legacy_display",pageId:d,moduleId:s,placementId:v,sdkKey:_,tracker:A,displayId:Q.current,attr:i({legacy:!0},E)});w&&L&&I.current.add(f)},[s,d,v,_,A]);return(0,c.jsxs)(n.View,{className:`bi-ad-card${T?` ${T}`:""}`,children:[(0,c.jsx)(n.Button,{className:"bi-ad-card__close","aria-label":"\u5173\u95ED",onClick:()=>{l("advert_slot_close",{actionType:"close"},!0),g==null||g()},children:"\xD7"}),(0,c.jsx)(n.Image,{className:"bi-ad-card__image",src:e,mode:"aspectFill",onLoad:()=>{l("advert_slot_render",{displayMode:"card",provider:"custom"},!0),l("advert_slot_exposure",{displayMode:"card",exposureMethod:"onLoad"},!0)}}),(0,c.jsxs)(n.View,{className:"bi-ad-card__content",children:[(0,c.jsx)(n.Text,{className:"bi-ad-card__description",children:t}),(0,c.jsx)(n.Button,{className:"bi-ad-card__button",onClick:()=>{l("product_ui_action",{actionType:"primary_click"}),k==null||k()},children:a})]})]})};0&&(module.exports={BiAdCard});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{View as d,Image as p,Button as i,Text as l}from"@tarojs/components";import"./styles/ad-card.scss";import{jsx as a,jsxs as e}from"react/jsx-runtime";var B=({image:o,title:n="\u5E7F\u544A",description:t,buttonText:s="\u7ACB\u5373\u67E5\u770B",onClose:c,onAction:m,className:r})=>e(d,{className:`bi-ad-card${r?` ${r}`:""}`,children:[a(i,{className:"bi-ad-card__close","aria-label":"\u5173\u95ED",onClick:c,children:"\xD7"}),a(p,{className:"bi-ad-card__image",src:o,mode:"aspectFill"}),e(d,{className:"bi-ad-card__content",children:[a(l,{className:"bi-ad-card__description",children:t}),a(i,{className:"bi-ad-card__button",onClick:m,children:s})]})]});export{B as BiAdCard};
1
+ var C=Object.defineProperty,Q=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var T=(e,r,t)=>r in e?C(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,n=(e,r)=>{for(var t in r||(r={}))L.call(r,t)&&T(e,t,r[t]);if(A)for(var t of A(r))P.call(r,t)&&T(e,t,r[t]);return e},u=(e,r)=>Q(e,E(r));import{setQtResolver as g}from"@bi-nova/core";typeof process!="undefined"&&process.env.TARO_ENV==="weapp"?g("wechat",async function(){let{QT:r}=await import("@leyaoyao/qt-hook-wechat");return new r}):typeof process!="undefined"&&process.env.TARO_ENV==="alipay"?g("alipay",async function(){let{QT:r}=await import("@leyaoyao/qt-hook-alipay");return new r}):typeof process!="undefined"&&process.env.TARO_ENV==="h5"&&g("h5",async function(){let{QT:r}=await import("@leyaoyao/qt-hook-h5");return new r});import{useCallback as O,useRef as w}from"react";import{View as b,Image as M,Button as B,Text as S}from"@tarojs/components";import{getRegisteredAdvertTracker as V}from"@bi-nova/core";function F(e="biNova"){var c;let r=globalThis.getApp,a=typeof r=="function"?r():null,d=(a==null?void 0:a[e])||((c=a==null?void 0:a.globalData)==null?void 0:c[e]);return(d==null?void 0:d.tracking)||V()}function I(e){let r=e.tracker||F(e.sdkKey);if(!r)return!1;let t=r.resolvePage(e.pageId),a=u(n({key:e.key,featureId:e.featureId||"advert_product_slot"},e.moduleId?{moduleId:e.moduleId}:{}),{pageId:t.pageId,pageIdSource:t.pageIdSource,pageUrl:t.pageUrl,attr:n(u(n({},e.attr||{}),{displayId:e.displayId}),e.placementId?{placementId:e.placementId}:{})});return r.track(a),!0}import"./styles/ad-card.scss";import{jsx as s,jsxs as N}from"react/jsx-runtime";var $=({image:e,title:r="\u5E7F\u544A",description:t,buttonText:a="\u7ACB\u5373\u67E5\u770B",pageId:d,moduleId:c,placementId:k,sdkKey:f="biNova",tracker:m,onClose:o,onAction:p,className:y})=>{let x=w(`display_${Date.now()}_${Math.random().toString(36).slice(2,10)}`),v=w(new Set),i=O((l,R={},_=!1)=>{if(_&&v.current.has(l))return;let h=I({key:l,featureId:"advert_legacy_display",pageId:d,moduleId:c,placementId:k,sdkKey:f,tracker:m,displayId:x.current,attr:n({legacy:!0},R)});_&&h&&v.current.add(l)},[c,d,k,f,m]);return N(b,{className:`bi-ad-card${y?` ${y}`:""}`,children:[s(B,{className:"bi-ad-card__close","aria-label":"\u5173\u95ED",onClick:()=>{i("advert_slot_close",{actionType:"close"},!0),o==null||o()},children:"\xD7"}),s(M,{className:"bi-ad-card__image",src:e,mode:"aspectFill",onLoad:()=>{i("advert_slot_render",{displayMode:"card",provider:"custom"},!0),i("advert_slot_exposure",{displayMode:"card",exposureMethod:"onLoad"},!0)}}),N(b,{className:"bi-ad-card__content",children:[s(S,{className:"bi-ad-card__description",children:t}),s(B,{className:"bi-ad-card__button",onClick:()=>{i("product_ui_action",{actionType:"primary_click"}),p==null||p()},children:a})]})]})};export{$ as BiAdCard};
@@ -0,0 +1,5 @@
1
+ import { AdvertTracker } from '@bi-nova/core';
2
+
3
+ type AdvertTrackerLike = Pick<AdvertTracker, 'track' | 'resolvePage'>;
4
+
5
+ export type { AdvertTrackerLike as A };
@@ -0,0 +1,5 @@
1
+ import { AdvertTracker } from '@bi-nova/core';
2
+
3
+ type AdvertTrackerLike = Pick<AdvertTracker, 'track' | 'resolvePage'>;
4
+
5
+ export type { AdvertTrackerLike as A };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bi-nova/ui-taro",
3
- "version": "1.3.2",
3
+ "version": "1.4.0-beta.202610221551",
4
4
  "description": "BI Nova SDK Taro React UI",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -15,6 +15,11 @@
15
15
  "types": "./dist/ad/index.d.ts",
16
16
  "import": "./dist/ad/index.mjs",
17
17
  "require": "./dist/ad/index.js"
18
+ },
19
+ "./alipay-touch": {
20
+ "types": "./dist/alipay-touch/index.d.ts",
21
+ "import": "./dist/alipay-touch/index.mjs",
22
+ "require": "./dist/alipay-touch/index.js"
18
23
  }
19
24
  },
20
25
  "files": [
@@ -23,14 +28,23 @@
23
28
  "peerDependencies": {
24
29
  "@tarojs/components": ">=3.6.0",
25
30
  "@tarojs/taro": ">=3.6.0",
26
- "react": ">=18.0.0"
31
+ "react": ">=18.0.0",
32
+ "@bi-nova/ui-weapp": ">=1.2.2"
33
+ },
34
+ "peerDependenciesMeta": {
35
+ "@bi-nova/ui-weapp": {
36
+ "optional": true
37
+ }
27
38
  },
28
39
  "devDependencies": {
29
40
  "@types/react": "^18.0.0"
30
41
  },
31
42
  "dependencies": {
32
- "@bi-nova/core": "1.0.1",
33
- "@bi-nova/ui": "1.0.0"
43
+ "@bi-nova/core": "^2.0.0-beta.202610221551",
44
+ "@bi-nova/ui": "^2.0.0-beta.202610221551",
45
+ "@leyaoyao/qt-hook-alipay": "1.0.3",
46
+ "@leyaoyao/qt-hook-h5": "1.0.5",
47
+ "@leyaoyao/qt-hook-wechat": "1.0.3"
34
48
  },
35
49
  "license": "ISC",
36
50
  "publishConfig": {