@bi-nova/ui-taro 1.2.5 → 1.3.0-beta.202608131817

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