@bi-nova/ui-taro 1.2.5 → 1.3.0-beta.202608171048
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.
- package/dist/ad/banner/index.scss +61 -95
- package/dist/ad/index.d.mts +71 -34
- package/dist/ad/index.d.ts +71 -34
- package/dist/ad/index.js +1 -1
- package/dist/ad/index.mjs +1 -1
- package/dist/ad/splash/index.scss +109 -118
- package/package.json +3 -3
|
@@ -1,132 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* @Description Taro Banner 广告样式
|
|
3
3
|
* @Author wutao
|
|
4
4
|
* @Date 2026-04-14
|
|
5
5
|
* @LastEditors wutao
|
|
6
|
-
* @LastEditTime 2026-
|
|
6
|
+
* @LastEditTime 2026-08-13 16:18:21
|
|
7
7
|
*/
|
|
8
8
|
.bi-banner-ad {
|
|
9
9
|
position: relative;
|
|
10
|
-
display: flex;
|
|
11
10
|
width: 100%;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
overflow: hidden;
|
|
11
|
+
border-radius: 16rpx;
|
|
12
|
+
overflow: visible;
|
|
15
13
|
background: #ffffff;
|
|
16
|
-
box-shadow: 0
|
|
14
|
+
box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.08);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
.bi-banner-ad__surface {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
min-width: 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.bi-banner-ad__media {
|
|
26
|
-
position: relative;
|
|
27
|
-
flex: 0 0 240rpx;
|
|
28
|
-
height: 180rpx;
|
|
18
|
+
width: 100%;
|
|
19
|
+
border-radius: inherit;
|
|
29
20
|
overflow: hidden;
|
|
30
21
|
}
|
|
31
22
|
|
|
32
23
|
.bi-banner-ad__image {
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 100%;
|
|
35
24
|
display: block;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: auto;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
29
|
.bi-banner-ad__badge {
|
|
39
|
-
display: inline-flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
min-width: 72rpx;
|
|
43
|
-
height: 38rpx;
|
|
44
|
-
padding: 0 12rpx;
|
|
45
|
-
border-radius: 19rpx;
|
|
46
|
-
background: rgba(0, 0, 0, 0.52);
|
|
47
|
-
color: #ffffff;
|
|
48
|
-
font-size: 20rpx;
|
|
49
|
-
line-height: 38rpx;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.bi-banner-ad__badge--overlay {
|
|
53
30
|
position: absolute;
|
|
54
|
-
top:
|
|
55
|
-
left:
|
|
56
|
-
z-index:
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.bi-banner-ad__content {
|
|
31
|
+
top: 8rpx;
|
|
32
|
+
left: 8rpx;
|
|
33
|
+
z-index: 4;
|
|
60
34
|
display: flex;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
justify-content: space-between;
|
|
65
|
-
padding: 24rpx 28rpx;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
66
37
|
box-sizing: border-box;
|
|
38
|
+
min-width: 70rpx;
|
|
39
|
+
height: 30rpx;
|
|
40
|
+
padding: 0 8rpx;
|
|
41
|
+
border-radius: 4rpx;
|
|
42
|
+
background: rgba(0, 0, 0, 0.3);
|
|
43
|
+
color: #ffffff;
|
|
44
|
+
font-size: 18rpx;
|
|
45
|
+
line-height: 30rpx;
|
|
67
46
|
}
|
|
68
47
|
|
|
69
|
-
.bi-banner-
|
|
70
|
-
|
|
71
|
-
|
|
48
|
+
.bi-banner-ad__badge-arrow {
|
|
49
|
+
width: 8rpx;
|
|
50
|
+
height: 8rpx;
|
|
51
|
+
margin: -4rpx 0 0 8rpx;
|
|
52
|
+
border-right: 2rpx solid rgba(255, 255, 255, 0.9);
|
|
53
|
+
border-bottom: 2rpx solid rgba(255, 255, 255, 0.9);
|
|
54
|
+
transform: rotate(45deg);
|
|
72
55
|
}
|
|
73
56
|
|
|
74
|
-
.bi-banner-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
57
|
+
.bi-banner-ad__feedback-panel {
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 42rpx;
|
|
60
|
+
left: 8rpx;
|
|
61
|
+
z-index: 3;
|
|
62
|
+
width: 220rpx;
|
|
63
|
+
border: 1rpx solid #eeeeee;
|
|
64
|
+
border-radius: 8rpx;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
background: #ffffff;
|
|
67
|
+
box-shadow: 0 8rpx 24rpx rgba(15, 23, 42, 0.16);
|
|
80
68
|
}
|
|
81
69
|
|
|
82
|
-
.bi-banner-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
.bi-banner-ad__feedback-source {
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
min-height: 54rpx;
|
|
73
|
+
padding: 12rpx 16rpx;
|
|
74
|
+
border-bottom: 1rpx solid #eeeeee;
|
|
75
|
+
color: #333333;
|
|
76
|
+
font-size: 18rpx;
|
|
77
|
+
line-height: 30rpx;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
text-align: center;
|
|
88
80
|
}
|
|
89
81
|
|
|
90
|
-
.bi-banner-
|
|
91
|
-
display:
|
|
82
|
+
.bi-banner-ad__feedback-item {
|
|
83
|
+
display: flex;
|
|
92
84
|
align-items: center;
|
|
93
85
|
justify-content: center;
|
|
94
|
-
|
|
95
|
-
min-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
background: linear-gradient(135deg, #1677ff, #38bdf8);
|
|
102
|
-
color: #ffffff;
|
|
103
|
-
font-size: 24rpx;
|
|
104
|
-
line-height: 64rpx;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.bi-banner-ad__button::after {
|
|
108
|
-
display: none;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.bi-banner-ad__close {
|
|
112
|
-
position: absolute;
|
|
113
|
-
top: 12rpx;
|
|
114
|
-
right: 12rpx;
|
|
115
|
-
z-index: 3;
|
|
116
|
-
width: 44rpx;
|
|
117
|
-
height: 44rpx;
|
|
118
|
-
min-height: 0;
|
|
119
|
-
padding: 0;
|
|
120
|
-
border: none;
|
|
121
|
-
border-radius: 50%;
|
|
122
|
-
background: rgba(15, 23, 42, 0.45);
|
|
123
|
-
color: #ffffff;
|
|
124
|
-
font-size: 28rpx;
|
|
125
|
-
line-height: 44rpx;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
min-height: 54rpx;
|
|
88
|
+
padding: 10rpx 16rpx;
|
|
89
|
+
border-bottom: 1rpx solid #eeeeee;
|
|
90
|
+
color: #4d6385;
|
|
91
|
+
font-size: 18rpx;
|
|
92
|
+
line-height: 32rpx;
|
|
126
93
|
text-align: center;
|
|
127
94
|
}
|
|
128
95
|
|
|
129
|
-
.bi-banner-
|
|
130
|
-
|
|
96
|
+
.bi-banner-ad__feedback-item:last-child {
|
|
97
|
+
border-bottom: none;
|
|
131
98
|
}
|
|
132
|
-
|
package/dist/ad/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
* @Author wutao
|
|
6
6
|
* @Date 2026-04-14
|
|
7
7
|
* @LastEditors wutao
|
|
8
|
-
* @LastEditTime 2026-
|
|
8
|
+
* @LastEditTime 2026-08-14 16:39:49
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* 广告提供方类型
|
|
@@ -15,6 +15,36 @@ type BiAdProvider = 'wechat' | 'custom';
|
|
|
15
15
|
* 广告展示类型
|
|
16
16
|
*/
|
|
17
17
|
type BiAdType = 'banner' | 'splash';
|
|
18
|
+
/**
|
|
19
|
+
* 自定义广告素材错误分类
|
|
20
|
+
*/
|
|
21
|
+
type BiCustomMediaErrorType = 'CUSTOM_MEDIA_LOAD_FAIL' | 'CUSTOM_MEDIA_LOAD_TIMEOUT';
|
|
22
|
+
/**
|
|
23
|
+
* 自定义广告素材类型
|
|
24
|
+
*/
|
|
25
|
+
type BiCustomMediaType = 'image' | 'video';
|
|
26
|
+
/**
|
|
27
|
+
* 自定义广告素材错误公共字段
|
|
28
|
+
*/
|
|
29
|
+
interface BiCustomMediaErrorDetail {
|
|
30
|
+
errorType?: BiCustomMediaErrorType;
|
|
31
|
+
mediaType?: BiCustomMediaType;
|
|
32
|
+
rawErrCode?: string | number;
|
|
33
|
+
rawErrMsg?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 展示广告来源优先级
|
|
37
|
+
*/
|
|
38
|
+
type DisplayAdPriority = 'custom-first' | 'wechat-first' | 'custom-only' | 'wechat-only';
|
|
39
|
+
/**
|
|
40
|
+
* 自定义广告标准跳转配置
|
|
41
|
+
*/
|
|
42
|
+
interface BiDisplayCustomAdAction {
|
|
43
|
+
type?: string;
|
|
44
|
+
appId?: string;
|
|
45
|
+
path?: string;
|
|
46
|
+
url?: string;
|
|
47
|
+
}
|
|
18
48
|
/**
|
|
19
49
|
* 广告事件基础数据
|
|
20
50
|
*/
|
|
@@ -36,9 +66,21 @@ interface BiBaseCustomAd {
|
|
|
36
66
|
* 展示广告支持的统一自定义广告结构
|
|
37
67
|
*/
|
|
38
68
|
interface BiDisplayCustomAd$1 extends BiBaseCustomAd {
|
|
69
|
+
configId?: string | number;
|
|
70
|
+
placementId?: string;
|
|
71
|
+
configName?: string;
|
|
72
|
+
advertPlatform?: string;
|
|
73
|
+
mediaType?: 'image' | 'video';
|
|
39
74
|
image?: string;
|
|
40
75
|
video?: string;
|
|
41
76
|
poster?: string;
|
|
77
|
+
bottomImage?: string;
|
|
78
|
+
fitMode?: 'contain' | 'cover';
|
|
79
|
+
jumpType?: 'miniProgram' | 'internal' | 'web' | 'none';
|
|
80
|
+
targetAppId?: string;
|
|
81
|
+
targetPath?: string;
|
|
82
|
+
jumpUrl?: string;
|
|
83
|
+
action?: BiDisplayCustomAdAction;
|
|
42
84
|
loadTimeout?: number;
|
|
43
85
|
timeout?: number;
|
|
44
86
|
adLabel?: string;
|
|
@@ -67,43 +109,45 @@ interface BiDisplayCustomAd$1 extends BiBaseCustomAd {
|
|
|
67
109
|
* @Author wutao
|
|
68
110
|
* @Date 2026-04-14
|
|
69
111
|
* @LastEditors wutao
|
|
70
|
-
* @LastEditTime 2026-
|
|
112
|
+
* @LastEditTime 2026-08-14 16:39:49
|
|
71
113
|
*/
|
|
72
114
|
|
|
73
|
-
/**
|
|
74
|
-
* 自定义 Banner 广告数据
|
|
75
|
-
*/
|
|
115
|
+
/** 自定义 Banner 广告数据 */
|
|
76
116
|
interface BiBannerCustomAd extends BiDisplayCustomAd$1 {
|
|
77
117
|
image?: string;
|
|
78
118
|
}
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
*/
|
|
82
|
-
interface BiBannerAdEventDetail extends BiBaseAdEventDetail {
|
|
119
|
+
/** Banner 广告事件数据 */
|
|
120
|
+
interface BiBannerAdEventDetail extends BiBaseAdEventDetail, BiCustomMediaErrorDetail {
|
|
83
121
|
provider: 'wechat' | 'custom';
|
|
84
122
|
type: 'banner';
|
|
85
123
|
url?: string;
|
|
86
124
|
errCode?: string | number;
|
|
87
125
|
errMsg?: string;
|
|
126
|
+
reason?: string;
|
|
127
|
+
error?: unknown;
|
|
88
128
|
}
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
129
|
+
/** 自研 Banner 反馈事件数据 */
|
|
130
|
+
interface BiBannerAdFeedbackDetail extends BiBannerAdEventDetail {
|
|
131
|
+
provider: 'custom';
|
|
132
|
+
action: 'dislike' | 'report';
|
|
133
|
+
reason?: string;
|
|
134
|
+
reasonText?: string;
|
|
135
|
+
}
|
|
136
|
+
/** Banner 广告组件属性 */
|
|
92
137
|
interface BiBannerAdProps {
|
|
93
138
|
unitId?: string;
|
|
94
139
|
customAd?: BiBannerCustomAd | null;
|
|
140
|
+
priority?: DisplayAdPriority;
|
|
95
141
|
adIntervals?: number;
|
|
96
142
|
className?: string;
|
|
97
143
|
onLoad?: (detail: BiBannerAdEventDetail | Record<string, unknown>) => void;
|
|
98
144
|
onError?: (detail: BiBannerAdEventDetail | Record<string, unknown>) => void;
|
|
99
145
|
onClose?: (detail: BiBannerAdEventDetail | Record<string, unknown>) => void;
|
|
100
146
|
onAction?: (detail: BiBannerAdEventDetail) => void;
|
|
147
|
+
onFeedback?: (detail: BiBannerAdFeedbackDetail) => void;
|
|
101
148
|
onOpenWebview?: (detail: BiBannerAdEventDetail) => void;
|
|
102
149
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Taro Banner 广告组件
|
|
105
|
-
* 优先展示微信原生广告,缺省时退化为自定义广告。
|
|
106
|
-
*/
|
|
150
|
+
/** Taro Banner 广告组件 */
|
|
107
151
|
declare const BiBannerAd: React.FC<BiBannerAdProps>;
|
|
108
152
|
|
|
109
153
|
/**
|
|
@@ -111,18 +155,14 @@ declare const BiBannerAd: React.FC<BiBannerAdProps>;
|
|
|
111
155
|
* @Author wutao
|
|
112
156
|
* @Date 2026-04-14
|
|
113
157
|
* @LastEditors wutao
|
|
114
|
-
* @LastEditTime 2026-08-
|
|
158
|
+
* @LastEditTime 2026-08-14 16:39:49
|
|
115
159
|
*/
|
|
116
160
|
|
|
117
|
-
/**
|
|
118
|
-
* 自定义开屏广告数据
|
|
119
|
-
*/
|
|
161
|
+
/** 自定义开屏广告数据 */
|
|
120
162
|
interface BiSplashCustomAd extends BiDisplayCustomAd$1 {
|
|
121
163
|
}
|
|
122
|
-
/**
|
|
123
|
-
|
|
124
|
-
*/
|
|
125
|
-
interface BiSplashAdEventDetail extends BiBaseAdEventDetail {
|
|
164
|
+
/** 开屏广告事件数据 */
|
|
165
|
+
interface BiSplashAdEventDetail extends BiBaseAdEventDetail, BiCustomMediaErrorDetail {
|
|
126
166
|
provider: 'wechat' | 'custom';
|
|
127
167
|
type: 'splash';
|
|
128
168
|
nativeSplash?: boolean;
|
|
@@ -131,15 +171,12 @@ interface BiSplashAdEventDetail extends BiBaseAdEventDetail {
|
|
|
131
171
|
errMsg?: string;
|
|
132
172
|
reason?: string;
|
|
133
173
|
error?: unknown;
|
|
134
|
-
rawErrCode?: string | number;
|
|
135
|
-
rawErrMsg?: string;
|
|
136
174
|
}
|
|
137
|
-
/**
|
|
138
|
-
* 开屏广告组件属性
|
|
139
|
-
*/
|
|
175
|
+
/** 开屏广告组件属性 */
|
|
140
176
|
interface BiSplashAdProps {
|
|
141
177
|
unitId?: string;
|
|
142
178
|
customAd?: BiSplashCustomAd | null;
|
|
179
|
+
priority?: DisplayAdPriority;
|
|
143
180
|
show?: boolean;
|
|
144
181
|
zIndex?: number;
|
|
145
182
|
pictureInPicture?: boolean;
|
|
@@ -153,9 +190,7 @@ interface BiSplashAdProps {
|
|
|
153
190
|
onHide?: (detail: BiSplashAdEventDetail) => void;
|
|
154
191
|
onOpenWebview?: (detail: BiSplashAdEventDetail) => void;
|
|
155
192
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Taro 开屏广告组件
|
|
158
|
-
*/
|
|
193
|
+
/** Taro 开屏广告组件 */
|
|
159
194
|
declare const BiSplashAd: React.FC<BiSplashAdProps>;
|
|
160
195
|
|
|
161
196
|
/**
|
|
@@ -163,7 +198,7 @@ declare const BiSplashAd: React.FC<BiSplashAdProps>;
|
|
|
163
198
|
* @Author wutao
|
|
164
199
|
* @Date 2026-04-14
|
|
165
200
|
* @LastEditors wutao
|
|
166
|
-
* @LastEditTime 2026-08-
|
|
201
|
+
* @LastEditTime 2026-08-13 16:18:21
|
|
167
202
|
*/
|
|
168
203
|
|
|
169
204
|
/**
|
|
@@ -209,6 +244,7 @@ interface BiDisplayAdProps {
|
|
|
209
244
|
unitId?: string;
|
|
210
245
|
type?: BiDisplayAdType | string;
|
|
211
246
|
customAd?: BiDisplayCustomAd | null;
|
|
247
|
+
priority?: DisplayAdPriority;
|
|
212
248
|
adOptions?: Record<string, unknown> | null;
|
|
213
249
|
sdkKey?: string;
|
|
214
250
|
autoLoad?: boolean;
|
|
@@ -224,6 +260,7 @@ interface BiDisplayAdProps {
|
|
|
224
260
|
onError?: (detail: BiDisplayAdEventDetail) => void;
|
|
225
261
|
onClose?: (detail: BiDisplayAdEventDetail) => void;
|
|
226
262
|
onAction?: (detail: BiDisplayAdEventDetail) => void;
|
|
263
|
+
onFeedback?: (detail: BiBannerAdFeedbackDetail) => void;
|
|
227
264
|
onHide?: (detail: BiDisplayAdEventDetail) => void;
|
|
228
265
|
onOpenWebview?: (detail: BiDisplayAdEventDetail) => void;
|
|
229
266
|
onConfigLoad?: (detail: BiDisplayAdConfigEventDetail) => void;
|
|
@@ -235,4 +272,4 @@ interface BiDisplayAdProps {
|
|
|
235
272
|
*/
|
|
236
273
|
declare const BiDisplayAd: React.FC<BiDisplayAdProps>;
|
|
237
274
|
|
|
238
|
-
export { type BiAdProvider, type BiAdType, BiBannerAd, type BiBannerAdEventDetail, type BiBannerAdProps, type BiBannerCustomAd, type BiBaseAdEventDetail, type BiBaseCustomAd, BiDisplayAd, type BiDisplayAdConfigEventDetail, type BiDisplayAdEventDetail, type BiDisplayAdProps, type BiDisplayAdType, type BiDisplayCustomAd, type BiDisplayNoAdEventDetail, BiSplashAd, type BiSplashAdEventDetail, type BiSplashAdProps, type BiSplashCustomAd };
|
|
275
|
+
export { type BiAdProvider, type BiAdType, BiBannerAd, type BiBannerAdEventDetail, type BiBannerAdFeedbackDetail, type BiBannerAdProps, type BiBannerCustomAd, type BiBaseAdEventDetail, type BiBaseCustomAd, type BiCustomMediaErrorDetail, type BiCustomMediaErrorType, type BiCustomMediaType, BiDisplayAd, type BiDisplayAdConfigEventDetail, type BiDisplayAdEventDetail, type BiDisplayAdProps, type BiDisplayAdType, type BiDisplayCustomAd, type BiDisplayCustomAdAction, type BiDisplayNoAdEventDetail, BiSplashAd, type BiSplashAdEventDetail, type BiSplashAdProps, type BiSplashCustomAd, type DisplayAdPriority };
|
package/dist/ad/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
* @Author wutao
|
|
6
6
|
* @Date 2026-04-14
|
|
7
7
|
* @LastEditors wutao
|
|
8
|
-
* @LastEditTime 2026-
|
|
8
|
+
* @LastEditTime 2026-08-14 16:39:49
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* 广告提供方类型
|
|
@@ -15,6 +15,36 @@ type BiAdProvider = 'wechat' | 'custom';
|
|
|
15
15
|
* 广告展示类型
|
|
16
16
|
*/
|
|
17
17
|
type BiAdType = 'banner' | 'splash';
|
|
18
|
+
/**
|
|
19
|
+
* 自定义广告素材错误分类
|
|
20
|
+
*/
|
|
21
|
+
type BiCustomMediaErrorType = 'CUSTOM_MEDIA_LOAD_FAIL' | 'CUSTOM_MEDIA_LOAD_TIMEOUT';
|
|
22
|
+
/**
|
|
23
|
+
* 自定义广告素材类型
|
|
24
|
+
*/
|
|
25
|
+
type BiCustomMediaType = 'image' | 'video';
|
|
26
|
+
/**
|
|
27
|
+
* 自定义广告素材错误公共字段
|
|
28
|
+
*/
|
|
29
|
+
interface BiCustomMediaErrorDetail {
|
|
30
|
+
errorType?: BiCustomMediaErrorType;
|
|
31
|
+
mediaType?: BiCustomMediaType;
|
|
32
|
+
rawErrCode?: string | number;
|
|
33
|
+
rawErrMsg?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 展示广告来源优先级
|
|
37
|
+
*/
|
|
38
|
+
type DisplayAdPriority = 'custom-first' | 'wechat-first' | 'custom-only' | 'wechat-only';
|
|
39
|
+
/**
|
|
40
|
+
* 自定义广告标准跳转配置
|
|
41
|
+
*/
|
|
42
|
+
interface BiDisplayCustomAdAction {
|
|
43
|
+
type?: string;
|
|
44
|
+
appId?: string;
|
|
45
|
+
path?: string;
|
|
46
|
+
url?: string;
|
|
47
|
+
}
|
|
18
48
|
/**
|
|
19
49
|
* 广告事件基础数据
|
|
20
50
|
*/
|
|
@@ -36,9 +66,21 @@ interface BiBaseCustomAd {
|
|
|
36
66
|
* 展示广告支持的统一自定义广告结构
|
|
37
67
|
*/
|
|
38
68
|
interface BiDisplayCustomAd$1 extends BiBaseCustomAd {
|
|
69
|
+
configId?: string | number;
|
|
70
|
+
placementId?: string;
|
|
71
|
+
configName?: string;
|
|
72
|
+
advertPlatform?: string;
|
|
73
|
+
mediaType?: 'image' | 'video';
|
|
39
74
|
image?: string;
|
|
40
75
|
video?: string;
|
|
41
76
|
poster?: string;
|
|
77
|
+
bottomImage?: string;
|
|
78
|
+
fitMode?: 'contain' | 'cover';
|
|
79
|
+
jumpType?: 'miniProgram' | 'internal' | 'web' | 'none';
|
|
80
|
+
targetAppId?: string;
|
|
81
|
+
targetPath?: string;
|
|
82
|
+
jumpUrl?: string;
|
|
83
|
+
action?: BiDisplayCustomAdAction;
|
|
42
84
|
loadTimeout?: number;
|
|
43
85
|
timeout?: number;
|
|
44
86
|
adLabel?: string;
|
|
@@ -67,43 +109,45 @@ interface BiDisplayCustomAd$1 extends BiBaseCustomAd {
|
|
|
67
109
|
* @Author wutao
|
|
68
110
|
* @Date 2026-04-14
|
|
69
111
|
* @LastEditors wutao
|
|
70
|
-
* @LastEditTime 2026-
|
|
112
|
+
* @LastEditTime 2026-08-14 16:39:49
|
|
71
113
|
*/
|
|
72
114
|
|
|
73
|
-
/**
|
|
74
|
-
* 自定义 Banner 广告数据
|
|
75
|
-
*/
|
|
115
|
+
/** 自定义 Banner 广告数据 */
|
|
76
116
|
interface BiBannerCustomAd extends BiDisplayCustomAd$1 {
|
|
77
117
|
image?: string;
|
|
78
118
|
}
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
*/
|
|
82
|
-
interface BiBannerAdEventDetail extends BiBaseAdEventDetail {
|
|
119
|
+
/** Banner 广告事件数据 */
|
|
120
|
+
interface BiBannerAdEventDetail extends BiBaseAdEventDetail, BiCustomMediaErrorDetail {
|
|
83
121
|
provider: 'wechat' | 'custom';
|
|
84
122
|
type: 'banner';
|
|
85
123
|
url?: string;
|
|
86
124
|
errCode?: string | number;
|
|
87
125
|
errMsg?: string;
|
|
126
|
+
reason?: string;
|
|
127
|
+
error?: unknown;
|
|
88
128
|
}
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
129
|
+
/** 自研 Banner 反馈事件数据 */
|
|
130
|
+
interface BiBannerAdFeedbackDetail extends BiBannerAdEventDetail {
|
|
131
|
+
provider: 'custom';
|
|
132
|
+
action: 'dislike' | 'report';
|
|
133
|
+
reason?: string;
|
|
134
|
+
reasonText?: string;
|
|
135
|
+
}
|
|
136
|
+
/** Banner 广告组件属性 */
|
|
92
137
|
interface BiBannerAdProps {
|
|
93
138
|
unitId?: string;
|
|
94
139
|
customAd?: BiBannerCustomAd | null;
|
|
140
|
+
priority?: DisplayAdPriority;
|
|
95
141
|
adIntervals?: number;
|
|
96
142
|
className?: string;
|
|
97
143
|
onLoad?: (detail: BiBannerAdEventDetail | Record<string, unknown>) => void;
|
|
98
144
|
onError?: (detail: BiBannerAdEventDetail | Record<string, unknown>) => void;
|
|
99
145
|
onClose?: (detail: BiBannerAdEventDetail | Record<string, unknown>) => void;
|
|
100
146
|
onAction?: (detail: BiBannerAdEventDetail) => void;
|
|
147
|
+
onFeedback?: (detail: BiBannerAdFeedbackDetail) => void;
|
|
101
148
|
onOpenWebview?: (detail: BiBannerAdEventDetail) => void;
|
|
102
149
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Taro Banner 广告组件
|
|
105
|
-
* 优先展示微信原生广告,缺省时退化为自定义广告。
|
|
106
|
-
*/
|
|
150
|
+
/** Taro Banner 广告组件 */
|
|
107
151
|
declare const BiBannerAd: React.FC<BiBannerAdProps>;
|
|
108
152
|
|
|
109
153
|
/**
|
|
@@ -111,18 +155,14 @@ declare const BiBannerAd: React.FC<BiBannerAdProps>;
|
|
|
111
155
|
* @Author wutao
|
|
112
156
|
* @Date 2026-04-14
|
|
113
157
|
* @LastEditors wutao
|
|
114
|
-
* @LastEditTime 2026-08-
|
|
158
|
+
* @LastEditTime 2026-08-14 16:39:49
|
|
115
159
|
*/
|
|
116
160
|
|
|
117
|
-
/**
|
|
118
|
-
* 自定义开屏广告数据
|
|
119
|
-
*/
|
|
161
|
+
/** 自定义开屏广告数据 */
|
|
120
162
|
interface BiSplashCustomAd extends BiDisplayCustomAd$1 {
|
|
121
163
|
}
|
|
122
|
-
/**
|
|
123
|
-
|
|
124
|
-
*/
|
|
125
|
-
interface BiSplashAdEventDetail extends BiBaseAdEventDetail {
|
|
164
|
+
/** 开屏广告事件数据 */
|
|
165
|
+
interface BiSplashAdEventDetail extends BiBaseAdEventDetail, BiCustomMediaErrorDetail {
|
|
126
166
|
provider: 'wechat' | 'custom';
|
|
127
167
|
type: 'splash';
|
|
128
168
|
nativeSplash?: boolean;
|
|
@@ -131,15 +171,12 @@ interface BiSplashAdEventDetail extends BiBaseAdEventDetail {
|
|
|
131
171
|
errMsg?: string;
|
|
132
172
|
reason?: string;
|
|
133
173
|
error?: unknown;
|
|
134
|
-
rawErrCode?: string | number;
|
|
135
|
-
rawErrMsg?: string;
|
|
136
174
|
}
|
|
137
|
-
/**
|
|
138
|
-
* 开屏广告组件属性
|
|
139
|
-
*/
|
|
175
|
+
/** 开屏广告组件属性 */
|
|
140
176
|
interface BiSplashAdProps {
|
|
141
177
|
unitId?: string;
|
|
142
178
|
customAd?: BiSplashCustomAd | null;
|
|
179
|
+
priority?: DisplayAdPriority;
|
|
143
180
|
show?: boolean;
|
|
144
181
|
zIndex?: number;
|
|
145
182
|
pictureInPicture?: boolean;
|
|
@@ -153,9 +190,7 @@ interface BiSplashAdProps {
|
|
|
153
190
|
onHide?: (detail: BiSplashAdEventDetail) => void;
|
|
154
191
|
onOpenWebview?: (detail: BiSplashAdEventDetail) => void;
|
|
155
192
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Taro 开屏广告组件
|
|
158
|
-
*/
|
|
193
|
+
/** Taro 开屏广告组件 */
|
|
159
194
|
declare const BiSplashAd: React.FC<BiSplashAdProps>;
|
|
160
195
|
|
|
161
196
|
/**
|
|
@@ -163,7 +198,7 @@ declare const BiSplashAd: React.FC<BiSplashAdProps>;
|
|
|
163
198
|
* @Author wutao
|
|
164
199
|
* @Date 2026-04-14
|
|
165
200
|
* @LastEditors wutao
|
|
166
|
-
* @LastEditTime 2026-08-
|
|
201
|
+
* @LastEditTime 2026-08-13 16:18:21
|
|
167
202
|
*/
|
|
168
203
|
|
|
169
204
|
/**
|
|
@@ -209,6 +244,7 @@ interface BiDisplayAdProps {
|
|
|
209
244
|
unitId?: string;
|
|
210
245
|
type?: BiDisplayAdType | string;
|
|
211
246
|
customAd?: BiDisplayCustomAd | null;
|
|
247
|
+
priority?: DisplayAdPriority;
|
|
212
248
|
adOptions?: Record<string, unknown> | null;
|
|
213
249
|
sdkKey?: string;
|
|
214
250
|
autoLoad?: boolean;
|
|
@@ -224,6 +260,7 @@ interface BiDisplayAdProps {
|
|
|
224
260
|
onError?: (detail: BiDisplayAdEventDetail) => void;
|
|
225
261
|
onClose?: (detail: BiDisplayAdEventDetail) => void;
|
|
226
262
|
onAction?: (detail: BiDisplayAdEventDetail) => void;
|
|
263
|
+
onFeedback?: (detail: BiBannerAdFeedbackDetail) => void;
|
|
227
264
|
onHide?: (detail: BiDisplayAdEventDetail) => void;
|
|
228
265
|
onOpenWebview?: (detail: BiDisplayAdEventDetail) => void;
|
|
229
266
|
onConfigLoad?: (detail: BiDisplayAdConfigEventDetail) => void;
|
|
@@ -235,4 +272,4 @@ interface BiDisplayAdProps {
|
|
|
235
272
|
*/
|
|
236
273
|
declare const BiDisplayAd: React.FC<BiDisplayAdProps>;
|
|
237
274
|
|
|
238
|
-
export { type BiAdProvider, type BiAdType, BiBannerAd, type BiBannerAdEventDetail, type BiBannerAdProps, type BiBannerCustomAd, type BiBaseAdEventDetail, type BiBaseCustomAd, BiDisplayAd, type BiDisplayAdConfigEventDetail, type BiDisplayAdEventDetail, type BiDisplayAdProps, type BiDisplayAdType, type BiDisplayCustomAd, type BiDisplayNoAdEventDetail, BiSplashAd, type BiSplashAdEventDetail, type BiSplashAdProps, type BiSplashCustomAd };
|
|
275
|
+
export { type BiAdProvider, type BiAdType, BiBannerAd, type BiBannerAdEventDetail, type BiBannerAdFeedbackDetail, type BiBannerAdProps, type BiBannerCustomAd, type BiBaseAdEventDetail, type BiBaseCustomAd, type BiCustomMediaErrorDetail, type BiCustomMediaErrorType, type BiCustomMediaType, BiDisplayAd, type BiDisplayAdConfigEventDetail, type BiDisplayAdEventDetail, type BiDisplayAdProps, type BiDisplayAdType, type BiDisplayCustomAd, type BiDisplayCustomAdAction, type BiDisplayNoAdEventDetail, BiSplashAd, type BiSplashAdEventDetail, type BiSplashAdProps, type BiSplashCustomAd, type DisplayAdPriority };
|
package/dist/ad/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ut=Object.create;var Ne=Object.defineProperty,ct=Object.defineProperties,dt=Object.getOwnPropertyDescriptor,pt=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertyNames,Je=Object.getOwnPropertySymbols,gt=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))Xe.call(t,r)&&ze(e,r,t[r]);if(Je)for(var r of Je(t))ft.call(t,r)&&ze(e,r,t[r]);return e},$=(e,t)=>ct(e,pt(t));var ht=(e,t)=>{for(var r in t)Ne(e,r,{get:t[r],enumerable:!0})},Qe=(e,t,r,A)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of mt(t))!Xe.call(e,u)&&u!==r&&Ne(e,u,{get:()=>t[u],enumerable:!(A=dt(t,u))||A.enumerable});return e};var Ze=(e,t,r)=>(r=e!=null?ut(gt(e)):{},Qe(t||!e||!e.__esModule?Ne(r,"default",{value:e,enumerable:!0}):r,e)),At=e=>Qe(Ne({},"__esModule",{value:!0}),e);var _t={};ht(_t,{BiBannerAd:()=>Ve,BiDisplayAd:()=>lt,BiSplashAd:()=>We});module.exports=At(_t);var Gt=require("./banner/index.scss"),Yt=require("./splash/index.scss");var T=require("react"),O=require("@tarojs/components");var yt=Ze(require("@tarojs/components")),Ie;function Re(){if(Ie!==void 0)return Ie;try{let e=yt;Ie=(e==null?void 0:e.AdCustom)||null}catch(e){Ie=null}return Ie}var Ce=Ze(require("@tarojs/taro"));function Le(){return typeof wx!="undefined"?wx:null}function de(e,t){let r=e==null?void 0:e.detail;return r&&typeof r=="object"?h(h({},t),r):e&&typeof e=="object"?h(h({},t),e):h({},t)}function et(e){return e&&(e.image||e.video)||""}function tt(e,t=""){return e&&(e.poster||e.image||t)||""}function nt(e,t=""){return e?e.video?!1:e.image?!0:/\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(String(t).trim()):!0}function rt(e){if(!e)return 2;let t=Number(e.adSpec||e.spec||0);if(t===1||t===2)return t;let r=Number(e.videoWidth||e.width||0),A=Number(e.videoHeight||e.height||0);return r>0&&A>0?r>A?1:2:e.video?1:2}function Ue(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function it(e,t=5){let r=e==null?void 0:e.jumpSeconds,A=r!=null?r:t;return Math.min(99,Math.max(0,Number(A)||0))}function xe(e){var r;let t=(r=e==null?void 0:e.loadTimeout)!=null?r:e==null?void 0:e.timeout;return Math.max(1e3,Number(t)||5e3)}function Bt(e){return e?e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":e.url||e.webUrl||e.h5Url?"web":"none":"none"}function St(e){return e&&(e.appId||e.miniProgramAppId||e.jumpAppId)||""}function Dt(e){return e&&(e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function Ct(e){return e&&(e.url||e.webUrl||e.h5Url)||""}function Oe(e){let{customAd:t,actionDetail:r,onOpenWebview:A,onError:u,miniProgramErrorCode:k,navigateErrorCode:J,miniProgramUnsupportedErrorCode:z}=e;if(!t)return;let b=Bt(t),M=St(t),X=Dt(t),j=Ct(t);if(b==="miniProgram"&&M){let E=Le();if(!E||typeof E.navigateToMiniProgram!="function"){u==null||u($(h({},r),{errCode:z||k,errMsg:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}E.navigateToMiniProgram({appId:M,path:X||"",fail:G=>{u==null||u($(h({},r),{errCode:k,errMsg:(G==null?void 0:G.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(b==="internal"&&X){Ce.navigateTo({url:X,fail:E=>{u==null||u($(h({},r),{errCode:J,errMsg:(E==null?void 0:E.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}b==="web"&&j&&(A==null||A($(h({},r),{url:j})))}function st(){let e=Le(),t=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},r=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof Ce.getSystemInfoSync=="function"?Ce.getSystemInfoSync():{},A=r.windowHeight===r.screenHeight,u=16,k=16,J=16,z=32,b=A&&t.top?t.top:u,M=A&&t.height?t.height:z;return{top:`${b}px`,width:"156rpx",height:`${M}px`,lineHeight:`${M}px`,borderRadius:`${Math.round(M/2)}px`,left:A?`${J}px`:void 0,right:A?void 0:`${k}px`}}function at(){var u;let e=typeof Ce.getSystemInfoSync=="function"?Ce.getSystemInfoSync():{},t=Math.max(0,Number(e.screenHeight||0)-Number(((u=e.safeArea)==null?void 0:u.bottom)||e.windowHeight||0)),r=t>0?t+42:84,A=t>0?t+88:130;return{contentStyle:{bottom:`${r}rpx`},badgeStyle:{bottom:`${A}rpx`}}}var H=require("react/jsx-runtime"),Ve=({unitId:e="",customAd:t,adIntervals:r=30,className:A,onLoad:u,onError:k,onClose:J,onAction:z,onOpenWebview:b})=>{let M=(0,T.useMemo)(()=>Re(),[]),X=!!(e&&M),j=(0,T.useRef)(null),E=(0,T.useRef)(!1),G=(0,T.useRef)(!1),V=(0,T.useRef)(u),p=(0,T.useRef)(k),Q=(0,T.useRef)(J),_=(0,T.useRef)(z),W=(0,T.useRef)(b),[se,N]=(0,T.useState)(!1),d=t||null,fe=(0,T.useMemo)(()=>`bi-banner-ad${A?` ${A}`:""}`,[A]);(0,T.useEffect)(()=>{V.current=u,p.current=k,Q.current=J,_.current=z,W.current=b},[z,J,k,u,b]);let f=o=>({provider:o,type:"banner"}),ae=(0,T.useCallback)(()=>{j.current&&(clearTimeout(j.current),j.current=null)},[]),w=(0,T.useCallback)((o,y)=>{var D;G.current||(G.current=!0,ae(),N(!0),(D=p.current)==null||D.call(p,h(h({},de(o,f("custom"))),y)))},[ae]);(0,T.useEffect)(()=>{if(ae(),E.current=!1,G.current=!1,N(!1),!(X||!(d!=null&&d.image)))return j.current=setTimeout(()=>{w(void 0,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})},xe(d)),()=>{ae()}},[ae,d,X,w]),(0,T.useEffect)(()=>{var o;!e||M||(o=p.current)==null||o.call(p,$(h({},f("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"}))},[M,e]);let te=o=>{var y;(y=V.current)==null||y.call(V,de(o,f("wechat")))},g=o=>{var y;(y=p.current)==null||y.call(p,de(o,f("wechat")))},R=o=>{var y;(y=Q.current)==null||y.call(Q,de(o,f("wechat")))},F=()=>{var o;E.current||G.current||(ae(),E.current=!0,(o=V.current)==null||o.call(V,f("custom")))},ne=o=>{w(o,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},U=o=>{var D,I;(D=o==null?void 0:o.stopPropagation)==null||D.call(o);let y=f("custom");(I=_.current)==null||I.call(_,y),Oe({customAd:d,actionDetail:y,onOpenWebview:B=>{var x;(x=W.current)==null||x.call(W,B)},onError:B=>{var x;(x=p.current)==null||x.call(p,B)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL"})},re=o=>{var y,D;(y=o==null?void 0:o.stopPropagation)==null||y.call(o),(D=Q.current)==null||D.call(Q,f("custom"))};return X&&M?(0,H.jsx)(M,{className:fe,unitId:e,adIntervals:r,onLoad:te,onError:g,onClose:R}):!d||!d.image||se?null:(0,H.jsxs)(O.View,{className:fe,children:[(0,H.jsxs)(O.View,{className:"bi-banner-ad__surface",onClick:U,children:[(0,H.jsxs)(O.View,{className:"bi-banner-ad__media",children:[(0,H.jsx)(O.Text,{className:"bi-banner-ad__badge bi-banner-ad__badge--overlay",children:Ue(d)}),(0,H.jsx)(O.Image,{className:"bi-banner-ad__image",src:d.image||"",mode:"aspectFill",onLoad:F,onError:ne})]}),(0,H.jsxs)(O.View,{className:"bi-banner-ad__content",children:[(0,H.jsx)(O.View,{className:"bi-banner-ad__body",children:d.title?(0,H.jsx)(O.Text,{className:"bi-banner-ad__title",children:d.title}):null}),(0,H.jsxs)(O.View,{className:"bi-banner-ad__footer",children:[d.description?(0,H.jsx)(O.Text,{className:"bi-banner-ad__description",children:d.description}):null,(0,H.jsx)(O.Button,{className:"bi-banner-ad__button",onClick:U,children:d.buttonText||"\u7ACB\u5373\u67E5\u770B"})]})]})]}),(0,H.jsx)(O.Button,{className:"bi-banner-ad__close",onClick:re,children:"\xD7"})]})};var s=require("react"),C=require("@tarojs/components");var S=require("react/jsx-runtime"),We=({unitId:e="",customAd:t,show:r=!0,zIndex:A=999,pictureInPicture:u=!1,checkNativeSplash:k=!0,jumpSeconds:J=5,className:z,onLoad:b,onError:M,onClose:X,onAction:j,onHide:E,onOpenWebview:G})=>{let V=(0,s.useMemo)(()=>Re(),[]),p=!!(e&&V),[Q,_]=(0,s.useState)(!1),[W,se]=(0,s.useState)(p),[N,d]=(0,s.useState)(!1),[fe,f]=(0,s.useState)(0),[ae,w]=(0,s.useState)(!1),[te,g]=(0,s.useState)(!1),R=(0,s.useRef)(null),F=(0,s.useRef)(null),ne=(0,s.useRef)(null),U=(0,s.useRef)(null),re=(0,s.useRef)(null),o=(0,s.useRef)(0),y=(0,s.useRef)(!1),D=(0,s.useRef)(!1),I=(0,s.useRef)(b),B=(0,s.useRef)(M),x=(0,s.useRef)(X),pe=(0,s.useRef)(j),le=(0,s.useRef)(E),Y=(0,s.useRef)(G),c=t||null,me=(0,s.useMemo)(()=>et(c),[c]),ve=(0,s.useMemo)(()=>tt(c,me),[c,me]),ge=!!me,Fe=(0,s.useMemo)(()=>nt(c,me),[c,me]),$e=(0,s.useMemo)(()=>rt(c),[c]),Pe=(0,s.useMemo)(()=>Ue(c),[c]),ue=(0,s.useMemo)(()=>it(c,J),[c,J]),He=(0,s.useMemo)(()=>st(),[]),{contentStyle:Me,badgeStyle:_e}=(0,s.useMemo)(()=>at(),[]),je=(0,s.useMemo)(()=>{let a=["bi-splash-ad"];return N&&a.push("bi-splash-ad--pip"),te&&a.push("bi-splash-ad--pip-animating"),z&&a.push(z),a.join(" ")},[z,te,N]);(0,s.useEffect)(()=>{I.current=b,B.current=M,x.current=X,pe.current=j,le.current=E,Y.current=G},[j,X,M,E,b,G]);let ie=a=>({provider:a,type:"splash"});(0,s.useEffect)(()=>{var a;!r||!e||V||(a=B.current)==null||a.call(B,$(h({},ie("wechat")),{errCode:"BI_SPLASH_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"}))},[V,r,e]);let ce=(0,s.useCallback)(()=>{R.current&&(clearInterval(R.current),R.current=null),F.current&&(clearTimeout(F.current),F.current=null)},[]),Z=(0,s.useCallback)(()=>{ne.current&&(clearTimeout(ne.current),ne.current=null)},[]),he=(0,s.useCallback)(()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]),Ae=(0,s.useCallback)(()=>{re.current&&(clearTimeout(re.current),re.current=null)},[]),P=(0,s.useCallback)(()=>{ce(),Z(),he(),Ae()},[ce,Z,Ae,he]),ye=(0,s.useCallback)(a=>{var m;P(),_(!1),d(!1),f(0),w(!1),D.current=!1,g(!1),(m=x.current)==null||m.call(x,a)},[P]),Be=(0,s.useCallback)(()=>{let a=W?"wechat":"custom";if(u){ce(),Z(),Ae(),g(!0),re.current=setTimeout(()=>{var m;re.current=null,d(!0),g(!1),(m=le.current)==null||m.call(le,ie(a))},280);return}ye({type:"splash",provider:a})},[ce,Z,Ae,ye,W,u]),oe=(0,s.useCallback)(()=>{if(ce(),ue<=0){Be();return}f(ue),R.current=setInterval(()=>{f(a=>a<=1?(ce(),F.current=setTimeout(()=>{F.current=null,Be()},0),0):a-1)},1e3)},[ce,ue,Be]),Ge=(0,s.useCallback)(a=>{!r||!p||!a||N||oe()},[p,r,N,oe]),Se=(0,s.useCallback)(()=>{let a=!!(!y.current&&(p||ge));P(),se(p),_(a),d(!1),f(ue),w(!1),D.current=!1,g(!1),Ge(a),a&&!p&&ge&&(ne.current=setTimeout(()=>{var m;D.current||(P(),_(!1),d(!1),f(0),w(!1),D.current=!1,g(!1),(m=B.current)==null||m.call(B,$(h({},ie("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},xe(c)))},[p,P,ue,ge,c,Ge]),Te=(0,s.useCallback)(()=>{if(!r)return;if(y.current){_(!1);return}if(!k){Se();return}let a=Le();if(!a||typeof a.getShowSplashAdStatus!="function"||o.current>=3){Se();return}a.getShowSplashAdStatus({success:m=>{var q;if((m==null?void 0:m.code)===-1){o.current+=1,he(),U.current=setTimeout(()=>{U.current=null,Te()},300);return}if((m==null?void 0:m.code)===1){P(),_(!1),y.current=!0,(q=I.current)==null||q.call(I,{provider:"wechat",type:"splash",nativeSplash:!0});return}Se()},fail:()=>{Se()}})},[p,k,P,he,ge,Se,r]);(0,s.useEffect)(()=>{if(!r){P(),_(!1),se(p),d(!1),f(0),w(!1),D.current=!1,g(!1),y.current=!1;return}return o.current=0,y.current?(P(),se(p),_(!1),d(!1),f(0),w(!1),D.current=!1,g(!1),()=>{P()}):(k||(y.current=!1),P(),se(p),_(!1),d(!1),f(ue),w(!1),D.current=!1,g(!1),Te(),()=>{P()})},[p,k,Te,P,ue,r]);let ee=a=>{var m;oe(),(m=I.current)==null||m.call(I,de(a,ie("wechat")))},Ke=a=>{var m;if(W){if(P(),ge){se(!1),_(!0),d(!1),f(ue),w(!1),D.current=!1,g(!1),ne.current=setTimeout(()=>{var q;D.current||(P(),_(!1),d(!1),f(0),w(!1),D.current=!1,g(!1),(q=B.current)==null||q.call(B,$(h({},ie("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},xe(c));return}_(!1),d(!1),f(0),w(!1),D.current=!1,g(!1),(m=x.current)==null||m.call(x,{provider:"wechat",type:"splash",reason:"wechatAdLoadFail",error:a})}},ke=a=>{var be;let m=a&&typeof a.detail=="object"?a.detail:{},q=$(h({},de(a,ie("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(m.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:m.errCode,rawErrMsg:m.errMsg});(be=B.current)==null||be.call(B,q),Ke(q)},n=a=>{ye(de(a,ie("wechat")))},i=()=>{var a;D.current||(Z(),D.current=!0,w(!0),oe(),(a=I.current)==null||a.call(I,ie("custom")))},l=(a,m)=>{var q;P(),_(!1),d(!1),f(0),w(!1),D.current=!1,g(!1),(q=B.current)==null||q.call(B,h(h({},de(a,ie("custom"))),m))},K=a=>{l(a,{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},De=()=>{var q;let a=W?"wechat":"custom",m=ie(a);(q=pe.current)==null||q.call(pe,m),a==="custom"&&Oe({customAd:c,actionDetail:m,onOpenWebview:be=>{var Ee;(Ee=Y.current)==null||Ee.call(Y,be)},onError:be=>{var Ee;(Ee=B.current)==null||Ee.call(B,be)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL"})},L=()=>{ye({type:"splash",provider:W?"wechat":"custom"})},we=W?V:null;return!Q||!!!we&&!ge?null:(0,S.jsxs)(C.View,{className:je,style:{zIndex:A},children:[we?(0,S.jsx)(C.View,{className:"bi-splash-ad__popup",children:(0,S.jsx)(C.View,{className:`bi-splash-ad__media-wrapper${N?" bi-splash-ad__media-wrapper--pip":""}`,children:(0,S.jsx)(we,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:ee,onError:ke,onClose:n})})}):(0,S.jsx)(C.View,{className:"bi-splash-ad__popup",children:(0,S.jsxs)(C.View,{className:"bi-splash-ad__media-shell",onClick:De,children:[Fe?(0,S.jsx)(C.Image,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:me,mode:"aspectFill",onLoad:i,onError:K}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(C.Image,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:ve,mode:"aspectFill"}),(0,S.jsx)(C.Video,{className:`bi-splash-ad__video${$e===1?" bi-splash-ad__video--landscape":""}`,src:me,poster:ve,autoplay:!0,muted:(c==null?void 0:c.muted)!==!1,loop:!0,objectFit:"cover",showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:i,onError:K})]}),N?(0,S.jsx)(C.View,{className:"bi-splash-ad__pip-mask"}):null,N?null:(0,S.jsx)(C.View,{className:"bi-splash-ad__badge",style:_e,children:Pe}),c&&(c.title||!N&&(c.description||c.buttonText))?(0,S.jsxs)(C.View,{className:"bi-splash-ad__content",style:Me,children:[c.title?(0,S.jsx)(C.Text,{className:"bi-splash-ad__title",children:c.title}):null,!N&&c.description?(0,S.jsx)(C.Text,{className:"bi-splash-ad__description",children:c.description}):null,!N&&c.buttonText?(0,S.jsx)(C.Button,{className:"bi-splash-ad__action",children:c.buttonText}):null]}):null]})}),N?(0,S.jsx)(C.View,{className:"bi-splash-ad__pip-close",onClick:L,children:(0,S.jsx)(C.View,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,N?null:(0,S.jsxs)(C.View,{className:"bi-splash-ad__skip",style:He,onClick:Be,children:[(0,S.jsxs)(C.Text,{children:[fe,"s"]}),(0,S.jsx)(C.View,{className:"bi-splash-ad__skip-divider"}),(0,S.jsx)(C.Text,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};var v=require("react");var Ye=require("react/jsx-runtime"),vt="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",bt=300*1e3,ot=["banner","splash"],lt=({adId:e="",unitId:t,type:r="banner",customAd:A,adOptions:u=null,sdkKey:k="biNova",autoLoad:J=!0,adIntervals:z=30,show:b=!0,zIndex:M=999,pictureInPicture:X=!1,checkNativeSplash:j=!0,nativeSplashCache:E=!0,jumpSeconds:G=5,className:V,onLoad:p,onError:Q,onClose:_,onAction:W,onHide:se,onOpenWebview:N,onConfigLoad:d,onConfigError:fe})=>{var ke;let f=(0,v.useRef)(0),ae=(0,v.useRef)(""),w=(0,v.useRef)(null),te=(0,v.useRef)(p),g=(0,v.useRef)(Q),R=(0,v.useRef)(_),F=(0,v.useRef)(W),ne=(0,v.useRef)(se),U=(0,v.useRef)(N),re=(0,v.useRef)(d),o=(0,v.useRef)(fe),y=(0,v.useRef)(b),[D,I]=(0,v.useState)(!1),[B,x]=(0,v.useState)(!1),[pe,le]=(0,v.useState)(null);(0,v.useEffect)(()=>{te.current=p,g.current=Q,R.current=_,F.current=W,ne.current=se,U.current=N,re.current=d,o.current=fe,y.current=b},[W,_,fe,d,Q,se,p,N,b]);let Y=(0,v.useMemo)(()=>ot.includes(r)?r:"banner",[r]),c=()=>!!(J&&e),me=()=>{var K;let n=globalThis.getApp,i=typeof n=="function"?n():null;if(!i)return null;let l=i;return l[k]||((K=l.globalData)==null?void 0:K[k])||null},ve=()=>{var n;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let i=wx.getAccountInfoSync();return((n=i==null?void 0:i.miniProgram)==null?void 0:n.appId)||""}}catch(i){return""}return""},ge=(n,i)=>`${vt}_${i||"unknown"}_${n||"empty"}`,Fe=(n,i)=>{if(!E||!n||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let l=ge(n,i),K=Number(wx.getStorageSync(l)||0),De=Date.now()-K;return K>0&&De>=0&&De<=bt}catch(l){return!1}},$e=()=>{if(E&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let n=ge(e,ve());wx.setStorageSync(n,Date.now())}catch(n){}},Pe=()=>{f.current+=1,ae.current="",I(!1),x(!1),le(null)},ue=()=>{let n=u&&typeof u=="object"?u:{},i=ve();return $(h({},n),{adId:e,placementId:n.placementId||e,appId:n.appId||i,type:Y})},He=n=>{try{return JSON.stringify(n||{})}catch(i){return`${String(n.appId||"")}_${String(n.placementId||"")}`}},Me=n=>{let i=(n==null?void 0:n.unitId)||"",l=(n==null?void 0:n.customAd)||(n==null?void 0:n.custom)||null,K=typeof(n==null?void 0:n.show)=="boolean"?n.show:!!(i||l);return{unitId:i,customAd:l,show:K}},_e=n=>{var i,l;(i=o.current)==null||i.call(o,n),(l=g.current)==null||l.call(g,n)},je=n=>{var i;(i=R.current)==null||i.call(R,{type:Y,adId:e||n.adId||"",provider:"none",reason:"noAd"})},ie=async()=>{var De;if(!c())return;let n=ue(),i=He(n);if(ae.current===i&&(D||B))return;let l=me();if(!(l!=null&&l.ads)||typeof l.ads.getDisplayAdConfig!="function"){Pe(),_e({type:Y,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 K=f.current+1;f.current=K,ae.current=i,I(!0),x(!1),le(null);try{let L=await l.ads.getDisplayAdConfig(n);if(K!==f.current)return;if(!L||L.code!==0||!L.data){I(!1),x(!0),le(null),_e({type:Y,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(L==null?void 0:L.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:L||null});return}let we=Me(L.data),qe=!!(y.current&&!we.show);I(!1),x(!0),le(L.data),(De=re.current)==null||De.call(re,{type:Y,adId:e,requestOptions:n,data:L.data}),qe&&je(L.data)}catch(L){if(K!==f.current)return;I(!1),x(!0),le(null),_e({type:Y,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:L instanceof Error?L.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:L})}};(0,v.useEffect)(()=>{var n;ot.includes(r)||(n=g.current)==null||n.call(g,{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,v.useEffect)(()=>{if(!e){Pe();return}ie()},[e,u,J,Y,k]);let ce=c(),Z=ce?Me(pe):null,he=Z?Z.unitId:t||"",Ae=Z?Z.customAd:A||null,P=!!(b&&(!ce||!e||B&&(Z!=null&&Z.show))),ye=ve(),Be=JSON.stringify([Y,ye,e,j,E]),oe=w.current;!!(!oe||oe.identity!==Be||!oe.show&&b)?w.current={identity:Be,show:b,shouldCheck:!!(j&&!Fe(e,ye))}:oe&&oe.show!==b&&(w.current=$(h({},oe),{show:b}));let Se=!!((ke=w.current)!=null&&ke.shouldCheck),Te=e||(pe==null?void 0:pe.adId)||"",ee=n=>h({adId:Te},n);return Y==="splash"?(0,Ye.jsx)(We,h({},{unitId:he,customAd:Ae,show:P,zIndex:M,pictureInPicture:X,checkNativeSplash:Se,jumpSeconds:G,className:V,onLoad:i=>{var l;i&&typeof i=="object"&&i.nativeSplash===!0&&$e(),(l=te.current)==null||l.call(te,ee(i))},onError:i=>{var l;(l=g.current)==null||l.call(g,ee(i))},onClose:i=>{var l;(l=R.current)==null||l.call(R,ee(i))},onAction:i=>{var l;(l=F.current)==null||l.call(F,ee(i))},onHide:i=>{var l;(l=ne.current)==null||l.call(ne,ee(i))},onOpenWebview:i=>{var l;(l=U.current)==null||l.call(U,ee(i))}})):P?(0,Ye.jsx)(Ve,h({},{unitId:he,customAd:Ae,adIntervals:z,className:V,onLoad:n=>{var i;(i=te.current)==null||i.call(te,ee(n))},onError:n=>{var i;(i=g.current)==null||i.call(g,ee(n))},onClose:n=>{var i;(i=R.current)==null||i.call(R,ee(n))},onAction:n=>{var i;(i=F.current)==null||i.call(F,ee(n))},onOpenWebview:n=>{var i;(i=U.current)==null||i.call(U,ee(n))}})):null};0&&(module.exports={BiBannerAd,BiDisplayAd,BiSplashAd});
|
|
1
|
+
"use strict";var ct=Object.create;var xe=Object.defineProperty,ut=Object.defineProperties,dt=Object.getOwnPropertyDescriptor,pt=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertyNames,ze=Object.getOwnPropertySymbols,gt=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var Xe=(e,r,n)=>r in e?xe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,h=(e,r)=>{for(var n in r||(r={}))Qe.call(r,n)&&Xe(e,n,r[n]);if(ze)for(var n of ze(r))ft.call(r,n)&&Xe(e,n,r[n]);return e},F=(e,r)=>ut(e,pt(r));var ht=(e,r)=>{for(var n in r)xe(e,n,{get:r[n],enumerable:!0})},Ze=(e,r,n,D)=>{if(r&&typeof r=="object"||typeof r=="function")for(let S of mt(r))!Qe.call(e,S)&&S!==n&&xe(e,S,{get:()=>r[S],enumerable:!(D=dt(r,S))||D.enumerable});return e};var Je=(e,r,n)=>(n=e!=null?ct(gt(e)):{},Ze(r||!e||!e.__esModule?xe(n,"default",{value:e,enumerable:!0}):n,e)),yt=e=>Ze(xe({},"__esModule",{value:!0}),e);var Pt={};ht(Pt,{BiBannerAd:()=>$e,BiDisplayAd:()=>lt,BiSplashAd:()=>je});module.exports=yt(Pt);var Jt=require("./banner/index.scss"),qt=require("./splash/index.scss");var y=require("react"),te=require("@tarojs/components"),at=Je(require("@tarojs/taro"));var Bt=Je(require("@tarojs/components")),ke;function Fe(){if(ke!==void 0)return ke;try{let e=Bt;ke=(e==null?void 0:e.AdCustom)||null}catch(e){ke=null}return ke}var Re=Je(require("@tarojs/taro"));function Ue(){return typeof wx!="undefined"?wx:null}function Be(e,r){let n=e==null?void 0:e.detail;return n&&typeof n=="object"?h(h({},r),n):e&&typeof e=="object"?h(h({},r),e):h({},r)}function et(e){return e?e.mediaType==="video"?e.video||"":e.mediaType==="image"?e.image||"":e.video||e.image||"":""}function tt(e,r=""){return e&&(e.poster||e.image||r)||""}function rt(e,r=""){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(r).trim()):!0}function nt(e){return(e==null?void 0:e.fitMode)==="cover"?"cover":"contain"}function Ve(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function it(e,r=5){let n=e==null?void 0:e.jumpSeconds,D=n!=null?n:r;return Math.min(99,Math.max(0,Number(D)||0))}function We(e){var n;let r=(n=e==null?void 0:e.loadTimeout)!=null?n:e==null?void 0:e.timeout;return Math.max(1e3,Number(r)||5e3)}function At(e,r=!1){var n,D,S,b;if(!e)return"none";if(r){let k=String(((n=e.action)==null?void 0:n.type)||e.jumpType||"").trim().toLowerCase();if(k==="miniprogram")return"miniProgram";if(k==="internal")return"internal";if(k==="web")return"web";if(k==="none")return"none"}return r&&((D=e.action)!=null&&D.appId||e.targetAppId)||e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":r&&((S=e.action)!=null&&S.path||e.targetPath)||e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":r&&((b=e.action)!=null&&b.url||e.jumpUrl)||e.url||e.webUrl||e.h5Url?"web":"none"}function St(e,r=!1){var n;return e&&((r?((n=e.action)==null?void 0:n.appId)||e.targetAppId:"")||e.appId||e.miniProgramAppId||e.jumpAppId)||""}function Dt(e,r=!1){var n;return e&&((r?((n=e.action)==null?void 0:n.path)||e.targetPath:"")||e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function Ct(e,r=!1){var n;return e&&((r?((n=e.action)==null?void 0:n.url)||e.jumpUrl:"")||e.url||e.webUrl||e.h5Url)||""}function He(e){let{customAd:r,actionDetail:n,onOpenWebview:D,onError:S,miniProgramErrorCode:b,navigateErrorCode:k,miniProgramUnsupportedErrorCode:re,preferStandardFields:Y=!1}=e;if(!r)return;let E=At(r,Y),ee=St(r,Y),W=Dt(r,Y),m=Ct(r,Y);if(E==="miniProgram"&&ee){let f=Ue();if(!f||typeof f.navigateToMiniProgram!="function"){S==null||S(F(h({},n),{errCode:re||b,errMsg:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}f.navigateToMiniProgram({appId:ee,path:W||"",fail:J=>{S==null||S(F(h({},n),{errCode:b,errMsg:(J==null?void 0:J.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(E==="internal"&&W){Re.navigateTo({url:W,fail:f=>{S==null||S(F(h({},n),{errCode:k,errMsg:(f==null?void 0:f.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}E==="web"&&m&&(D==null||D(F(h({},n),{url:m})))}function ot(){var R;let e=Ue(),r=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},n=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof Re.getSystemInfoSync=="function"?Re.getSystemInfoSync():{},D=Number(n.windowHeight||0),S=Number(n.screenHeight||0),b=!!(D&&S&&D===S),k=16,re=16,Y=16,E=32,ee=b&&r.top?r.top:Math.max(k,Number(n.statusBarHeight||0)+4),W=b&&r.height?r.height:E,m=b&&r.top?r.top:k,f=b&&r.height?r.height:E,J=Math.max(Y,Number(((R=n.safeArea)==null?void 0:R.left)||0)+Y);return{isFullScreen:b,skipStyle:{top:`${m}px`,width:"156rpx",height:`${f}px`,lineHeight:`${f}px`,borderRadius:`${Math.round(f/2)}px`,left:b?`${Y}px`:void 0,right:b?void 0:`${re}px`},disclosureStyle:{top:`${m}px`,left:`${J}px`,height:`${f}px`,lineHeight:`${f}px`},combinedControlStyle:{top:`${ee}px`,left:`${J}px`,height:`${W}px`}}}var K=require("react/jsx-runtime"),vt=[{label:"\u4E0E\u6211\u65E0\u5173",value:"irrelevant"},{label:"\u91CD\u590D\u6536\u5230\u591A\u6B21",value:"repeated"},{label:"\u5185\u5BB9\u592A\u5DEE",value:"poorContent"}];function wt(e,r,n){return e&&r?n==="custom-first"||n==="custom-only"?"custom":"wechat":e?"wechat":r?"custom":null}var $e=({unitId:e="",customAd:r,priority:n="wechat-first",adIntervals:D=30,className:S,onLoad:b,onError:k,onClose:re,onAction:Y,onFeedback:E,onOpenWebview:ee})=>{let W=(0,y.useMemo)(()=>Fe(),[]),m=r||null,f=!!(m!=null&&m.image),J=!!(e&&W),R=wt(J,f,n),d=JSON.stringify([e,m,n,!!W]),[q,he]=(0,y.useState)(!!R),[z,ce]=(0,y.useState)(R),[ie,Ae]=(0,y.useState)(!1),[ue,X]=(0,y.useState)("primary"),x=(0,y.useRef)(R),L=(0,y.useRef)({wechat:!1,custom:!1}),O=(0,y.useRef)(!1),j=(0,y.useRef)(null),_=(0,y.useRef)(b),g=(0,y.useRef)(k),C=(0,y.useRef)(re),de=(0,y.useRef)(Y),I=(0,y.useRef)(E),G=(0,y.useRef)(ee);(0,y.useEffect)(()=>{_.current=b,g.current=k,C.current=re,de.current=Y,I.current=E,G.current=ee},[Y,re,k,E,b,ee]);let N=(0,y.useCallback)(o=>{let s=o==="custom"&&m?{configId:m.configId,placementId:m.placementId,configName:m.configName,advertPlatform:m.advertPlatform}:{};return h({provider:o,type:"banner"},s)},[m]),v=(0,y.useCallback)(()=>{j.current&&(clearTimeout(j.current),j.current=null)},[]),Q=(0,y.useCallback)(()=>{Ae(!1),X("primary")},[]),pe=(0,y.useCallback)(o=>{v(),x.current=o,O.current=!1,ce(o),he(!0),Q()},[v,Q]),me=(0,y.useCallback)((o,s)=>{var $;let p=!!e&&f?"allProvidersFailed":o==="wechat"?"wechatAdLoadFail":"customMediaLoadFail";v(),x.current=null,ce(null),he(!1),Q(),($=C.current)==null||$.call(C,{provider:o,type:"banner",reason:p,error:s})},[v,Q,f,e]),ge=(0,y.useCallback)((o,s,u,p)=>{var ve;if(x.current!=="custom"||L.current.custom)return;v();let $=Be(o,N("custom")),ae=F(h({},$),{errorType:s,errCode:u,errMsg:p,mediaType:"image",rawErrCode:$.errCode,rawErrMsg:$.errMsg});if(L.current.custom=!0,(ve=g.current)==null||ve.call(g,ae),J&&!L.current.wechat){pe("wechat");return}me("custom",ae)},[J,v,N,me,pe]);(0,y.useEffect)(()=>(v(),L.current={wechat:!1,custom:!1},O.current=!1,x.current=R,ce(R),he(!!R),Q(),v),[v,Q,d,R]),(0,y.useEffect)(()=>{if(v(),!(!q||z!=="custom"||!f))return j.current=setTimeout(()=>{O.current||x.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")},We(m)),v},[v,ge,f,z,m,q]),(0,y.useEffect)(()=>{var s,u;if(!e||W)return;let o=F(h({},N("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=g.current)==null||s.call(g,o),f||(u=C.current)==null||u.call(C,F(h({},N("wechat")),{reason:"wechatAdLoadFail",error:o}))},[W,N,f,e]);let U=o=>{var s;x.current==="wechat"&&((s=_.current)==null||s.call(_,Be(o,N("wechat"))))},V=o=>{var p;if(x.current!=="wechat"||L.current.wechat)return;let s=o!=null&&o.detail&&typeof o.detail=="object"?o.detail:{},u=F(h({},Be(o,N("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(L.current.wechat=!0,(p=g.current)==null||p.call(g,u),f&&!L.current.custom){pe("custom");return}me("wechat",u)},oe=o=>{var s;x.current==="wechat"&&((s=C.current)==null||s.call(C,Be(o,N("wechat"))))},H=()=>{var o;x.current!=="custom"||O.current||(v(),O.current=!0,(o=_.current)==null||o.call(_,N("custom")))},Se=()=>{var s;if(ie){Q();return}let o=N("custom");(s=de.current)==null||s.call(de,o),He({customAd:m,actionDetail:o,onOpenWebview:u=>{var p;return(p=G.current)==null?void 0:p.call(G,u)},onError:u=>{var p;return(p=g.current)==null?void 0:p.call(g,u)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL",preferStandardFields:!0})},Ee=o=>{var s;(s=o.stopPropagation)==null||s.call(o),Ae(u=>!u),X("primary")},De=o=>{var s;(s=o.stopPropagation)==null||s.call(o)},ye=o=>{var s,u;(s=o.stopPropagation)==null||s.call(o),Q(),(u=I.current)==null||u.call(I,F(h({},N("custom")),{provider:"custom",action:"report"})),at.showToast({title:"\u5DF2\u6536\u5230\u60A8\u7684\u53CD\u9988\uFF0C\u6211\u4EEC\u4F1A\u5C3D\u5FEB\u5904\u7406~",icon:"none",duration:2e3})},fe=(o,s)=>{var p,$,ae;(p=o.stopPropagation)==null||p.call(o);let u=F(h({},N("custom")),{provider:"custom",action:"dislike",reason:s.value,reasonText:s.label});v(),x.current=null,ce(null),he(!1),Q(),($=I.current)==null||$.call(I,u),(ae=C.current)==null||ae.call(C,F(h({},N("custom")),{reason:"notInterested",feedbackReason:s.value,feedbackReasonText:s.label}))},Ce=`bi-banner-ad${S?` ${S}`:""}`;return!q||!z?null:z==="wechat"&&W?(0,K.jsx)(W,{className:Ce,unitId:e,adIntervals:D,onLoad:U,onError:V,onClose:oe}):z!=="custom"||!(m!=null&&m.image)?null:(0,K.jsxs)(te.View,{className:Ce,children:[(0,K.jsx)(te.View,{className:"bi-banner-ad__surface",onClick:Se,children:(0,K.jsx)(te.Image,{className:"bi-banner-ad__image",src:m.image,mode:"widthFix",onLoad:H,onError:o=>ge(o,"CUSTOM_MEDIA_LOAD_FAIL","BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")})}),(0,K.jsxs)(te.View,{className:"bi-banner-ad__badge",onClick:Ee,children:[(0,K.jsx)(te.Text,{children:Ve(m)}),(0,K.jsx)(te.View,{className:"bi-banner-ad__badge-arrow"})]}),ie?(0,K.jsx)(te.View,{className:"bi-banner-ad__feedback-panel",onClick:De,children:ue==="primary"?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(te.View,{className:"bi-banner-ad__feedback-source",children:"\u7531\u8D5E\u52A9\u5546\u63D0\u4F9B\u7684\u5185\u5BB9"}),(0,K.jsx)(te.View,{className:"bi-banner-ad__feedback-item",onClick:o=>{var s;(s=o.stopPropagation)==null||s.call(o),X("dislike")},children:"\u4E0D\u611F\u5174\u8DA3"}),(0,K.jsx)(te.View,{className:"bi-banner-ad__feedback-item",onClick:ye,children:"\u53CD\u9988\u95EE\u9898"})]}):vt.map(o=>(0,K.jsx)(te.View,{className:"bi-banner-ad__feedback-item",onClick:s=>fe(s,o),children:o.label},o.value))}):null]})};var l=require("react"),B=require("@tarojs/components");var A=require("react/jsx-runtime");function bt(e,r,n){return e&&r?n==="custom-first"||n==="custom-only"?"custom":"wechat":e?"wechat":r?"custom":null}var je=({unitId:e="",customAd:r,priority:n="wechat-first",show:D=!0,zIndex:S=999,pictureInPicture:b=!1,checkNativeSplash:k=!0,jumpSeconds:re=5,className:Y,onLoad:E,onError:ee,onClose:W,onAction:m,onHide:f,onOpenWebview:J})=>{let R=(0,l.useMemo)(()=>Fe(),[]),d=r||null,q=(0,l.useMemo)(()=>et(d),[d]),he=(0,l.useMemo)(()=>tt(d,q),[q,d]),z=(0,l.useMemo)(()=>rt(d,q),[q,d]),ce=(0,l.useMemo)(()=>nt(d),[d]),ie=(0,l.useMemo)(()=>it(d,re),[re,d]),Ae=(0,l.useMemo)(()=>Ve(d),[d]),ue=(0,l.useMemo)(()=>ot(),[]),X=!!(e&&R),x=!!(q||d!=null&&d.mediaType),L=!!q,O=bt(X,x,n),j=JSON.stringify([e,d,n,!!R]),[_,g]=(0,l.useState)(!1),[C,de]=(0,l.useState)(O),[I,G]=(0,l.useState)(!1),[N,v]=(0,l.useState)(0),[Q,pe]=(0,l.useState)(!1),[me,ge]=(0,l.useState)(!1),U=(0,l.useRef)(O),V=(0,l.useRef)({wechat:!1,custom:!1}),oe=(0,l.useRef)(!1),H=(0,l.useRef)(!1),Se=(0,l.useRef)(!1),Ee=(0,l.useRef)({identity:j,show:!1}),De=(0,l.useRef)(0),ye=(0,l.useRef)(null),fe=(0,l.useRef)(null),Ce=(0,l.useRef)(null),o=(0,l.useRef)(null),s=(0,l.useRef)(E),u=(0,l.useRef)(ee),p=(0,l.useRef)(W),$=(0,l.useRef)(m),ae=(0,l.useRef)(f),ve=(0,l.useRef)(J);(0,l.useEffect)(()=>{s.current=E,u.current=ee,p.current=W,$.current=m,ae.current=f,ve.current=J},[m,W,ee,f,E,J]),(0,l.useEffect)(()=>{var t;!D||!e||R||(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"})},[R,D,e]);let ne=t=>{let c=t==="custom"&&d?{configId:d.configId,placementId:d.placementId,configName:d.configName,advertPlatform:d.advertPlatform}:{};return h({provider:t,type:"splash"},c)},M=(0,l.useCallback)(()=>{ye.current&&clearInterval(ye.current),fe.current&&clearTimeout(fe.current),Ce.current&&clearTimeout(Ce.current),o.current&&clearTimeout(o.current),ye.current=null,fe.current=null,Ce.current=null,o.current=null},[]),se=(0,l.useCallback)((t,c)=>{M(),U.current=t,oe.current=!1,de(t),g(c),G(!1),v(ie),pe(!1),ge(!1)},[M,ie]),be=(0,l.useCallback)((t,c)=>{var Me;let Pe=x&&(t==="custom"||X&&V.current.wechat&&V.current.custom),Ie=Pe?"allProvidersFailed":"wechatAdLoadFail";M(),g(!1),G(!1),v(0),pe(!1),ge(!1),(Me=p.current)==null||Me.call(p,{provider:Pe?"none":t,type:"splash",reason:Ie,error:c})},[X,M,x]),we=(0,l.useCallback)(()=>{if(!(ye.current||!U.current)){if(pe(!0),ie<=0){v(0);return}v(ie),ye.current=setInterval(()=>{v(t=>Math.max(0,t-1))},1e3)}},[ie]),Ne=(0,l.useCallback)(()=>{L&&(fe.current=setTimeout(()=>{var c;if(oe.current||U.current!=="custom")return;let t=F(h({},ne("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=u.current)==null||c.call(u,t),V.current.custom=!0,X&&!V.current.wechat?(se("wechat",!0),we()):be("custom",t)},We(d)))},[X,be,L,z,se,d,we]),_e=(0,l.useCallback)(t=>{se(t,!0),t==="wechat"?we():L&&Ne()},[L,se,we,Ne]),Te=(0,l.useCallback)((t,c,T,w)=>{var Me;if(U.current!=="custom"||V.current.custom)return;let Pe=Be(t,ne("custom")),Ie=F(h({},Pe),{errorType:c,errCode:T,errMsg:w,mediaType:z?"image":"video",rawErrCode:Pe.errCode,rawErrMsg:Pe.errMsg});(Me=u.current)==null||Me.call(u,Ie),V.current.custom=!0,X&&!V.current.wechat?_e("wechat"):be("custom",Ie)},[X,be,z,_e]),le=(0,l.useCallback)(()=>{var t;if(H.current){g(!1);return}if(!O){se(null,!1),Se.current||(Se.current=!0,(t=p.current)==null||t.call(p,{provider:"none",type:"splash",reason:"noAd"}));return}_e(O),O==="custom"&&!L&&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,L,O,se,_e]),Le=(0,l.useCallback)(()=>{if(!D||H.current)return;if(!k){le();return}let t=Ue();if(!(t!=null&&t.getShowSplashAdStatus)||De.current>=3){le();return}t.getShowSplashAdStatus({success:c=>{var T;if((c==null?void 0:c.code)===-1){De.current+=1,Ce.current=setTimeout(Le,300);return}if((c==null?void 0:c.code)===1){M(),H.current=!0,g(!1),(T=s.current)==null||T.call(s,{provider:"wechat",type:"splash",nativeSplash:!0});return}le()},fail:le})},[le,k,M,D]);(0,l.useEffect)(()=>{let t=Ee.current,c=D&&!t.show||t.identity!==j;if(Ee.current={identity:j,show:D},!D){H.current=!1,Se.current=!1,V.current={wechat:!1,custom:!1},se(O,!1);return}if(!H.current)return c&&(Se.current=!1),V.current={wechat:!1,custom:!1},H.current=!1,De.current=0,se(O,!1),Le(),M},[Le,M,j,O,se,D]),(0,l.useEffect)(()=>{var c;if(!Q||N!==0||!_||I||!U.current)return;let t=U.current;if(b){M(),ge(!0),o.current=setTimeout(()=>{var T;G(!0),ge(!1),(T=ae.current)==null||T.call(ae,ne(t))},280);return}M(),g(!1),(c=p.current)==null||c.call(p,ne(t))},[M,Q,b,N,I,_]);let Ge=t=>{var c;U.current==="wechat"&&(we(),(c=s.current)==null||c.call(s,Be(t,ne("wechat"))))},Ke=t=>{var w;if(U.current!=="wechat"||V.current.wechat)return;let c=t!=null&&t.detail&&typeof t.detail=="object"?t.detail:{},T=F(h({},Be(t,ne("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});(w=u.current)==null||w.call(u,T),V.current.wechat=!0,x&&!V.current.custom?(_e("custom"),L||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")):be("wechat",T)},Z=()=>{var t;U.current!=="custom"||oe.current||(fe.current&&clearTimeout(fe.current),fe.current=null,oe.current=!0,we(),(t=s.current)==null||t.call(s,ne("custom")))},Ye=t=>{var T;(T=t==null?void 0:t.stopPropagation)==null||T.call(t),U.current&&(pe(!0),v(0))},Oe=()=>{var c;if(U.current!=="custom")return;let t=ne("custom");(c=$.current)==null||c.call($,t),He({customAd:d,actionDetail:t,onOpenWebview:T=>{var w;return(w=ve.current)==null?void 0:w.call(ve,T)},onError:T=>{var w;return(w=u.current)==null?void 0:w.call(u,T)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL",preferStandardFields:!0})},i=t=>{var c;M(),g(!1),G(!1),v(0),pe(!1),(c=p.current)==null||c.call(p,t)},a=["bi-splash-ad",I?"bi-splash-ad--pip":"",me?"bi-splash-ad--pip-animating":"",Y||""].filter(Boolean).join(" ");return!_||!C?null:(0,A.jsxs)(B.View,{className:a,style:{zIndex:S},children:[C==="wechat"&&R?(0,A.jsx)(B.View,{className:"bi-splash-ad__popup",children:(0,A.jsx)(B.View,{className:`bi-splash-ad__media-wrapper${I?" bi-splash-ad__media-wrapper--pip":""}`,children:(0,A.jsx)(R,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:Ge,onError:Ke,onClose:t=>i(Be(t,ne("wechat")))})})}):C==="custom"&&L?(0,A.jsx)(B.View,{className:"bi-splash-ad__popup bi-splash-ad__custom",children:(0,A.jsxs)(B.View,{className:"bi-splash-ad__media-shell",onClick:Oe,children:[z?(0,A.jsx)(B.Image,{className:"bi-splash-ad__media",src:q,mode:ce==="cover"?"aspectFill":"aspectFit",onLoad:Z,onError:t=>Te(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,A.jsx)(B.Video,{className:"bi-splash-ad__video",src:q,poster:he,autoplay:!0,muted:(d==null?void 0:d.muted)!==!1,loop:!0,objectFit:ce,showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:Z,onError:t=>Te(t,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}),I?(0,A.jsx)(B.View,{className:"bi-splash-ad__pip-mask"}):null,!I&&!ue.isFullScreen?(0,A.jsxs)(B.View,{className:"bi-splash-ad__disclosure",style:ue.disclosureStyle,children:[(0,A.jsx)(B.Text,{children:Ae}),(0,A.jsx)(B.View,{className:"bi-splash-ad__disclosure-arrow"})]}):null,!I&&(d!=null&&d.bottomImage)?(0,A.jsx)(B.Image,{className:"bi-splash-ad__bottom-image",src:d.bottomImage,mode:"widthFix"}):null]})}):null,I?(0,A.jsx)(B.View,{className:"bi-splash-ad__pip-close",onClick:()=>i(ne(C)),children:(0,A.jsx)(B.View,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,!I&&ue.isFullScreen&&C==="custom"?(0,A.jsxs)(B.View,{className:"bi-splash-ad__combined-control",style:ue.combinedControlStyle,children:[(0,A.jsxs)(B.View,{className:"bi-splash-ad__combined-capsule",children:[(0,A.jsxs)(B.View,{className:"bi-splash-ad__combined-disclosure",children:[(0,A.jsx)(B.Text,{children:Ae}),(0,A.jsx)(B.View,{className:"bi-splash-ad__disclosure-arrow"})]}),(0,A.jsx)(B.View,{className:"bi-splash-ad__combined-divider"}),(0,A.jsx)(B.View,{className:"bi-splash-ad__combined-skip",onClick:Ye,children:"\u8DF3\u8FC7"})]}),(0,A.jsxs)(B.Text,{className:"bi-splash-ad__combined-countdown",children:[N," \u79D2"]})]}):I?null:(0,A.jsxs)(B.View,{className:"bi-splash-ad__skip",style:ue.skipStyle,onClick:Ye,children:[(0,A.jsxs)(B.Text,{children:[N,"s"]}),(0,A.jsx)(B.View,{className:"bi-splash-ad__skip-divider"}),(0,A.jsx)(B.Text,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};var P=require("react");var qe=require("react/jsx-runtime"),_t="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",Tt=300*1e3,st=["banner","splash"],lt=({adId:e="",unitId:r,type:n="banner",customAd:D,priority:S="wechat-first",adOptions:b=null,sdkKey:k="biNova",autoLoad:re=!0,adIntervals:Y=30,show:E=!0,zIndex:ee=999,pictureInPicture:W=!1,checkNativeSplash:m=!0,nativeSplashCache:f=!0,jumpSeconds:J=5,className:R,onLoad:d,onError:q,onClose:he,onAction:z,onFeedback:ce,onHide:ie,onOpenWebview:Ae,onConfigLoad:ue,onConfigError:X})=>{var Oe;let x=(0,P.useRef)(0),L=(0,P.useRef)(""),O=(0,P.useRef)(null),j=(0,P.useRef)(d),_=(0,P.useRef)(q),g=(0,P.useRef)(he),C=(0,P.useRef)(z),de=(0,P.useRef)(ce),I=(0,P.useRef)(ie),G=(0,P.useRef)(Ae),N=(0,P.useRef)(ue),v=(0,P.useRef)(X),Q=(0,P.useRef)(E),[pe,me]=(0,P.useState)(!1),[ge,U]=(0,P.useState)(!1),[V,oe]=(0,P.useState)(null);(0,P.useEffect)(()=>{j.current=d,_.current=q,g.current=he,C.current=z,de.current=ce,I.current=ie,G.current=Ae,N.current=ue,v.current=X,Q.current=E},[z,he,X,ue,q,ce,ie,d,Ae,E]);let H=(0,P.useMemo)(()=>st.includes(n)?n:"banner",[n]),Se=()=>!!(re&&e),Ee=()=>{var c;let i=globalThis.getApp,a=typeof i=="function"?i():null;if(!a)return null;let t=a;return t[k]||((c=t.globalData)==null?void 0:c[k])||null},De=()=>{var i;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let a=wx.getAccountInfoSync();return((i=a==null?void 0:a.miniProgram)==null?void 0:i.appId)||""}}catch(a){return""}return""},ye=(i,a)=>`${_t}_${a||"unknown"}_${i||"empty"}`,fe=(i,a)=>{if(!f||!i||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let t=ye(i,a),c=Number(wx.getStorageSync(t)||0),T=Date.now()-c;return c>0&&T>=0&&T<=Tt}catch(t){return!1}},Ce=()=>{if(f&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let i=ye(e,De());wx.setStorageSync(i,Date.now())}catch(i){}},o=()=>{x.current+=1,L.current="",me(!1),U(!1),oe(null)},s=()=>{let i=b&&typeof b=="object"?b:{},a=De();return F(h({},i),{adId:e,placementId:i.placementId||e,appId:i.appId||a,type:H})},u=i=>{try{return JSON.stringify(i||{})}catch(a){return`${String(i.appId||"")}_${String(i.placementId||"")}`}},p=i=>{let a=(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:!!(a||t);return{unitId:a,customAd:t,priority:(i==null?void 0:i.priority)||"wechat-first",show:c}},$=i=>{var a,t;(a=v.current)==null||a.call(v,i),(t=_.current)==null||t.call(_,i)},ae=i=>{var a;(a=g.current)==null||a.call(g,{type:H,adId:e||i.adId||"",provider:"none",reason:"noAd"})},ve=async()=>{var T;if(!Se())return;let i=s(),a=u(i);if(L.current===a&&(pe||ge))return;let t=Ee();if(!(t!=null&&t.ads)||typeof t.ads.getDisplayAdConfig!="function"){o(),$({type:H,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=x.current+1;x.current=c,L.current=a,me(!0),U(!1),oe(null);try{let w=await t.ads.getDisplayAdConfig(i);if(c!==x.current)return;if(!w||w.code!==0||!w.data){me(!1),U(!0),oe(null),$({type:H,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(w==null?void 0:w.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:w||null});return}let Pe=p(w.data),Ie=!!(Q.current&&!Pe.show);me(!1),U(!0),oe(w.data),(T=N.current)==null||T.call(N,{type:H,adId:e,requestOptions:i,data:w.data}),Ie&&ae(w.data)}catch(w){if(c!==x.current)return;me(!1),U(!0),oe(null),$({type:H,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:w instanceof Error?w.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:w})}};(0,P.useEffect)(()=>{var i;st.includes(n)||(i=_.current)==null||i.call(_,{type:"banner",errCode:"UNSUPPORTED_DISPLAY_AD_TYPE",errMsg:`\u4E0D\u652F\u6301\u7684\u5C55\u793A\u5E7F\u544A\u7C7B\u578B\uFF1A${n}\uFF0C\u8BF7\u4F7F\u7528 "banner" \u6216 "splash"`})},[n]),(0,P.useEffect)(()=>{if(!e){o();return}ve()},[e,b,re,H,k]);let ne=Se(),M=ne?p(V):null,se=M?M.unitId:r||"",be=M?M.customAd:D||null,we=M?M.priority:S,Ne=!!(E&&(!ne||!e||ge&&(M!=null&&M.show))),_e=De(),Te=JSON.stringify([H,_e,e,m,f]),le=O.current;!!(!le||le.identity!==Te||!le.show&&E)?O.current={identity:Te,show:E,shouldCheck:!!(m&&!fe(e,_e))}:le&&le.show!==E&&(O.current=F(h({},le),{show:E}));let Ge=!!((Oe=O.current)!=null&&Oe.shouldCheck),Ke=e||(V==null?void 0:V.adId)||"",Z=i=>h({adId:Ke},i);return H==="splash"?(0,qe.jsx)(je,h({},{unitId:se,customAd:be,priority:we,show:Ne,zIndex:ee,pictureInPicture:W,checkNativeSplash:Ge,jumpSeconds:J,className:R,onLoad:a=>{var t;a&&typeof a=="object"&&a.nativeSplash===!0&&Ce(),(t=j.current)==null||t.call(j,Z(a))},onError:a=>{var t;(t=_.current)==null||t.call(_,Z(a))},onClose:a=>{var t;(t=g.current)==null||t.call(g,Z(a))},onAction:a=>{var t;(t=C.current)==null||t.call(C,Z(a))},onHide:a=>{var t;(t=I.current)==null||t.call(I,Z(a))},onOpenWebview:a=>{var t;(t=G.current)==null||t.call(G,Z(a))}})):Ne?(0,qe.jsx)($e,h({},{unitId:se,customAd:be,priority:we,adIntervals:Y,className:R,onLoad:i=>{var a;(a=j.current)==null||a.call(j,Z(i))},onError:i=>{var a;(a=_.current)==null||a.call(_,Z(i))},onClose:i=>{var a;(a=g.current)==null||a.call(g,Z(i))},onAction:i=>{var a;(a=C.current)==null||a.call(C,Z(i))},onFeedback:i=>{var a;(a=de.current)==null||a.call(de,Z(i))},onOpenWebview:i=>{var a;(a=G.current)==null||a.call(G,Z(i))}})):null};0&&(module.exports={BiBannerAd,BiDisplayAd,BiSplashAd});
|
package/dist/ad/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Bt=Object.defineProperty,St=Object.defineProperties;var Dt=Object.getOwnPropertyDescriptors;var it=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable;var st=(e,i,r)=>i in e?Bt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,g=(e,i)=>{for(var r in i||(i={}))Ct.call(i,r)&&st(e,r,i[r]);if(it)for(var r of it(i))vt.call(i,r)&&st(e,r,i[r]);return e},U=(e,i)=>St(e,Dt(i));import"./banner/index.scss";import"./splash/index.scss";import{useCallback as mt,useEffect as Je,useMemo as gt,useRef as fe,useState as Nt}from"react";import{View as Te,Image as It,Button as ft,Text as ze}from"@tarojs/components";import*as bt from"@tarojs/components";var Me;function Ve(){if(Me!==void 0)return Me;try{let e=bt;Me=(e==null?void 0:e.AdCustom)||null}catch(e){Me=null}return Me}import*as ve from"@tarojs/taro";function We(){return typeof wx!="undefined"?wx:null}function ue(e,i){let r=e==null?void 0:e.detail;return r&&typeof r=="object"?g(g({},i),r):e&&typeof e=="object"?g(g({},i),e):g({},i)}function at(e){return e&&(e.image||e.video)||""}function ot(e,i=""){return e&&(e.poster||e.image||i)||""}function lt(e,i=""){return e?e.video?!1:e.image?!0:/\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(String(i).trim()):!0}function ut(e){if(!e)return 2;let i=Number(e.adSpec||e.spec||0);if(i===1||i===2)return i;let r=Number(e.videoWidth||e.width||0),B=Number(e.videoHeight||e.height||0);return r>0&&B>0?r>B?1:2:e.video?1:2}function Fe(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function ct(e,i=5){let r=e==null?void 0:e.jumpSeconds,B=r!=null?r:i;return Math.min(99,Math.max(0,Number(B)||0))}function ke(e){var r;let i=(r=e==null?void 0:e.loadTimeout)!=null?r:e==null?void 0:e.timeout;return Math.max(1e3,Number(i)||5e3)}function _t(e){return e?e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":e.url||e.webUrl||e.h5Url?"web":"none":"none"}function Tt(e){return e&&(e.appId||e.miniProgramAppId||e.jumpAppId)||""}function wt(e){return e&&(e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function Et(e){return e&&(e.url||e.webUrl||e.h5Url)||""}function $e(e){let{customAd:i,actionDetail:r,onOpenWebview:B,onError:f,miniProgramErrorCode:N,navigateErrorCode:j,miniProgramUnsupportedErrorCode:G}=e;if(!i)return;let S=_t(i),E=Tt(i),Y=wt(i),O=Et(i);if(S==="miniProgram"&&E){let v=We();if(!v||typeof v.navigateToMiniProgram!="function"){f==null||f(U(g({},r),{errCode:G||N,errMsg:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}v.navigateToMiniProgram({appId:E,path:Y||"",fail:V=>{f==null||f(U(g({},r),{errCode:N,errMsg:(V==null?void 0:V.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(S==="internal"&&Y){ve.navigateTo({url:Y,fail:v=>{f==null||f(U(g({},r),{errCode:j,errMsg:(v==null?void 0:v.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}S==="web"&&O&&(B==null||B(U(g({},r),{url:O})))}function dt(){let e=We(),i=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},r=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof ve.getSystemInfoSync=="function"?ve.getSystemInfoSync():{},B=r.windowHeight===r.screenHeight,f=16,N=16,j=16,G=32,S=B&&i.top?i.top:f,E=B&&i.height?i.height:G;return{top:`${S}px`,width:"156rpx",height:`${E}px`,lineHeight:`${E}px`,borderRadius:`${Math.round(E/2)}px`,left:B?`${j}px`:void 0,right:B?void 0:`${N}px`}}function pt(){var f;let e=typeof ve.getSystemInfoSync=="function"?ve.getSystemInfoSync():{},i=Math.max(0,Number(e.screenHeight||0)-Number(((f=e.safeArea)==null?void 0:f.bottom)||e.windowHeight||0)),r=i>0?i+42:84,B=i>0?i+88:130;return{contentStyle:{bottom:`${r}rpx`},badgeStyle:{bottom:`${B}rpx`}}}import{jsx as he,jsxs as Re}from"react/jsx-runtime";var Xe=({unitId:e="",customAd:i,adIntervals:r=30,className:B,onLoad:f,onError:N,onClose:j,onAction:G,onOpenWebview:S})=>{let E=gt(()=>Ve(),[]),Y=!!(e&&E),O=fe(null),v=fe(!1),V=fe(!1),k=fe(f),c=fe(N),K=fe(j),D=fe(G),R=fe(S),[ne,b]=Nt(!1),u=i||null,ge=gt(()=>`bi-banner-ad${B?` ${B}`:""}`,[B]);Je(()=>{k.current=f,c.current=N,K.current=j,D.current=G,R.current=S},[G,j,N,f,S]);let m=a=>({provider:a,type:"banner"}),re=mt(()=>{O.current&&(clearTimeout(O.current),O.current=null)},[]),C=mt((a,h)=>{var y;V.current||(V.current=!0,re(),b(!0),(y=c.current)==null||y.call(c,g(g({},ue(a,m("custom"))),h)))},[re]);Je(()=>{if(re(),v.current=!1,V.current=!1,b(!1),!(Y||!(u!=null&&u.image)))return O.current=setTimeout(()=>{C(void 0,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})},ke(u)),()=>{re()}},[re,u,Y,C]),Je(()=>{var a;!e||E||(a=c.current)==null||a.call(c,U(g({},m("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"}))},[E,e]);let z=a=>{var h;(h=k.current)==null||h.call(k,ue(a,m("wechat")))},p=a=>{var h;(h=c.current)==null||h.call(c,ue(a,m("wechat")))},I=a=>{var h;(h=K.current)==null||h.call(K,ue(a,m("wechat")))},L=()=>{var a;v.current||V.current||(re(),v.current=!0,(a=k.current)==null||a.call(k,m("custom")))},X=a=>{C(a,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},P=a=>{var y,_;(y=a==null?void 0:a.stopPropagation)==null||y.call(a);let h=m("custom");(_=D.current)==null||_.call(D,h),$e({customAd:u,actionDetail:h,onOpenWebview:A=>{var T;(T=R.current)==null||T.call(R,A)},onError:A=>{var T;(T=c.current)==null||T.call(c,A)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL"})},Q=a=>{var h,y;(h=a==null?void 0:a.stopPropagation)==null||h.call(a),(y=K.current)==null||y.call(K,m("custom"))};return Y&&E?he(E,{className:ge,unitId:e,adIntervals:r,onLoad:z,onError:p,onClose:I}):!u||!u.image||ne?null:Re(Te,{className:ge,children:[Re(Te,{className:"bi-banner-ad__surface",onClick:P,children:[Re(Te,{className:"bi-banner-ad__media",children:[he(ze,{className:"bi-banner-ad__badge bi-banner-ad__badge--overlay",children:Fe(u)}),he(It,{className:"bi-banner-ad__image",src:u.image||"",mode:"aspectFill",onLoad:L,onError:X})]}),Re(Te,{className:"bi-banner-ad__content",children:[he(Te,{className:"bi-banner-ad__body",children:u.title?he(ze,{className:"bi-banner-ad__title",children:u.title}):null}),Re(Te,{className:"bi-banner-ad__footer",children:[u.description?he(ze,{className:"bi-banner-ad__description",children:u.description}):null,he(ft,{className:"bi-banner-ad__button",onClick:P,children:u.buttonText||"\u7ACB\u5373\u67E5\u770B"})]})]})]}),he(ft,{className:"bi-banner-ad__close",onClick:Q,children:"\xD7"})]})};import{useCallback as se,useEffect as Qe,useMemo as ce,useRef as H,useState as we}from"react";import{View as ee,Image as ht,Video as xt,Button as Pt,Text as He}from"@tarojs/components";import{Fragment as Mt,jsx as M,jsxs as Ee}from"react/jsx-runtime";var Ze=({unitId:e="",customAd:i,show:r=!0,zIndex:B=999,pictureInPicture:f=!1,checkNativeSplash:N=!0,jumpSeconds:j=5,className:G,onLoad:S,onError:E,onClose:Y,onAction:O,onHide:v,onOpenWebview:V})=>{let k=ce(()=>Ve(),[]),c=!!(e&&k),[K,D]=we(!1),[R,ne]=we(c),[b,u]=we(!1),[ge,m]=we(0),[re,C]=we(!1),[z,p]=we(!1),I=H(null),L=H(null),X=H(null),P=H(null),Q=H(null),a=H(0),h=H(!1),y=H(!1),_=H(S),A=H(E),T=H(Y),de=H(O),ae=H(v),W=H(V),l=i||null,pe=ce(()=>at(l),[l]),be=ce(()=>ot(l,pe),[l,pe]),me=!!pe,je=ce(()=>lt(l,pe),[l,pe]),Ge=ce(()=>ut(l),[l]),Le=ce(()=>Fe(l),[l]),oe=ce(()=>ct(l,j),[l,j]),Ye=ce(()=>dt(),[]),{contentStyle:Ue,badgeStyle:Ne}=ce(()=>pt(),[]),Ke=ce(()=>{let s=["bi-splash-ad"];return b&&s.push("bi-splash-ad--pip"),z&&s.push("bi-splash-ad--pip-animating"),G&&s.push(G),s.join(" ")},[G,z,b]);Qe(()=>{_.current=S,A.current=E,T.current=Y,de.current=O,ae.current=v,W.current=V},[O,Y,E,v,S,V]);let Z=s=>({provider:s,type:"splash"});Qe(()=>{var s;!r||!e||k||(s=A.current)==null||s.call(A,U(g({},Z("wechat")),{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,r,e]);let le=se(()=>{I.current&&(clearInterval(I.current),I.current=null),L.current&&(clearTimeout(L.current),L.current=null)},[]),q=se(()=>{X.current&&(clearTimeout(X.current),X.current=null)},[]),Ae=se(()=>{P.current&&(clearTimeout(P.current),P.current=null)},[]),ye=se(()=>{Q.current&&(clearTimeout(Q.current),Q.current=null)},[]),w=se(()=>{le(),q(),Ae(),ye()},[le,q,ye,Ae]),Be=se(s=>{var d;w(),D(!1),u(!1),m(0),C(!1),y.current=!1,p(!1),(d=T.current)==null||d.call(T,s)},[w]),Se=se(()=>{let s=R?"wechat":"custom";if(f){le(),q(),ye(),p(!0),Q.current=setTimeout(()=>{var d;Q.current=null,u(!0),p(!1),(d=ae.current)==null||d.call(ae,Z(s))},280);return}Be({type:"splash",provider:s})},[le,q,ye,Be,R,f]),ie=se(()=>{if(le(),oe<=0){Se();return}m(oe),I.current=setInterval(()=>{m(s=>s<=1?(le(),L.current=setTimeout(()=>{L.current=null,Se()},0),0):s-1)},1e3)},[le,oe,Se]),qe=se(s=>{!r||!c||!s||b||ie()},[c,r,b,ie]),De=se(()=>{let s=!!(!h.current&&(c||me));w(),ne(c),D(s),u(!1),m(oe),C(!1),y.current=!1,p(!1),qe(s),s&&!c&&me&&(X.current=setTimeout(()=>{var d;y.current||(w(),D(!1),u(!1),m(0),C(!1),y.current=!1,p(!1),(d=A.current)==null||d.call(A,U(g({},Z("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},ke(l)))},[c,w,oe,me,l,qe]),Ie=se(()=>{if(!r)return;if(h.current){D(!1);return}if(!N){De();return}let s=We();if(!s||typeof s.getShowSplashAdStatus!="function"||a.current>=3){De();return}s.getShowSplashAdStatus({success:d=>{var $;if((d==null?void 0:d.code)===-1){a.current+=1,Ae(),P.current=setTimeout(()=>{P.current=null,Ie()},300);return}if((d==null?void 0:d.code)===1){w(),D(!1),h.current=!0,($=_.current)==null||$.call(_,{provider:"wechat",type:"splash",nativeSplash:!0});return}De()},fail:()=>{De()}})},[c,N,w,Ae,me,De,r]);Qe(()=>{if(!r){w(),D(!1),ne(c),u(!1),m(0),C(!1),y.current=!1,p(!1),h.current=!1;return}return a.current=0,h.current?(w(),ne(c),D(!1),u(!1),m(0),C(!1),y.current=!1,p(!1),()=>{w()}):(N||(h.current=!1),w(),ne(c),D(!1),u(!1),m(oe),C(!1),y.current=!1,p(!1),Ie(),()=>{w()})},[c,N,Ie,w,oe,r]);let J=s=>{var d;ie(),(d=_.current)==null||d.call(_,ue(s,Z("wechat")))},nt=s=>{var d;if(R){if(w(),me){ne(!1),D(!0),u(!1),m(oe),C(!1),y.current=!1,p(!1),X.current=setTimeout(()=>{var $;y.current||(w(),D(!1),u(!1),m(0),C(!1),y.current=!1,p(!1),($=A.current)==null||$.call(A,U(g({},Z("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},ke(l));return}D(!1),u(!1),m(0),C(!1),y.current=!1,p(!1),(d=T.current)==null||d.call(T,{provider:"wechat",type:"splash",reason:"wechatAdLoadFail",error:s})}},Oe=s=>{var _e;let d=s&&typeof s.detail=="object"?s.detail:{},$=U(g({},ue(s,Z("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(d.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:d.errCode,rawErrMsg:d.errMsg});(_e=A.current)==null||_e.call(A,$),nt($)},t=s=>{Be(ue(s,Z("wechat")))},n=()=>{var s;y.current||(q(),y.current=!0,C(!0),ie(),(s=_.current)==null||s.call(_,Z("custom")))},o=(s,d)=>{var $;w(),D(!1),u(!1),m(0),C(!1),y.current=!1,p(!1),($=A.current)==null||$.call(A,g(g({},ue(s,Z("custom"))),d))},F=s=>{o(s,{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},Ce=()=>{var $;let s=R?"wechat":"custom",d=Z(s);($=de.current)==null||$.call(de,d),s==="custom"&&$e({customAd:l,actionDetail:d,onOpenWebview:_e=>{var Pe;(Pe=W.current)==null||Pe.call(W,_e)},onError:_e=>{var Pe;(Pe=A.current)==null||Pe.call(A,_e)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL"})},x=()=>{Be({type:"splash",provider:R?"wechat":"custom"})},xe=R?k:null;return!K||!!!xe&&!me?null:Ee(ee,{className:Ke,style:{zIndex:B},children:[xe?M(ee,{className:"bi-splash-ad__popup",children:M(ee,{className:`bi-splash-ad__media-wrapper${b?" bi-splash-ad__media-wrapper--pip":""}`,children:M(xe,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:J,onError:Oe,onClose:t})})}):M(ee,{className:"bi-splash-ad__popup",children:Ee(ee,{className:"bi-splash-ad__media-shell",onClick:Ce,children:[je?M(ht,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:pe,mode:"aspectFill",onLoad:n,onError:F}):Ee(Mt,{children:[M(ht,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:be,mode:"aspectFill"}),M(xt,{className:`bi-splash-ad__video${Ge===1?" bi-splash-ad__video--landscape":""}`,src:pe,poster:be,autoplay:!0,muted:(l==null?void 0:l.muted)!==!1,loop:!0,objectFit:"cover",showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:n,onError:F})]}),b?M(ee,{className:"bi-splash-ad__pip-mask"}):null,b?null:M(ee,{className:"bi-splash-ad__badge",style:Ne,children:Le}),l&&(l.title||!b&&(l.description||l.buttonText))?Ee(ee,{className:"bi-splash-ad__content",style:Ue,children:[l.title?M(He,{className:"bi-splash-ad__title",children:l.title}):null,!b&&l.description?M(He,{className:"bi-splash-ad__description",children:l.description}):null,!b&&l.buttonText?M(Pt,{className:"bi-splash-ad__action",children:l.buttonText}):null]}):null]})}),b?M(ee,{className:"bi-splash-ad__pip-close",onClick:x,children:M(ee,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,b?null:Ee(ee,{className:"bi-splash-ad__skip",style:Ye,onClick:Se,children:[Ee(He,{children:[ge,"s"]}),M(ee,{className:"bi-splash-ad__skip-divider"}),M(He,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};import{useEffect as et,useMemo as kt,useRef as te,useState as tt}from"react";import{jsx as yt}from"react/jsx-runtime";var Rt="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",Lt=300*1e3,At=["banner","splash"],Ut=({adId:e="",unitId:i,type:r="banner",customAd:B,adOptions:f=null,sdkKey:N="biNova",autoLoad:j=!0,adIntervals:G=30,show:S=!0,zIndex:E=999,pictureInPicture:Y=!1,checkNativeSplash:O=!0,nativeSplashCache:v=!0,jumpSeconds:V=5,className:k,onLoad:c,onError:K,onClose:D,onAction:R,onHide:ne,onOpenWebview:b,onConfigLoad:u,onConfigError:ge})=>{var Oe;let m=te(0),re=te(""),C=te(null),z=te(c),p=te(K),I=te(D),L=te(R),X=te(ne),P=te(b),Q=te(u),a=te(ge),h=te(S),[y,_]=tt(!1),[A,T]=tt(!1),[de,ae]=tt(null);et(()=>{z.current=c,p.current=K,I.current=D,L.current=R,X.current=ne,P.current=b,Q.current=u,a.current=ge,h.current=S},[R,D,ge,u,K,ne,c,b,S]);let W=kt(()=>At.includes(r)?r:"banner",[r]),l=()=>!!(j&&e),pe=()=>{var F;let t=globalThis.getApp,n=typeof t=="function"?t():null;if(!n)return null;let o=n;return o[N]||((F=o.globalData)==null?void 0:F[N])||null},be=()=>{var t;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let n=wx.getAccountInfoSync();return((t=n==null?void 0:n.miniProgram)==null?void 0:t.appId)||""}}catch(n){return""}return""},me=(t,n)=>`${Rt}_${n||"unknown"}_${t||"empty"}`,je=(t,n)=>{if(!v||!t||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let o=me(t,n),F=Number(wx.getStorageSync(o)||0),Ce=Date.now()-F;return F>0&&Ce>=0&&Ce<=Lt}catch(o){return!1}},Ge=()=>{if(v&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let t=me(e,be());wx.setStorageSync(t,Date.now())}catch(t){}},Le=()=>{m.current+=1,re.current="",_(!1),T(!1),ae(null)},oe=()=>{let t=f&&typeof f=="object"?f:{},n=be();return U(g({},t),{adId:e,placementId:t.placementId||e,appId:t.appId||n,type:W})},Ye=t=>{try{return JSON.stringify(t||{})}catch(n){return`${String(t.appId||"")}_${String(t.placementId||"")}`}},Ue=t=>{let n=(t==null?void 0:t.unitId)||"",o=(t==null?void 0:t.customAd)||(t==null?void 0:t.custom)||null,F=typeof(t==null?void 0:t.show)=="boolean"?t.show:!!(n||o);return{unitId:n,customAd:o,show:F}},Ne=t=>{var n,o;(n=a.current)==null||n.call(a,t),(o=p.current)==null||o.call(p,t)},Ke=t=>{var n;(n=I.current)==null||n.call(I,{type:W,adId:e||t.adId||"",provider:"none",reason:"noAd"})},Z=async()=>{var Ce;if(!l())return;let t=oe(),n=Ye(t);if(re.current===n&&(y||A))return;let o=pe();if(!(o!=null&&o.ads)||typeof o.ads.getDisplayAdConfig!="function"){Le(),Ne({type:W,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 F=m.current+1;m.current=F,re.current=n,_(!0),T(!1),ae(null);try{let x=await o.ads.getDisplayAdConfig(t);if(F!==m.current)return;if(!x||x.code!==0||!x.data){_(!1),T(!0),ae(null),Ne({type:W,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(x==null?void 0:x.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:x||null});return}let xe=Ue(x.data),rt=!!(h.current&&!xe.show);_(!1),T(!0),ae(x.data),(Ce=Q.current)==null||Ce.call(Q,{type:W,adId:e,requestOptions:t,data:x.data}),rt&&Ke(x.data)}catch(x){if(F!==m.current)return;_(!1),T(!0),ae(null),Ne({type:W,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:x instanceof Error?x.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:x})}};et(()=>{var t;At.includes(r)||(t=p.current)==null||t.call(p,{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]),et(()=>{if(!e){Le();return}Z()},[e,f,j,W,N]);let le=l(),q=le?Ue(de):null,Ae=q?q.unitId:i||"",ye=q?q.customAd:B||null,w=!!(S&&(!le||!e||A&&(q!=null&&q.show))),Be=be(),Se=JSON.stringify([W,Be,e,O,v]),ie=C.current;!!(!ie||ie.identity!==Se||!ie.show&&S)?C.current={identity:Se,show:S,shouldCheck:!!(O&&!je(e,Be))}:ie&&ie.show!==S&&(C.current=U(g({},ie),{show:S}));let De=!!((Oe=C.current)!=null&&Oe.shouldCheck),Ie=e||(de==null?void 0:de.adId)||"",J=t=>g({adId:Ie},t);return W==="splash"?yt(Ze,g({},{unitId:Ae,customAd:ye,show:w,zIndex:E,pictureInPicture:Y,checkNativeSplash:De,jumpSeconds:V,className:k,onLoad:n=>{var o;n&&typeof n=="object"&&n.nativeSplash===!0&&Ge(),(o=z.current)==null||o.call(z,J(n))},onError:n=>{var o;(o=p.current)==null||o.call(p,J(n))},onClose:n=>{var o;(o=I.current)==null||o.call(I,J(n))},onAction:n=>{var o;(o=L.current)==null||o.call(L,J(n))},onHide:n=>{var o;(o=X.current)==null||o.call(X,J(n))},onOpenWebview:n=>{var o;(o=P.current)==null||o.call(P,J(n))}})):w?yt(Xe,g({},{unitId:Ae,customAd:ye,adIntervals:G,className:k,onLoad:t=>{var n;(n=z.current)==null||n.call(z,J(t))},onError:t=>{var n;(n=p.current)==null||n.call(p,J(t))},onClose:t=>{var n;(n=I.current)==null||n.call(I,J(t))},onAction:t=>{var n;(n=L.current)==null||n.call(L,J(t))},onOpenWebview:t=>{var n;(n=P.current)==null||n.call(P,J(t))}})):null};export{Xe as BiBannerAd,Ut as BiDisplayAd,Ze as BiSplashAd};
|
|
1
|
+
var yt=Object.defineProperty,Bt=Object.defineProperties;var At=Object.getOwnPropertyDescriptors;var ot=Object.getOwnPropertySymbols;var St=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable;var at=(e,i,o)=>i in e?yt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,f=(e,i)=>{for(var o in i||(i={}))St.call(i,o)&&at(e,o,i[o]);if(ot)for(var o of ot(i))Dt.call(i,o)&&at(e,o,i[o]);return e},x=(e,i)=>Bt(e,At(i));import"./banner/index.scss";import"./splash/index.scss";import{useCallback as ke,useEffect as Je,useMemo as Tt,useRef as he,useState as qe}from"react";import{Image as Pt,Text as Et,View as we}from"@tarojs/components";import*as mt from"@tarojs/taro";import*as Ct from"@tarojs/components";var Fe;function $e(){if(Fe!==void 0)return Fe;try{let e=Ct;Fe=(e==null?void 0:e.AdCustom)||null}catch(e){Fe=null}return Fe}import*as Ue from"@tarojs/taro";function je(){return typeof wx!="undefined"?wx:null}function fe(e,i){let o=e==null?void 0:e.detail;return o&&typeof o=="object"?f(f({},i),o):e&&typeof e=="object"?f(f({},i),e):f({},i)}function st(e){return e?e.mediaType==="video"?e.video||"":e.mediaType==="image"?e.image||"":e.video||e.image||"":""}function lt(e,i=""){return e&&(e.poster||e.image||i)||""}function ct(e,i=""){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(i).trim()):!0}function ut(e){return(e==null?void 0:e.fitMode)==="cover"?"cover":"contain"}function Ge(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function dt(e,i=5){let o=e==null?void 0:e.jumpSeconds,D=o!=null?o:i;return Math.min(99,Math.max(0,Number(D)||0))}function Ke(e){var o;let i=(o=e==null?void 0:e.loadTimeout)!=null?o:e==null?void 0:e.timeout;return Math.max(1e3,Number(i)||5e3)}function vt(e,i=!1){var o,D,_,A;if(!e)return"none";if(i){let E=String(((o=e.action)==null?void 0:o.type)||e.jumpType||"").trim().toLowerCase();if(E==="miniprogram")return"miniProgram";if(E==="internal")return"internal";if(E==="web")return"web";if(E==="none")return"none"}return i&&((D=e.action)!=null&&D.appId||e.targetAppId)||e.appId||e.miniProgramAppId||e.jumpAppId?"miniProgram":i&&((_=e.action)!=null&&_.path||e.targetPath)||e.path||e.pagePath||e.jumpPath||e.targetUrl?"internal":i&&((A=e.action)!=null&&A.url||e.jumpUrl)||e.url||e.webUrl||e.h5Url?"web":"none"}function wt(e,i=!1){var o;return e&&((i?((o=e.action)==null?void 0:o.appId)||e.targetAppId:"")||e.appId||e.miniProgramAppId||e.jumpAppId)||""}function bt(e,i=!1){var o;return e&&((i?((o=e.action)==null?void 0:o.path)||e.targetPath:"")||e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function _t(e,i=!1){var o;return e&&((i?((o=e.action)==null?void 0:o.url)||e.jumpUrl:"")||e.url||e.webUrl||e.h5Url)||""}function Ye(e){let{customAd:i,actionDetail:o,onOpenWebview:D,onError:_,miniProgramErrorCode:A,navigateErrorCode:E,miniProgramUnsupportedErrorCode:Q,preferStandardFields:j=!1}=e;if(!i)return;let v=vt(i,j),X=wt(i,j),L=bt(i,j),p=_t(i,j);if(v==="miniProgram"&&X){let g=je();if(!g||typeof g.navigateToMiniProgram!="function"){_==null||_(x(f({},o),{errCode:Q||A,errMsg:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}g.navigateToMiniProgram({appId:X,path:L||"",fail:G=>{_==null||_(x(f({},o),{errCode:A,errMsg:(G==null?void 0:G.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(v==="internal"&&L){Ue.navigateTo({url:L,fail:g=>{_==null||_(x(f({},o),{errCode:E,errMsg:(g==null?void 0:g.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}v==="web"&&p&&(D==null||D(x(f({},o),{url:p})))}function pt(){var I;let e=je(),i=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},o=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof Ue.getSystemInfoSync=="function"?Ue.getSystemInfoSync():{},D=Number(o.windowHeight||0),_=Number(o.screenHeight||0),A=!!(D&&_&&D===_),E=16,Q=16,j=16,v=32,X=A&&i.top?i.top:Math.max(E,Number(o.statusBarHeight||0)+4),L=A&&i.height?i.height:v,p=A&&i.top?i.top:E,g=A&&i.height?i.height:v,G=Math.max(j,Number(((I=o.safeArea)==null?void 0:I.left)||0)+j);return{isFullScreen:A,skipStyle:{top:`${p}px`,width:"156rpx",height:`${g}px`,lineHeight:`${g}px`,borderRadius:`${Math.round(g/2)}px`,left:A?`${j}px`:void 0,right:A?void 0:`${Q}px`},disclosureStyle:{top:`${p}px`,left:`${G}px`,height:`${g}px`,lineHeight:`${g}px`},combinedControlStyle:{top:`${X}px`,left:`${G}px`,height:`${L}px`}}}import{Fragment as Mt,jsx as ye,jsxs as et}from"react/jsx-runtime";var It=[{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,i,o){return e&&i?o==="custom-first"||o==="custom-only"?"custom":"wechat":e?"wechat":i?"custom":null}var tt=({unitId:e="",customAd:i,priority:o="wechat-first",adIntervals:D=30,className:_,onLoad:A,onError:E,onClose:Q,onAction:j,onFeedback:v,onOpenWebview:X})=>{let L=Tt(()=>$e(),[]),p=i||null,g=!!(p!=null&&p.image),G=!!(e&&L),I=Nt(G,g,o),u=JSON.stringify([e,p,o,!!L]),[K,me]=qe(!!I),[Y,ae]=qe(I),[te,Be]=qe(!1),[se,J]=qe("primary"),P=he(I),N=he({wechat:!1,custom:!1}),M=he(!1),W=he(null),S=he(A),m=he(E),h=he(Q),le=he(j),w=he(v),H=he(X);Je(()=>{S.current=A,m.current=E,h.current=Q,le.current=j,w.current=v,H.current=X},[j,Q,E,v,A,X]);let b=ke(n=>{let s=n==="custom"&&p?{configId:p.configId,placementId:p.placementId,configName:p.configName,advertPlatform:p.advertPlatform}:{};return f({provider:n,type:"banner"},s)},[p]),y=ke(()=>{W.current&&(clearTimeout(W.current),W.current=null)},[]),q=ke(()=>{Be(!1),J("primary")},[]),ce=ke(n=>{y(),P.current=n,M.current=!1,ae(n),me(!0),q()},[y,q]),ue=ke((n,s)=>{var F;let d=!!e&&g?"allProvidersFailed":n==="wechat"?"wechatAdLoadFail":"customMediaLoadFail";y(),P.current=null,ae(null),me(!1),q(),(F=h.current)==null||F.call(h,{provider:n,type:"banner",reason:d,error:s})},[y,q,g,e]),de=ke((n,s,c,d)=>{var Ce;if(P.current!=="custom"||N.current.custom)return;y();let F=fe(n,b("custom")),ne=x(f({},F),{errorType:s,errCode:c,errMsg:d,mediaType:"image",rawErrCode:F.errCode,rawErrMsg:F.errMsg});if(N.current.custom=!0,(Ce=m.current)==null||Ce.call(m,ne),G&&!N.current.wechat){ce("wechat");return}ue("custom",ne)},[G,y,b,ue,ce]);Je(()=>(y(),N.current={wechat:!1,custom:!1},M.current=!1,P.current=I,ae(I),me(!!I),q(),y),[y,q,u,I]),Je(()=>{if(y(),!(!K||Y!=="custom"||!g))return W.current=setTimeout(()=>{M.current||P.current!=="custom"||de(void 0,"CUSTOM_MEDIA_LOAD_TIMEOUT","BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6")},Ke(p)),y},[y,de,g,Y,p,K]),Je(()=>{var s,c;if(!e||L)return;let n=x(f({},b("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=m.current)==null||s.call(m,n),g||(c=h.current)==null||c.call(h,x(f({},b("wechat")),{reason:"wechatAdLoadFail",error:n}))},[L,b,g,e]);let k=n=>{var s;P.current==="wechat"&&((s=S.current)==null||s.call(S,fe(n,b("wechat"))))},R=n=>{var d;if(P.current!=="wechat"||N.current.wechat)return;let s=n!=null&&n.detail&&typeof n.detail=="object"?n.detail:{},c=x(f({},fe(n,b("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(N.current.wechat=!0,(d=m.current)==null||d.call(m,c),g&&!N.current.custom){ce("custom");return}ue("wechat",c)},re=n=>{var s;P.current==="wechat"&&((s=h.current)==null||s.call(h,fe(n,b("wechat"))))},O=()=>{var n;P.current!=="custom"||M.current||(y(),M.current=!0,(n=S.current)==null||n.call(S,b("custom")))},Ae=()=>{var s;if(te){q();return}let n=b("custom");(s=le.current)==null||s.call(le,n),Ye({customAd:p,actionDetail:n,onOpenWebview:c=>{var d;return(d=H.current)==null?void 0:d.call(H,c)},onError:c=>{var d;return(d=m.current)==null?void 0:d.call(m,c)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL",preferStandardFields:!0})},Me=n=>{var s;(s=n.stopPropagation)==null||s.call(n),Be(c=>!c),J("primary")},Se=n=>{var s;(s=n.stopPropagation)==null||s.call(n)},ge=n=>{var s,c;(s=n.stopPropagation)==null||s.call(n),q(),(c=w.current)==null||c.call(w,x(f({},b("custom")),{provider:"custom",action:"report"})),mt.showToast({title:"\u5DF2\u6536\u5230\u60A8\u7684\u53CD\u9988\uFF0C\u6211\u4EEC\u4F1A\u5C3D\u5FEB\u5904\u7406~",icon:"none",duration:2e3})},pe=(n,s)=>{var d,F,ne;(d=n.stopPropagation)==null||d.call(n);let c=x(f({},b("custom")),{provider:"custom",action:"dislike",reason:s.value,reasonText:s.label});y(),P.current=null,ae(null),me(!1),q(),(F=w.current)==null||F.call(w,c),(ne=h.current)==null||ne.call(h,x(f({},b("custom")),{reason:"notInterested",feedbackReason:s.value,feedbackReasonText:s.label}))},De=`bi-banner-ad${_?` ${_}`:""}`;return!K||!Y?null:Y==="wechat"&&L?ye(L,{className:De,unitId:e,adIntervals:D,onLoad:k,onError:R,onClose:re}):Y!=="custom"||!(p!=null&&p.image)?null:et(we,{className:De,children:[ye(we,{className:"bi-banner-ad__surface",onClick:Ae,children:ye(Pt,{className:"bi-banner-ad__image",src:p.image,mode:"widthFix",onLoad:O,onError:n=>de(n,"CUSTOM_MEDIA_LOAD_FAIL","BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL","Banner \u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")})}),et(we,{className:"bi-banner-ad__badge",onClick:Me,children:[ye(Et,{children:Ge(p)}),ye(we,{className:"bi-banner-ad__badge-arrow"})]}),te?ye(we,{className:"bi-banner-ad__feedback-panel",onClick:Se,children:se==="primary"?et(Mt,{children:[ye(we,{className:"bi-banner-ad__feedback-source",children:"\u7531\u8D5E\u52A9\u5546\u63D0\u4F9B\u7684\u5185\u5BB9"}),ye(we,{className:"bi-banner-ad__feedback-item",onClick:n=>{var s;(s=n.stopPropagation)==null||s.call(n),J("dislike")},children:"\u4E0D\u611F\u5174\u8DA3"}),ye(we,{className:"bi-banner-ad__feedback-item",onClick:ge,children:"\u53CD\u9988\u95EE\u9898"})]}):It.map(n=>ye(we,{className:"bi-banner-ad__feedback-item",onClick:s=>pe(s,n),children:n.label},n.value))}):null]})};import{useCallback as be,useEffect as ze,useMemo as Ne,useRef as $,useState as Re}from"react";import{Image as gt,Text as Ve,Video as xt,View as U}from"@tarojs/components";import{jsx as V,jsxs as _e}from"react/jsx-runtime";function kt(e,i,o){return e&&i?o==="custom-first"||o==="custom-only"?"custom":"wechat":e?"wechat":i?"custom":null}var rt=({unitId:e="",customAd:i,priority:o="wechat-first",show:D=!0,zIndex:_=999,pictureInPicture:A=!1,checkNativeSplash:E=!0,jumpSeconds:Q=5,className:j,onLoad:v,onError:X,onClose:L,onAction:p,onHide:g,onOpenWebview:G})=>{let I=Ne(()=>$e(),[]),u=i||null,K=Ne(()=>st(u),[u]),me=Ne(()=>lt(u,K),[K,u]),Y=Ne(()=>ct(u,K),[K,u]),ae=Ne(()=>ut(u),[u]),te=Ne(()=>dt(u,Q),[Q,u]),Be=Ne(()=>Ge(u),[u]),se=Ne(()=>pt(),[]),J=!!(e&&I),P=!!(K||u!=null&&u.mediaType),N=!!K,M=kt(J,P,o),W=JSON.stringify([e,u,o,!!I]),[S,m]=Re(!1),[h,le]=Re(M),[w,H]=Re(!1),[b,y]=Re(0),[q,ce]=Re(!1),[ue,de]=Re(!1),k=$(M),R=$({wechat:!1,custom:!1}),re=$(!1),O=$(!1),Ae=$(!1),Me=$({identity:W,show:!1}),Se=$(0),ge=$(null),pe=$(null),De=$(null),n=$(null),s=$(v),c=$(X),d=$(L),F=$(p),ne=$(g),Ce=$(G);ze(()=>{s.current=v,c.current=X,d.current=L,F.current=p,ne.current=g,Ce.current=G},[p,L,X,g,v,G]),ze(()=>{var t;!D||!e||I||(t=c.current)==null||t.call(c,{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"})},[I,D,e]);let Z=t=>{let l=t==="custom"&&u?{configId:u.configId,placementId:u.placementId,configName:u.configName,advertPlatform:u.advertPlatform}:{};return f({provider:t,type:"splash"},l)},T=be(()=>{ge.current&&clearInterval(ge.current),pe.current&&clearTimeout(pe.current),De.current&&clearTimeout(De.current),n.current&&clearTimeout(n.current),ge.current=null,pe.current=null,De.current=null,n.current=null},[]),ie=be((t,l)=>{T(),k.current=t,re.current=!1,le(t),m(l),H(!1),y(te),ce(!1),de(!1)},[T,te]),Te=be((t,l)=>{var Oe;let Ie=P&&(t==="custom"||J&&R.current.wechat&&R.current.custom),xe=Ie?"allProvidersFailed":"wechatAdLoadFail";T(),m(!1),H(!1),y(0),ce(!1),de(!1),(Oe=d.current)==null||Oe.call(d,{provider:Ie?"none":t,type:"splash",reason:xe,error:l})},[J,T,P]),ve=be(()=>{if(!(ge.current||!k.current)){if(ce(!0),te<=0){y(0);return}y(te),ge.current=setInterval(()=>{y(t=>Math.max(0,t-1))},1e3)}},[te]),Le=be(()=>{N&&(pe.current=setTimeout(()=>{var l;if(re.current||k.current!=="custom")return;let t=x(f({},Z("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:Y?"image":"video",rawErrCode:void 0,rawErrMsg:void 0});(l=c.current)==null||l.call(c,t),R.current.custom=!0,J&&!R.current.wechat?(ie("wechat",!0),ve()):Te("custom",t)},Ke(u)))},[J,Te,N,Y,ie,u,ve]),Pe=be(t=>{ie(t,!0),t==="wechat"?ve():N&&Le()},[N,ie,ve,Le]),Ee=be((t,l,C,B)=>{var Oe;if(k.current!=="custom"||R.current.custom)return;let Ie=fe(t,Z("custom")),xe=x(f({},Ie),{errorType:l,errCode:C,errMsg:B,mediaType:Y?"image":"video",rawErrCode:Ie.errCode,rawErrMsg:Ie.errMsg});(Oe=c.current)==null||Oe.call(c,xe),R.current.custom=!0,J&&!R.current.wechat?Pe("wechat"):Te("custom",xe)},[J,Te,Y,Pe]),oe=be(()=>{var t;if(O.current){m(!1);return}if(!M){ie(null,!1),Ae.current||(Ae.current=!0,(t=d.current)==null||t.call(d,{provider:"none",type:"splash",reason:"noAd"}));return}Pe(M),M==="custom"&&!N&&Ee(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")},[Ee,N,M,ie,Pe]),We=be(()=>{if(!D||O.current)return;if(!E){oe();return}let t=je();if(!(t!=null&&t.getShowSplashAdStatus)||Se.current>=3){oe();return}t.getShowSplashAdStatus({success:l=>{var C;if((l==null?void 0:l.code)===-1){Se.current+=1,De.current=setTimeout(We,300);return}if((l==null?void 0:l.code)===1){T(),O.current=!0,m(!1),(C=s.current)==null||C.call(s,{provider:"wechat",type:"splash",nativeSplash:!0});return}oe()},fail:oe})},[oe,E,T,D]);ze(()=>{let t=Me.current,l=D&&!t.show||t.identity!==W;if(Me.current={identity:W,show:D},!D){O.current=!1,Ae.current=!1,R.current={wechat:!1,custom:!1},ie(M,!1);return}if(!O.current)return l&&(Ae.current=!1),R.current={wechat:!1,custom:!1},O.current=!1,Se.current=0,ie(M,!1),We(),T},[We,T,W,M,ie,D]),ze(()=>{var l;if(!q||b!==0||!S||w||!k.current)return;let t=k.current;if(A){T(),de(!0),n.current=setTimeout(()=>{var C;H(!0),de(!1),(C=ne.current)==null||C.call(ne,Z(t))},280);return}T(),m(!1),(l=d.current)==null||l.call(d,Z(t))},[T,q,A,b,w,S]);let Xe=t=>{var l;k.current==="wechat"&&(ve(),(l=s.current)==null||l.call(s,fe(t,Z("wechat"))))},Qe=t=>{var B;if(k.current!=="wechat"||R.current.wechat)return;let l=t!=null&&t.detail&&typeof t.detail=="object"?t.detail:{},C=x(f({},fe(t,Z("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});(B=c.current)==null||B.call(c,C),R.current.wechat=!0,P&&!R.current.custom?(Pe("custom"),N||Ee(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("wechat",C)},z=()=>{var t;k.current!=="custom"||re.current||(pe.current&&clearTimeout(pe.current),pe.current=null,re.current=!0,ve(),(t=s.current)==null||t.call(s,Z("custom")))},Ze=t=>{var C;(C=t==null?void 0:t.stopPropagation)==null||C.call(t),k.current&&(ce(!0),y(0))},He=()=>{var l;if(k.current!=="custom")return;let t=Z("custom");(l=F.current)==null||l.call(F,t),Ye({customAd:u,actionDetail:t,onOpenWebview:C=>{var B;return(B=Ce.current)==null?void 0:B.call(Ce,C)},onError:C=>{var B;return(B=c.current)==null?void 0:B.call(c,C)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL",preferStandardFields:!0})},r=t=>{var l;T(),m(!1),H(!1),y(0),ce(!1),(l=d.current)==null||l.call(d,t)},a=["bi-splash-ad",w?"bi-splash-ad--pip":"",ue?"bi-splash-ad--pip-animating":"",j||""].filter(Boolean).join(" ");return!S||!h?null:_e(U,{className:a,style:{zIndex:_},children:[h==="wechat"&&I?V(U,{className:"bi-splash-ad__popup",children:V(U,{className:`bi-splash-ad__media-wrapper${w?" bi-splash-ad__media-wrapper--pip":""}`,children:V(I,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:Xe,onError:Qe,onClose:t=>r(fe(t,Z("wechat")))})})}):h==="custom"&&N?V(U,{className:"bi-splash-ad__popup bi-splash-ad__custom",children:_e(U,{className:"bi-splash-ad__media-shell",onClick:He,children:[Y?V(gt,{className:"bi-splash-ad__media",src:K,mode:ae==="cover"?"aspectFill":"aspectFit",onLoad:z,onError:t=>Ee(t,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}):V(xt,{className:"bi-splash-ad__video",src:K,poster:me,autoplay:!0,muted:(u==null?void 0:u.muted)!==!1,loop:!0,objectFit:ae,showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:z,onError:t=>Ee(t,"CUSTOM_MEDIA_LOAD_FAIL","BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL","\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25")}),w?V(U,{className:"bi-splash-ad__pip-mask"}):null,!w&&!se.isFullScreen?_e(U,{className:"bi-splash-ad__disclosure",style:se.disclosureStyle,children:[V(Ve,{children:Be}),V(U,{className:"bi-splash-ad__disclosure-arrow"})]}):null,!w&&(u!=null&&u.bottomImage)?V(gt,{className:"bi-splash-ad__bottom-image",src:u.bottomImage,mode:"widthFix"}):null]})}):null,w?V(U,{className:"bi-splash-ad__pip-close",onClick:()=>r(Z(h)),children:V(U,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,!w&&se.isFullScreen&&h==="custom"?_e(U,{className:"bi-splash-ad__combined-control",style:se.combinedControlStyle,children:[_e(U,{className:"bi-splash-ad__combined-capsule",children:[_e(U,{className:"bi-splash-ad__combined-disclosure",children:[V(Ve,{children:Be}),V(U,{className:"bi-splash-ad__disclosure-arrow"})]}),V(U,{className:"bi-splash-ad__combined-divider"}),V(U,{className:"bi-splash-ad__combined-skip",onClick:Ze,children:"\u8DF3\u8FC7"})]}),_e(Ve,{className:"bi-splash-ad__combined-countdown",children:[b," \u79D2"]})]}):w?null:_e(U,{className:"bi-splash-ad__skip",style:se.skipStyle,onClick:Ze,children:[_e(Ve,{children:[b,"s"]}),V(U,{className:"bi-splash-ad__skip-divider"}),V(Ve,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};import{useEffect as nt,useMemo as Rt,useRef as ee,useState as it}from"react";import{jsx as ht}from"react/jsx-runtime";var Lt="BI_DISPLAY_NATIVE_SPLASH_CONSUMED",Ot=300*1e3,ft=["banner","splash"],Ft=({adId:e="",unitId:i,type:o="banner",customAd:D,priority:_="wechat-first",adOptions:A=null,sdkKey:E="biNova",autoLoad:Q=!0,adIntervals:j=30,show:v=!0,zIndex:X=999,pictureInPicture:L=!1,checkNativeSplash:p=!0,nativeSplashCache:g=!0,jumpSeconds:G=5,className:I,onLoad:u,onError:K,onClose:me,onAction:Y,onFeedback:ae,onHide:te,onOpenWebview:Be,onConfigLoad:se,onConfigError:J})=>{var He;let P=ee(0),N=ee(""),M=ee(null),W=ee(u),S=ee(K),m=ee(me),h=ee(Y),le=ee(ae),w=ee(te),H=ee(Be),b=ee(se),y=ee(J),q=ee(v),[ce,ue]=it(!1),[de,k]=it(!1),[R,re]=it(null);nt(()=>{W.current=u,S.current=K,m.current=me,h.current=Y,le.current=ae,w.current=te,H.current=Be,b.current=se,y.current=J,q.current=v},[Y,me,J,se,K,ae,te,u,Be,v]);let O=Rt(()=>ft.includes(o)?o:"banner",[o]),Ae=()=>!!(Q&&e),Me=()=>{var l;let r=globalThis.getApp,a=typeof r=="function"?r():null;if(!a)return null;let t=a;return t[E]||((l=t.globalData)==null?void 0:l[E])||null},Se=()=>{var r;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let a=wx.getAccountInfoSync();return((r=a==null?void 0:a.miniProgram)==null?void 0:r.appId)||""}}catch(a){return""}return""},ge=(r,a)=>`${Lt}_${a||"unknown"}_${r||"empty"}`,pe=(r,a)=>{if(!g||!r||typeof wx=="undefined"||typeof wx.getStorageSync!="function")return!1;try{let t=ge(r,a),l=Number(wx.getStorageSync(t)||0),C=Date.now()-l;return l>0&&C>=0&&C<=Ot}catch(t){return!1}},De=()=>{if(g&&!(!e||typeof wx=="undefined"||typeof wx.setStorageSync!="function"))try{let r=ge(e,Se());wx.setStorageSync(r,Date.now())}catch(r){}},n=()=>{P.current+=1,N.current="",ue(!1),k(!1),re(null)},s=()=>{let r=A&&typeof A=="object"?A:{},a=Se();return x(f({},r),{adId:e,placementId:r.placementId||e,appId:r.appId||a,type:O})},c=r=>{try{return JSON.stringify(r||{})}catch(a){return`${String(r.appId||"")}_${String(r.placementId||"")}`}},d=r=>{let a=(r==null?void 0:r.unitId)||"",t=(r==null?void 0:r.customAd)||(r==null?void 0:r.custom)||null,l=typeof(r==null?void 0:r.show)=="boolean"?r.show:!!(a||t);return{unitId:a,customAd:t,priority:(r==null?void 0:r.priority)||"wechat-first",show:l}},F=r=>{var a,t;(a=y.current)==null||a.call(y,r),(t=S.current)==null||t.call(S,r)},ne=r=>{var a;(a=m.current)==null||a.call(m,{type:O,adId:e||r.adId||"",provider:"none",reason:"noAd"})},Ce=async()=>{var C;if(!Ae())return;let r=s(),a=c(r);if(N.current===a&&(ce||de))return;let t=Me();if(!(t!=null&&t.ads)||typeof t.ads.getDisplayAdConfig!="function"){n(),F({type:O,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=P.current+1;P.current=l,N.current=a,ue(!0),k(!1),re(null);try{let B=await t.ads.getDisplayAdConfig(r);if(l!==P.current)return;if(!B||B.code!==0||!B.data){ue(!1),k(!0),re(null),F({type:O,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(B==null?void 0:B.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:B||null});return}let Ie=d(B.data),xe=!!(q.current&&!Ie.show);ue(!1),k(!0),re(B.data),(C=b.current)==null||C.call(b,{type:O,adId:e,requestOptions:r,data:B.data}),xe&&ne(B.data)}catch(B){if(l!==P.current)return;ue(!1),k(!0),re(null),F({type:O,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:B instanceof Error?B.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:B})}};nt(()=>{var r;ft.includes(o)||(r=S.current)==null||r.call(S,{type:"banner",errCode:"UNSUPPORTED_DISPLAY_AD_TYPE",errMsg:`\u4E0D\u652F\u6301\u7684\u5C55\u793A\u5E7F\u544A\u7C7B\u578B\uFF1A${o}\uFF0C\u8BF7\u4F7F\u7528 "banner" \u6216 "splash"`})},[o]),nt(()=>{if(!e){n();return}Ce()},[e,A,Q,O,E]);let Z=Ae(),T=Z?d(R):null,ie=T?T.unitId:i||"",Te=T?T.customAd:D||null,ve=T?T.priority:_,Le=!!(v&&(!Z||!e||de&&(T!=null&&T.show))),Pe=Se(),Ee=JSON.stringify([O,Pe,e,p,g]),oe=M.current;!!(!oe||oe.identity!==Ee||!oe.show&&v)?M.current={identity:Ee,show:v,shouldCheck:!!(p&&!pe(e,Pe))}:oe&&oe.show!==v&&(M.current=x(f({},oe),{show:v}));let Xe=!!((He=M.current)!=null&&He.shouldCheck),Qe=e||(R==null?void 0:R.adId)||"",z=r=>f({adId:Qe},r);return O==="splash"?ht(rt,f({},{unitId:ie,customAd:Te,priority:ve,show:Le,zIndex:X,pictureInPicture:L,checkNativeSplash:Xe,jumpSeconds:G,className:I,onLoad:a=>{var t;a&&typeof a=="object"&&a.nativeSplash===!0&&De(),(t=W.current)==null||t.call(W,z(a))},onError:a=>{var t;(t=S.current)==null||t.call(S,z(a))},onClose:a=>{var t;(t=m.current)==null||t.call(m,z(a))},onAction:a=>{var t;(t=h.current)==null||t.call(h,z(a))},onHide:a=>{var t;(t=w.current)==null||t.call(w,z(a))},onOpenWebview:a=>{var t;(t=H.current)==null||t.call(H,z(a))}})):Le?ht(tt,f({},{unitId:ie,customAd:Te,priority:ve,adIntervals:j,className:I,onLoad:r=>{var a;(a=W.current)==null||a.call(W,z(r))},onError:r=>{var a;(a=S.current)==null||a.call(S,z(r))},onClose:r=>{var a;(a=m.current)==null||a.call(m,z(r))},onAction:r=>{var a;(a=h.current)==null||a.call(h,z(r))},onFeedback:r=>{var a;(a=le.current)==null||a.call(le,z(r))},onOpenWebview:r=>{var a;(a=H.current)==null||a.call(H,z(r))}})):null};export{tt as BiBannerAd,Ft as BiDisplayAd,rt as BiSplashAd};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* @Description Taro 开屏广告样式
|
|
3
3
|
* @Author wutao
|
|
4
4
|
* @Date 2026-04-14
|
|
5
5
|
* @LastEditors wutao
|
|
6
|
-
* @LastEditTime 2026-
|
|
6
|
+
* @LastEditTime 2026-08-12 17:03:42
|
|
7
7
|
*/
|
|
8
8
|
.bi-splash-ad {
|
|
9
9
|
position: fixed;
|
|
@@ -12,40 +12,23 @@
|
|
|
12
12
|
transform-origin: right bottom;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.bi-splash-ad--pip {
|
|
16
|
-
inset: auto 24rpx 24rpx auto;
|
|
17
|
-
width: 320rpx;
|
|
18
|
-
height: 420rpx;
|
|
19
|
-
border-radius: 24rpx;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.32);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.bi-splash-ad--pip .bi-splash-ad__popup {
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
border-radius: 24rpx;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.bi-splash-ad--pip-animating {
|
|
31
|
-
transition: all 0.28s ease-in-out;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
15
|
.bi-splash-ad__popup {
|
|
35
16
|
position: relative;
|
|
36
|
-
width: 100vw;
|
|
37
|
-
height: 100vh;
|
|
38
17
|
z-index: 10;
|
|
39
|
-
background-color: #000000;
|
|
40
|
-
box-sizing: border-box;
|
|
41
18
|
display: flex;
|
|
42
19
|
align-items: center;
|
|
43
20
|
justify-content: center;
|
|
21
|
+
width: 100vw;
|
|
22
|
+
height: 100vh;
|
|
44
23
|
overflow: hidden;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
background: #000000;
|
|
45
26
|
}
|
|
46
27
|
|
|
47
|
-
.bi-splash-ad__media-wrapper
|
|
28
|
+
.bi-splash-ad__media-wrapper,
|
|
29
|
+
.bi-splash-ad__wechat-unit {
|
|
48
30
|
position: relative;
|
|
31
|
+
display: block;
|
|
49
32
|
width: 100vw;
|
|
50
33
|
height: 100vh;
|
|
51
34
|
}
|
|
@@ -55,143 +38,152 @@
|
|
|
55
38
|
height: 100%;
|
|
56
39
|
}
|
|
57
40
|
|
|
58
|
-
.bi-splash-ad__wechat-unit {
|
|
59
|
-
position: relative;
|
|
60
|
-
display: block;
|
|
61
|
-
width: 100vw;
|
|
62
|
-
height: 100vh;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
41
|
.bi-splash-ad__media-shell {
|
|
66
42
|
position: relative;
|
|
67
43
|
width: 100%;
|
|
68
44
|
height: 100%;
|
|
45
|
+
background: #000000;
|
|
69
46
|
}
|
|
70
47
|
|
|
71
|
-
.bi-splash-ad__media
|
|
48
|
+
.bi-splash-ad__media,
|
|
49
|
+
.bi-splash-ad__video {
|
|
50
|
+
position: absolute;
|
|
51
|
+
inset: 0;
|
|
52
|
+
display: block;
|
|
72
53
|
width: 100%;
|
|
73
54
|
height: 100%;
|
|
74
55
|
}
|
|
75
56
|
|
|
76
|
-
.bi-splash-ad__media--background {
|
|
77
|
-
display: block;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
57
|
.bi-splash-ad__video {
|
|
81
|
-
|
|
82
|
-
z-index: 2;
|
|
83
|
-
top: 0;
|
|
84
|
-
left: 0;
|
|
85
|
-
width: 100vw;
|
|
86
|
-
height: 100vh;
|
|
58
|
+
z-index: 1;
|
|
87
59
|
}
|
|
88
60
|
|
|
89
|
-
.bi-splash-
|
|
90
|
-
top: 50%;
|
|
91
|
-
left: 50%;
|
|
92
|
-
width: 100vw;
|
|
93
|
-
max-width: 100vw;
|
|
94
|
-
height: 500rpx;
|
|
95
|
-
transform: translate(-50%, -50%);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.bi-splash-ad__pip-mask {
|
|
61
|
+
.bi-splash-ad__bottom-image {
|
|
99
62
|
position: absolute;
|
|
100
|
-
|
|
63
|
+
right: 0;
|
|
64
|
+
bottom: 0;
|
|
65
|
+
left: 0;
|
|
101
66
|
z-index: 3;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.bi-splash-ad__content {
|
|
106
|
-
position: absolute;
|
|
107
|
-
left: 40rpx;
|
|
108
|
-
right: 40rpx;
|
|
109
|
-
z-index: 4;
|
|
110
|
-
padding: 28rpx;
|
|
111
|
-
border-radius: 24rpx;
|
|
112
|
-
background: linear-gradient(180deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.76));
|
|
113
|
-
color: #ffffff;
|
|
114
|
-
box-sizing: border-box;
|
|
67
|
+
display: block;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: auto;
|
|
115
70
|
}
|
|
116
71
|
|
|
117
|
-
.bi-splash-
|
|
72
|
+
.bi-splash-ad__disclosure {
|
|
118
73
|
position: absolute;
|
|
119
|
-
right: 32rpx;
|
|
120
74
|
z-index: 4;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
min-height: 40rpx;
|
|
78
|
+
padding: 0 14rpx;
|
|
124
79
|
box-sizing: border-box;
|
|
125
|
-
border-radius:
|
|
126
|
-
background: rgba(0, 0, 0, 0.52);
|
|
80
|
+
border-radius: 20rpx;
|
|
127
81
|
color: #ffffff;
|
|
128
82
|
font-size: 20rpx;
|
|
129
|
-
line-height:
|
|
130
|
-
text-align: center;
|
|
83
|
+
line-height: 40rpx;
|
|
131
84
|
}
|
|
132
85
|
|
|
133
|
-
.bi-splash-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
86
|
+
.bi-splash-ad__disclosure-arrow {
|
|
87
|
+
flex-shrink: 0;
|
|
88
|
+
width: 8rpx;
|
|
89
|
+
height: 8rpx;
|
|
90
|
+
margin-top: -4rpx;
|
|
91
|
+
margin-left: 8rpx;
|
|
92
|
+
border-right: 2rpx solid rgba(255, 255, 255, 0.4);
|
|
93
|
+
border-bottom: 2rpx solid rgba(255, 255, 255, 0.4);
|
|
94
|
+
transform: rotate(45deg);
|
|
139
95
|
}
|
|
140
96
|
|
|
141
|
-
.bi-splash-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
97
|
+
.bi-splash-ad__combined-control {
|
|
98
|
+
position: absolute;
|
|
99
|
+
z-index: 99;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
color: #ffffff;
|
|
103
|
+
font-size: 24rpx;
|
|
104
|
+
white-space: nowrap;
|
|
146
105
|
}
|
|
147
106
|
|
|
148
|
-
.bi-splash-
|
|
149
|
-
display:
|
|
107
|
+
.bi-splash-ad__combined-capsule {
|
|
108
|
+
display: flex;
|
|
150
109
|
align-items: center;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
padding: 0 28rpx;
|
|
156
|
-
border: none;
|
|
110
|
+
height: 100%;
|
|
111
|
+
padding: 0 20rpx;
|
|
112
|
+
box-sizing: border-box;
|
|
113
|
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
|
157
114
|
border-radius: 999rpx;
|
|
158
|
-
background:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
115
|
+
background: rgba(0, 0, 0, 0.28);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.bi-splash-ad__combined-disclosure,
|
|
119
|
+
.bi-splash-ad__combined-skip {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
height: 100%;
|
|
163
124
|
}
|
|
164
125
|
|
|
165
|
-
.bi-splash-
|
|
166
|
-
|
|
126
|
+
.bi-splash-ad__combined-divider {
|
|
127
|
+
width: 1rpx;
|
|
128
|
+
height: 28rpx;
|
|
129
|
+
margin: 0 18rpx;
|
|
130
|
+
background: rgba(255, 255, 255, 0.36);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.bi-splash-ad__combined-countdown {
|
|
134
|
+
margin-left: 16rpx;
|
|
135
|
+
line-height: 1;
|
|
136
|
+
text-shadow: 0 1px 4rpx rgba(0, 0, 0, 0.32);
|
|
167
137
|
}
|
|
168
138
|
|
|
169
139
|
.bi-splash-ad__skip {
|
|
170
|
-
position:
|
|
171
|
-
|
|
172
|
-
right: 16px;
|
|
173
|
-
z-index: 20;
|
|
140
|
+
position: absolute;
|
|
141
|
+
z-index: 99;
|
|
174
142
|
display: flex;
|
|
175
143
|
align-items: center;
|
|
176
|
-
|
|
177
|
-
min-width:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
144
|
+
justify-content: center;
|
|
145
|
+
min-width: 148rpx;
|
|
146
|
+
padding: 0 22rpx;
|
|
147
|
+
box-sizing: border-box;
|
|
148
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
149
|
+
border-radius: 32rpx;
|
|
150
|
+
background: transparent;
|
|
181
151
|
color: #ffffff;
|
|
182
152
|
font-size: 24rpx;
|
|
183
|
-
|
|
153
|
+
white-space: nowrap;
|
|
184
154
|
}
|
|
185
155
|
|
|
186
156
|
.bi-splash-ad__skip-divider {
|
|
187
|
-
width:
|
|
157
|
+
width: 1rpx;
|
|
188
158
|
height: 24rpx;
|
|
189
159
|
margin: 0 12rpx;
|
|
190
|
-
background: rgba(255, 255, 255, 0.
|
|
160
|
+
background: rgba(255, 255, 255, 0.3);
|
|
191
161
|
}
|
|
192
162
|
|
|
193
|
-
.bi-splash-
|
|
194
|
-
|
|
163
|
+
.bi-splash-ad__pip-mask {
|
|
164
|
+
position: absolute;
|
|
165
|
+
inset: 0;
|
|
166
|
+
z-index: 3;
|
|
167
|
+
background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.32));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.bi-splash-ad--pip {
|
|
171
|
+
inset: auto 24rpx 24rpx auto;
|
|
172
|
+
width: 320rpx;
|
|
173
|
+
height: 420rpx;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
border-radius: 24rpx;
|
|
176
|
+
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.32);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.bi-splash-ad--pip .bi-splash-ad__popup {
|
|
180
|
+
width: 100%;
|
|
181
|
+
height: 100%;
|
|
182
|
+
border-radius: 24rpx;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.bi-splash-ad--pip-animating {
|
|
186
|
+
transition: all 0.28s ease-in-out;
|
|
195
187
|
}
|
|
196
188
|
|
|
197
189
|
.bi-splash-ad__pip-close {
|
|
@@ -210,4 +202,3 @@
|
|
|
210
202
|
font-size: 24rpx;
|
|
211
203
|
text-align: center;
|
|
212
204
|
}
|
|
213
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bi-nova/ui-taro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-beta.202608171048",
|
|
4
4
|
"description": "BI Nova SDK Taro React UI",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@types/react": "^18.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@bi-nova/core": "1.0.1",
|
|
33
|
-
"@bi-nova/ui": "1.0.0"
|
|
32
|
+
"@bi-nova/core": "^1.0.1",
|
|
33
|
+
"@bi-nova/ui": "^1.0.0"
|
|
34
34
|
},
|
|
35
35
|
"license": "ISC",
|
|
36
36
|
"publishConfig": {
|