@bi-nova/ui-taro 1.2.4 → 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-06-17
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-05 14:48:54
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;
@@ -217,12 +240,14 @@ interface BiDisplayAdProps {
217
240
  zIndex?: number;
218
241
  pictureInPicture?: boolean;
219
242
  checkNativeSplash?: boolean;
243
+ nativeSplashCache?: boolean;
220
244
  jumpSeconds?: number;
221
245
  className?: string;
222
246
  onLoad?: (detail: BiDisplayAdEventDetail) => void;
223
247
  onError?: (detail: BiDisplayAdEventDetail) => void;
224
248
  onClose?: (detail: BiDisplayAdEventDetail) => void;
225
249
  onAction?: (detail: BiDisplayAdEventDetail) => void;
250
+ onFeedback?: (detail: BiBannerAdFeedbackDetail) => void;
226
251
  onHide?: (detail: BiDisplayAdEventDetail) => void;
227
252
  onOpenWebview?: (detail: BiDisplayAdEventDetail) => void;
228
253
  onConfigLoad?: (detail: BiDisplayAdConfigEventDetail) => void;
@@ -234,4 +259,4 @@ interface BiDisplayAdProps {
234
259
  */
235
260
  declare const BiDisplayAd: React.FC<BiDisplayAdProps>;
236
261
 
237
- 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-06-17
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-05 14:48:54
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;
@@ -217,12 +240,14 @@ interface BiDisplayAdProps {
217
240
  zIndex?: number;
218
241
  pictureInPicture?: boolean;
219
242
  checkNativeSplash?: boolean;
243
+ nativeSplashCache?: boolean;
220
244
  jumpSeconds?: number;
221
245
  className?: string;
222
246
  onLoad?: (detail: BiDisplayAdEventDetail) => void;
223
247
  onError?: (detail: BiDisplayAdEventDetail) => void;
224
248
  onClose?: (detail: BiDisplayAdEventDetail) => void;
225
249
  onAction?: (detail: BiDisplayAdEventDetail) => void;
250
+ onFeedback?: (detail: BiBannerAdFeedbackDetail) => void;
226
251
  onHide?: (detail: BiDisplayAdEventDetail) => void;
227
252
  onOpenWebview?: (detail: BiDisplayAdEventDetail) => void;
228
253
  onConfigLoad?: (detail: BiDisplayAdConfigEventDetail) => void;
@@ -234,4 +259,4 @@ interface BiDisplayAdProps {
234
259
  */
235
260
  declare const BiDisplayAd: React.FC<BiDisplayAdProps>;
236
261
 
237
- 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 lt=Object.create;var Se=Object.defineProperty,ut=Object.defineProperties,ct=Object.getOwnPropertyDescriptor,dt=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertyNames,$e=Object.getOwnPropertySymbols,mt=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;var je=(e,n,r)=>n in e?Se(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,y=(e,n)=>{for(var r in n||(n={}))He.call(n,r)&&je(e,r,n[r]);if($e)for(var r of $e(n))gt.call(n,r)&&je(e,r,n[r]);return e},G=(e,n)=>ut(e,dt(n));var ft=(e,n)=>{for(var r in n)Se(e,r,{get:n[r],enumerable:!0})},Ge=(e,n,r,h)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of pt(n))!He.call(e,u)&&u!==r&&Se(e,u,{get:()=>n[u],enumerable:!(h=ct(n,u))||h.enumerable});return e};var Ye=(e,n,r)=>(r=e!=null?lt(mt(e)):{},Ge(n||!e||!e.__esModule?Se(r,"default",{value:e,enumerable:!0}):r,e)),At=e=>Ge(Se({},"__esModule",{value:!0}),e);var St={};ft(St,{BiBannerAd:()=>Re,BiDisplayAd:()=>tt,BiSplashAd:()=>ke});module.exports=At(St);var jt=require("./banner/index.scss"),Ht=require("./splash/index.scss");var w=require("react"),U=require("@tarojs/components");var ht=Ye(require("@tarojs/components")),ve;function Ne(){if(ve!==void 0)return ve;try{let e=ht;ve=(e==null?void 0:e.AdCustom)||null}catch(e){ve=null}return ve}var ge=Ye(require("@tarojs/taro"));function xe(){return typeof wx!="undefined"?wx:null}function le(e,n){let r=e==null?void 0:e.detail;return r&&typeof r=="object"?y(y({},n),r):e&&typeof e=="object"?y(y({},n),e):y({},n)}function qe(e){return e&&(e.image||e.video)||""}function Je(e,n=""){return e&&(e.poster||e.image||n)||""}function Ke(e,n=""){return e?e.video?!1:e.image?!0:/\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(String(n).trim()):!0}function ze(e){if(!e)return 2;let n=Number(e.adSpec||e.spec||0);if(n===1||n===2)return n;let r=Number(e.videoWidth||e.width||0),h=Number(e.videoHeight||e.height||0);return r>0&&h>0?r>h?1:2:e.video?1:2}function Pe(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function Xe(e,n=5){let r=e==null?void 0:e.jumpSeconds,h=r!=null?r:n;return Math.min(99,Math.max(0,Number(h)||0))}function be(e){var r;let n=(r=e==null?void 0:e.loadTimeout)!=null?r:e==null?void 0:e.timeout;return Math.max(1e3,Number(n)||5e3)}function 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 yt(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 Me(e){let{customAd:n,actionDetail:r,onOpenWebview:h,onError:u,miniProgramErrorCode:M,navigateErrorCode:Y,miniProgramUnsupportedErrorCode:q}=e;if(!n)return;let x=Bt(n),P=yt(n),J=Dt(n),K=Ct(n);if(x==="miniProgram"&&P){let R=xe();if(!R||typeof R.navigateToMiniProgram!="function"){u==null||u(G(y({},r),{errCode:q||M,errMsg:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}R.navigateToMiniProgram({appId:P,path:J||"",fail:O=>{u==null||u(G(y({},r),{errCode:M,errMsg:(O==null?void 0:O.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(x==="internal"&&J){ge.navigateTo({url:J,fail:R=>{u==null||u(G(y({},r),{errCode:Y,errMsg:(R==null?void 0:R.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}x==="web"&&K&&(h==null||h(G(y({},r),{url:K})))}function Qe(){let e=xe(),n=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},r=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof ge.getSystemInfoSync=="function"?ge.getSystemInfoSync():{},h=r.windowHeight===r.screenHeight,u=16,M=16,Y=16,q=32,x=h&&n.top?n.top:u,P=h&&n.height?n.height:q;return{top:`${x}px`,width:"156rpx",height:`${P}px`,lineHeight:`${P}px`,borderRadius:`${Math.round(P/2)}px`,left:h?`${Y}px`:void 0,right:h?void 0:`${M}px`}}function Ze(){var u;let e=typeof ge.getSystemInfoSync=="function"?ge.getSystemInfoSync():{},n=Math.max(0,Number(e.screenHeight||0)-Number(((u=e.safeArea)==null?void 0:u.bottom)||e.windowHeight||0)),r=n>0?n+42:84,h=n>0?n+88:130;return{contentStyle:{bottom:`${r}rpx`},badgeStyle:{bottom:`${h}rpx`}}}var j=require("react/jsx-runtime"),Re=({unitId:e="",customAd:n,adIntervals:r=30,className:h,onLoad:u,onError:M,onClose:Y,onAction:q,onOpenWebview:x})=>{let P=(0,w.useMemo)(()=>Ne(),[]),J=!!(e&&P),K=(0,w.useRef)(null),R=(0,w.useRef)(!1),O=(0,w.useRef)(!1),k=(0,w.useRef)(u),p=(0,w.useRef)(M),z=(0,w.useRef)(Y),_=(0,w.useRef)(q),W=(0,w.useRef)(x),[ne,E]=(0,w.useState)(!1),c=n||null,ie=(0,w.useMemo)(()=>`bi-banner-ad${h?` ${h}`:""}`,[h]);(0,w.useEffect)(()=>{k.current=u,p.current=M,z.current=Y,_.current=q,W.current=x},[q,Y,M,u,x]);let C=l=>({provider:l,type:"banner"}),V=(0,w.useCallback)(()=>{K.current&&(clearTimeout(K.current),K.current=null)},[]),f=(0,w.useCallback)((l,m)=>{var B;O.current||(O.current=!0,V(),E(!0),(B=p.current)==null||B.call(p,y(y({},le(l,C("custom"))),m)))},[V]);(0,w.useEffect)(()=>{if(V(),R.current=!1,O.current=!1,E(!1),!(J||!(c!=null&&c.image)))return K.current=setTimeout(()=>{f(void 0,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})},be(c)),()=>{V()}},[V,c,J,f]),(0,w.useEffect)(()=>{var l;!e||P||(l=p.current)==null||l.call(p,G(y({},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"}))},[P,e]);let F=l=>{var m;(m=k.current)==null||m.call(k,le(l,C("wechat")))},v=l=>{var m;(m=p.current)==null||m.call(p,le(l,C("wechat")))},re=l=>{var m;(m=z.current)==null||m.call(z,le(l,C("wechat")))},$=()=>{var l;R.current||O.current||(V(),R.current=!0,(l=k.current)==null||l.call(k,C("custom")))},te=l=>{f(l,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},X=l=>{var B,I;(B=l==null?void 0:l.stopPropagation)==null||B.call(l);let m=C("custom");(I=_.current)==null||I.call(_,m),Me({customAd:c,actionDetail:m,onOpenWebview:A=>{var N;(N=W.current)==null||N.call(W,A)},onError:A=>{var N;(N=p.current)==null||N.call(p,A)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL"})},ae=l=>{var m,B;(m=l==null?void 0:l.stopPropagation)==null||m.call(l),(B=z.current)==null||B.call(z,C("custom"))};return J&&P?(0,j.jsx)(P,{className:ie,unitId:e,adIntervals:r,onLoad:F,onError:v,onClose:re}):!c||!c.image||ne?null:(0,j.jsxs)(U.View,{className:ie,children:[(0,j.jsxs)(U.View,{className:"bi-banner-ad__surface",onClick:X,children:[(0,j.jsxs)(U.View,{className:"bi-banner-ad__media",children:[(0,j.jsx)(U.Text,{className:"bi-banner-ad__badge bi-banner-ad__badge--overlay",children:Pe(c)}),(0,j.jsx)(U.Image,{className:"bi-banner-ad__image",src:c.image||"",mode:"aspectFill",onLoad:$,onError:te})]}),(0,j.jsxs)(U.View,{className:"bi-banner-ad__content",children:[(0,j.jsx)(U.View,{className:"bi-banner-ad__body",children:c.title?(0,j.jsx)(U.Text,{className:"bi-banner-ad__title",children:c.title}):null}),(0,j.jsxs)(U.View,{className:"bi-banner-ad__footer",children:[c.description?(0,j.jsx)(U.Text,{className:"bi-banner-ad__description",children:c.description}):null,(0,j.jsx)(U.Button,{className:"bi-banner-ad__button",onClick:X,children:c.buttonText||"\u7ACB\u5373\u67E5\u770B"})]})]})]}),(0,j.jsx)(U.Button,{className:"bi-banner-ad__close",onClick:ae,children:"\xD7"})]})};var a=require("react"),S=require("@tarojs/components");var D=require("react/jsx-runtime"),ke=({unitId:e="",customAd:n,show:r=!0,zIndex:h=999,pictureInPicture:u=!1,checkNativeSplash:M=!0,jumpSeconds:Y=5,className:q,onLoad:x,onError:P,onClose:J,onAction:K,onHide:R,onOpenWebview:O})=>{let k=(0,a.useMemo)(()=>Ne(),[]),p=!!(e&&k),[z,_]=(0,a.useState)(!1),[W,ne]=(0,a.useState)(p),[E,c]=(0,a.useState)(!1),[ie,C]=(0,a.useState)(0),[V,f]=(0,a.useState)(!1),[F,v]=(0,a.useState)(!1),re=(0,a.useRef)(null),$=(0,a.useRef)(null),te=(0,a.useRef)(null),X=(0,a.useRef)(null),ae=(0,a.useRef)(null),l=(0,a.useRef)(0),m=(0,a.useRef)(!1),B=(0,a.useRef)(!1),I=(0,a.useRef)(x),A=(0,a.useRef)(P),N=(0,a.useRef)(J),Q=(0,a.useRef)(K),pe=(0,a.useRef)(R),fe=(0,a.useRef)(O),d=n||null,se=(0,a.useMemo)(()=>qe(d),[d]),_e=(0,a.useMemo)(()=>Je(d,se),[d,se]),de=!!se,Te=(0,a.useMemo)(()=>Ke(d,se),[d,se]),he=(0,a.useMemo)(()=>ze(d),[d]),Le=(0,a.useMemo)(()=>Pe(d),[d]),oe=(0,a.useMemo)(()=>Xe(d,Y),[d,Y]),we=(0,a.useMemo)(()=>Qe(),[]),{contentStyle:ue,badgeStyle:Ee}=(0,a.useMemo)(()=>Ze(),[]),Ie=(0,a.useMemo)(()=>{let s=["bi-splash-ad"];return E&&s.push("bi-splash-ad--pip"),F&&s.push("bi-splash-ad--pip-animating"),q&&s.push(q),s.join(" ")},[q,F,E]);(0,a.useEffect)(()=>{I.current=x,A.current=P,N.current=J,Q.current=K,pe.current=R,fe.current=O},[K,J,P,R,x,O]);let Z=s=>({provider:s,type:"splash"});(0,a.useEffect)(()=>{var s;!r||!e||k||(s=A.current)==null||s.call(A,G(y({},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 ce=(0,a.useCallback)(()=>{re.current&&(clearInterval(re.current),re.current=null),$.current&&(clearTimeout($.current),$.current=null)},[]),me=(0,a.useCallback)(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),L=(0,a.useCallback)(()=>{X.current&&(clearTimeout(X.current),X.current=null)},[]),Be=(0,a.useCallback)(()=>{ae.current&&(clearTimeout(ae.current),ae.current=null)},[]),t=(0,a.useCallback)(()=>{ce(),me(),L(),Be()},[ce,me,Be,L]),i=(0,a.useCallback)(s=>{var g;t(),_(!1),c(!1),C(0),f(!1),B.current=!1,v(!1),(g=N.current)==null||g.call(N,s)},[t]),o=(0,a.useCallback)(()=>{let s=W?"wechat":"custom";if(u){ce(),me(),Be(),v(!0),ae.current=setTimeout(()=>{var g;ae.current=null,c(!0),v(!1),(g=pe.current)==null||g.call(pe,Z(s))},280);return}i({type:"splash",provider:s})},[ce,me,Be,i,W,u]),ee=(0,a.useCallback)(()=>{if(ce(),oe<=0){o();return}C(oe),re.current=setInterval(()=>{C(s=>s<=1?(ce(),$.current=setTimeout(()=>{$.current=null,o()},0),0):s-1)},1e3)},[ce,oe,o]),ye=(0,a.useCallback)(s=>{!r||!p||!s||E||ee()},[p,r,E,ee]),T=(0,a.useCallback)(()=>{let s=!!(!m.current&&(p||de));t(),ne(p),_(s),c(!1),C(oe),f(!1),B.current=!1,v(!1),ye(s),s&&!p&&de&&(te.current=setTimeout(()=>{var g;B.current||(t(),_(!1),c(!1),C(0),f(!1),B.current=!1,v(!1),(g=A.current)==null||g.call(A,G(y({},Z("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},be(d)))},[p,t,oe,de,d,ye]),De=(0,a.useCallback)(()=>{if(!r)return;if(!M){m.current=!1,T();return}if(m.current){_(!1);return}let s=xe();if(!s||typeof s.getShowSplashAdStatus!="function"||l.current>=3){T();return}s.getShowSplashAdStatus({success:g=>{var H;if((g==null?void 0:g.code)===-1){l.current+=1,L(),X.current=setTimeout(()=>{X.current=null,De()},300);return}if((g==null?void 0:g.code)===1){t(),_(!1),m.current=!0,(H=I.current)==null||H.call(I,{provider:"wechat",type:"splash",nativeSplash:!0});return}T()},fail:()=>{T()}})},[p,M,t,L,de,T,r]);(0,a.useEffect)(()=>{if(!r){t(),_(!1),ne(p),c(!1),C(0),f(!1),B.current=!1,v(!1),m.current=!1;return}if(l.current=0,!M)m.current=!1;else if(m.current)return t(),ne(p),_(!1),c(!1),C(0),f(!1),B.current=!1,v(!1),()=>{t()};return t(),ne(p),_(!1),c(!1),C(oe),f(!1),B.current=!1,v(!1),De(),()=>{t()}},[p,M,De,t,oe,r]);let Ue=s=>{var g;ee(),(g=I.current)==null||g.call(I,le(s,Z("wechat")))},nt=s=>{var g;if(W){if(t(),de){ne(!1),_(!0),c(!1),C(oe),f(!1),B.current=!1,v(!1),te.current=setTimeout(()=>{var H;B.current||(t(),_(!1),c(!1),C(0),f(!1),B.current=!1,v(!1),(H=A.current)==null||H.call(A,G(y({},Z("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},be(d));return}_(!1),c(!1),C(0),f(!1),B.current=!1,v(!1),(g=N.current)==null||g.call(N,{provider:"wechat",type:"splash",reason:"wechatAdLoadFail",error:s})}},rt=s=>{var Ae;let g=s&&typeof s.detail=="object"?s.detail:{},H=G(y({},le(s,Z("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(g.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:g.errCode,rawErrMsg:g.errMsg});(Ae=A.current)==null||Ae.call(A,H),nt(H)},it=s=>{i(le(s,Z("wechat")))},Ve=()=>{var s;B.current||(me(),B.current=!0,f(!0),ee(),(s=I.current)==null||s.call(I,Z("custom")))},at=(s,g)=>{var H;t(),_(!1),c(!1),C(0),f(!1),B.current=!1,v(!1),(H=A.current)==null||H.call(A,y(y({},le(s,Z("custom"))),g))},Fe=s=>{at(s,{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},st=()=>{var H;let s=W?"wechat":"custom",g=Z(s);(H=Q.current)==null||H.call(Q,g),s==="custom"&&Me({customAd:d,actionDetail:g,onOpenWebview:Ae=>{var Ce;(Ce=fe.current)==null||Ce.call(fe,Ae)},onError:Ae=>{var Ce;(Ce=A.current)==null||Ce.call(A,Ae)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL"})},ot=()=>{i({type:"splash",provider:W?"wechat":"custom"})},Oe=W?k:null;return!z||!!!Oe&&!de?null:(0,D.jsxs)(S.View,{className:Ie,style:{zIndex:h},children:[Oe?(0,D.jsx)(S.View,{className:"bi-splash-ad__popup",children:(0,D.jsx)(S.View,{className:`bi-splash-ad__media-wrapper${E?" bi-splash-ad__media-wrapper--pip":""}`,children:(0,D.jsx)(Oe,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:Ue,onError:rt,onClose:it})})}):(0,D.jsx)(S.View,{className:"bi-splash-ad__popup",children:(0,D.jsxs)(S.View,{className:"bi-splash-ad__media-shell",onClick:st,children:[Te?(0,D.jsx)(S.Image,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:se,mode:"aspectFill",onLoad:Ve,onError:Fe}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(S.Image,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:_e,mode:"aspectFill"}),(0,D.jsx)(S.Video,{className:`bi-splash-ad__video${he===1?" bi-splash-ad__video--landscape":""}`,src:se,poster:_e,autoplay:!0,muted:(d==null?void 0:d.muted)!==!1,loop:!0,objectFit:"cover",showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:Ve,onError:Fe})]}),E?(0,D.jsx)(S.View,{className:"bi-splash-ad__pip-mask"}):null,E?null:(0,D.jsx)(S.View,{className:"bi-splash-ad__badge",style:Ee,children:Le}),d&&(d.title||!E&&(d.description||d.buttonText))?(0,D.jsxs)(S.View,{className:"bi-splash-ad__content",style:ue,children:[d.title?(0,D.jsx)(S.Text,{className:"bi-splash-ad__title",children:d.title}):null,!E&&d.description?(0,D.jsx)(S.Text,{className:"bi-splash-ad__description",children:d.description}):null,!E&&d.buttonText?(0,D.jsx)(S.Button,{className:"bi-splash-ad__action",children:d.buttonText}):null]}):null]})}),E?(0,D.jsx)(S.View,{className:"bi-splash-ad__pip-close",onClick:ot,children:(0,D.jsx)(S.View,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,E?null:(0,D.jsxs)(S.View,{className:"bi-splash-ad__skip",style:we,onClick:o,children:[(0,D.jsxs)(S.Text,{children:[ie,"s"]}),(0,D.jsx)(S.View,{className:"bi-splash-ad__skip-divider"}),(0,D.jsx)(S.Text,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};var b=require("react");var We=require("react/jsx-runtime"),et=["banner","splash"],tt=({adId:e="",unitId:n,type:r="banner",customAd:h,adOptions:u=null,sdkKey:M="biNova",autoLoad:Y=!0,adIntervals:q=30,show:x=!0,zIndex:P=999,pictureInPicture:J=!1,checkNativeSplash:K=!0,jumpSeconds:R=5,className:O,onLoad:k,onError:p,onClose:z,onAction:_,onHide:W,onOpenWebview:ne,onConfigLoad:E,onConfigError:c})=>{let ie=(0,b.useRef)(0),C=(0,b.useRef)(""),V=(0,b.useRef)(k),f=(0,b.useRef)(p),F=(0,b.useRef)(z),v=(0,b.useRef)(_),re=(0,b.useRef)(W),$=(0,b.useRef)(ne),te=(0,b.useRef)(E),X=(0,b.useRef)(c),ae=(0,b.useRef)(x),[l,m]=(0,b.useState)(!1),[B,I]=(0,b.useState)(!1),[A,N]=(0,b.useState)(null);(0,b.useEffect)(()=>{V.current=k,f.current=p,F.current=z,v.current=_,re.current=W,$.current=ne,te.current=E,X.current=c,ae.current=x},[_,z,c,E,p,W,k,ne,x]);let Q=(0,b.useMemo)(()=>et.includes(r)?r:"banner",[r]),pe=()=>!!(Y&&e),fe=()=>{var ee;let t=globalThis.getApp,i=typeof t=="function"?t():null;if(!i)return null;let o=i;return o[M]||((ee=o.globalData)==null?void 0:ee[M])||null},d=()=>{var t;try{if(typeof wx!="undefined"&&typeof wx.getAccountInfoSync=="function"){let i=wx.getAccountInfoSync();return((t=i==null?void 0:i.miniProgram)==null?void 0:t.appId)||""}}catch(i){return""}return""},se=()=>{ie.current+=1,C.current="",m(!1),I(!1),N(null)},_e=()=>{let t=u&&typeof u=="object"?u:{},i=d();return G(y({},t),{adId:e,placementId:t.placementId||e,appId:t.appId||i,type:Q})},de=t=>{try{return JSON.stringify(t||{})}catch(i){return`${String(t.appId||"")}_${String(t.placementId||"")}`}},Te=t=>{let i=(t==null?void 0:t.unitId)||"",o=(t==null?void 0:t.customAd)||(t==null?void 0:t.custom)||null,ee=typeof(t==null?void 0:t.show)=="boolean"?t.show:!!(i||o);return{unitId:i,customAd:o,show:ee}},he=t=>{var i,o;(i=X.current)==null||i.call(X,t),(o=f.current)==null||o.call(f,t)},Le=t=>{var i;(i=F.current)==null||i.call(F,{type:Q,adId:e||t.adId||"",provider:"none",reason:"noAd"})},oe=async()=>{var ye;if(!pe())return;let t=_e(),i=de(t);if(C.current===i&&(l||B))return;let o=fe();if(!(o!=null&&o.ads)||typeof o.ads.getDisplayAdConfig!="function"){se(),he({type:Q,adId:e,errCode:"DISPLAY_AD_SDK_NOT_READY",errMsg:"\u672A\u83B7\u53D6\u5230\u53EF\u7528\u7684\u5E7F\u544A\u670D\u52A1 SDK\uFF0C\u8BF7\u5148\u6CE8\u5165\u5168\u5C40 biNova \u5B9E\u4F8B"});return}let ee=ie.current+1;ie.current=ee,C.current=i,m(!0),I(!1),N(null);try{let T=await o.ads.getDisplayAdConfig(t);if(ee!==ie.current)return;if(!T||T.code!==0||!T.data){m(!1),I(!0),N(null),he({type:Q,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(T==null?void 0:T.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:T||null});return}let De=Te(T.data),Ue=!!(ae.current&&!De.show);m(!1),I(!0),N(T.data),(ye=te.current)==null||ye.call(te,{type:Q,adId:e,requestOptions:t,data:T.data}),Ue&&Le(T.data)}catch(T){if(ee!==ie.current)return;m(!1),I(!0),N(null),he({type:Q,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:T instanceof Error?T.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:T})}};(0,b.useEffect)(()=>{var t;et.includes(r)||(t=f.current)==null||t.call(f,{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,b.useEffect)(()=>{if(!e){se();return}oe()},[e,u,Y,Q,M]);let we=pe(),ue=we?Te(A):null,Ee=ue?ue.unitId:n||"",Ie=ue?ue.customAd:h||null,Z=!!(x&&(!we||!e||B&&(ue!=null&&ue.show))),ce=!!K,me=e||(A==null?void 0:A.adId)||"",L=t=>y({adId:me},t);return Q==="splash"?(0,We.jsx)(ke,y({},{unitId:Ee,customAd:Ie,show:Z,zIndex:P,pictureInPicture:J,checkNativeSplash:ce,jumpSeconds:R,className:O,onLoad:i=>{var o;(o=V.current)==null||o.call(V,L(i))},onError:i=>{var o;(o=f.current)==null||o.call(f,L(i))},onClose:i=>{var o;(o=F.current)==null||o.call(F,L(i))},onAction:i=>{var o;(o=v.current)==null||o.call(v,L(i))},onHide:i=>{var o;(o=re.current)==null||o.call(re,L(i))},onOpenWebview:i=>{var o;(o=$.current)==null||o.call($,L(i))}})):Z?(0,We.jsx)(Re,y({},{unitId:Ee,customAd:Ie,adIntervals:q,className:O,onLoad:t=>{var i;(i=V.current)==null||i.call(V,L(t))},onError:t=>{var i;(i=f.current)==null||i.call(f,L(t))},onClose:t=>{var i;(i=F.current)==null||i.call(F,L(t))},onAction:t=>{var i;(i=v.current)==null||i.call(v,L(t))},onOpenWebview:t=>{var i;(i=$.current)==null||i.call($,L(t))}})):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,yt=Object.defineProperties;var Dt=Object.getOwnPropertyDescriptors;var Xe=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var Qe=(e,i,r)=>i in e?Bt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,h=(e,i)=>{for(var r in i||(i={}))Ct.call(i,r)&&Qe(e,r,i[r]);if(Xe)for(var r of Xe(i))St.call(i,r)&&Qe(e,r,i[r]);return e},W=(e,i)=>yt(e,Dt(i));import"./banner/index.scss";import"./splash/index.scss";import{useCallback as st,useEffect as $e,useMemo as ot,useRef as de,useState as Et}from"react";import{View as Be,Image as It,Button as lt,Text as je}from"@tarojs/components";import*as vt from"@tarojs/components";var Te;function Re(){if(Te!==void 0)return Te;try{let e=vt;Te=(e==null?void 0:e.AdCustom)||null}catch(e){Te=null}return Te}import*as fe from"@tarojs/taro";function ke(){return typeof wx!="undefined"?wx:null}function se(e,i){let r=e==null?void 0:e.detail;return r&&typeof r=="object"?h(h({},i),r):e&&typeof e=="object"?h(h({},i),e):h({},i)}function Ze(e){return e&&(e.image||e.video)||""}function et(e,i=""){return e&&(e.poster||e.image||i)||""}function tt(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 nt(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),y=Number(e.videoHeight||e.height||0);return r>0&&y>0?r>y?1:2:e.video?1:2}function Le(e){return e&&(e.badgeText||e.adLabel)||"\u5E7F\u544A"}function rt(e,i=5){let r=e==null?void 0:e.jumpSeconds,y=r!=null?r:i;return Math.min(99,Math.max(0,Number(y)||0))}function we(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 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 _t(e){return e&&(e.appId||e.miniProgramAppId||e.jumpAppId)||""}function Tt(e){return e&&(e.path||e.pagePath||e.jumpPath||e.targetUrl)||""}function wt(e){return e&&(e.url||e.webUrl||e.h5Url)||""}function Ue(e){let{customAd:i,actionDetail:r,onOpenWebview:y,onError:f,miniProgramErrorCode:E,navigateErrorCode:F,miniProgramUnsupportedErrorCode:$}=e;if(!i)return;let T=bt(i),w=_t(i),j=Tt(i),H=wt(i);if(T==="miniProgram"&&w){let I=ke();if(!I||typeof I.navigateToMiniProgram!="function"){f==null||f(W(h({},r),{errCode:$||E,errMsg:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F"}));return}I.navigateToMiniProgram({appId:w,path:j||"",fail:M=>{f==null||f(W(h({},r),{errCode:E,errMsg:(M==null?void 0:M.errMsg)||"\u8DF3\u8F6C\u5230\u5176\u4ED6\u5C0F\u7A0B\u5E8F\u5931\u8D25"}))}});return}if(T==="internal"&&j){fe.navigateTo({url:j,fail:I=>{f==null||f(W(h({},r),{errCode:F,errMsg:(I==null?void 0:I.errMsg)||"\u9875\u9762\u8DF3\u8F6C\u5931\u8D25"}))}});return}T==="web"&&H&&(y==null||y(W(h({},r),{url:H})))}function it(){let e=ke(),i=e&&typeof e.getMenuButtonBoundingClientRect=="function"?e.getMenuButtonBoundingClientRect():{},r=e&&typeof e.getWindowInfo=="function"?e.getWindowInfo():typeof fe.getSystemInfoSync=="function"?fe.getSystemInfoSync():{},y=r.windowHeight===r.screenHeight,f=16,E=16,F=16,$=32,T=y&&i.top?i.top:f,w=y&&i.height?i.height:$;return{top:`${T}px`,width:"156rpx",height:`${w}px`,lineHeight:`${w}px`,borderRadius:`${Math.round(w/2)}px`,left:y?`${F}px`:void 0,right:y?void 0:`${E}px`}}function at(){var f;let e=typeof fe.getSystemInfoSync=="function"?fe.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,y=i>0?i+88:130;return{contentStyle:{bottom:`${r}rpx`},badgeStyle:{bottom:`${y}rpx`}}}import{jsx as pe,jsxs as Ee}from"react/jsx-runtime";var He=({unitId:e="",customAd:i,adIntervals:r=30,className:y,onLoad:f,onError:E,onClose:F,onAction:$,onOpenWebview:T})=>{let w=ot(()=>Re(),[]),j=!!(e&&w),H=de(null),I=de(!1),M=de(!1),N=de(f),c=de(E),G=de(F),C=de($),R=de(T),[Q,v]=Et(!1),l=i||null,ne=ot(()=>`bi-banner-ad${y?` ${y}`:""}`,[y]);$e(()=>{N.current=f,c.current=E,G.current=F,C.current=$,R.current=T},[$,F,E,f,T]);let B=o=>({provider:o,type:"banner"}),k=st(()=>{H.current&&(clearTimeout(H.current),H.current=null)},[]),m=st((o,d)=>{var A;M.current||(M.current=!0,k(),v(!0),(A=c.current)==null||A.call(c,h(h({},se(o,B("custom"))),d)))},[k]);$e(()=>{if(k(),I.current=!1,M.current=!1,v(!1),!(j||!(l!=null&&l.image)))return H.current=setTimeout(()=>{m(void 0,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})},we(l)),()=>{k()}},[k,l,j,m]),$e(()=>{var o;!e||w||(o=c.current)==null||o.call(c,W(h({},B("wechat")),{errCode:"BI_BANNER_NATIVE_AD_UNSUPPORTED",errMsg:"\u5F53\u524D\u7AEF\u4E0D\u652F\u6301\u5FAE\u4FE1\u539F\u751F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7EC4\u4EF6"}))},[w,e]);let L=o=>{var d;(d=N.current)==null||d.call(N,se(o,B("wechat")))},D=o=>{var d;(d=c.current)==null||d.call(c,se(o,B("wechat")))},Z=o=>{var d;(d=G.current)==null||d.call(G,se(o,B("wechat")))},U=()=>{var o;I.current||M.current||(k(),I.current=!0,(o=N.current)==null||o.call(N,B("custom")))},z=o=>{m(o,{errCode:"BI_BANNER_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"Banner \u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},Y=o=>{var A,b;(A=o==null?void 0:o.stopPropagation)==null||A.call(o);let d=B("custom");(b=C.current)==null||b.call(C,d),Ue({customAd:l,actionDetail:d,onOpenWebview:g=>{var _;(_=R.current)==null||_.call(R,g)},onError:g=>{var _;(_=c.current)==null||_.call(c,g)},miniProgramErrorCode:"BI_BANNER_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_BANNER_NAVIGATE_FAIL"})},re=o=>{var d,A;(d=o==null?void 0:o.stopPropagation)==null||d.call(o),(A=G.current)==null||A.call(G,B("custom"))};return j&&w?pe(w,{className:ne,unitId:e,adIntervals:r,onLoad:L,onError:D,onClose:Z}):!l||!l.image||Q?null:Ee(Be,{className:ne,children:[Ee(Be,{className:"bi-banner-ad__surface",onClick:Y,children:[Ee(Be,{className:"bi-banner-ad__media",children:[pe(je,{className:"bi-banner-ad__badge bi-banner-ad__badge--overlay",children:Le(l)}),pe(It,{className:"bi-banner-ad__image",src:l.image||"",mode:"aspectFill",onLoad:U,onError:z})]}),Ee(Be,{className:"bi-banner-ad__content",children:[pe(Be,{className:"bi-banner-ad__body",children:l.title?pe(je,{className:"bi-banner-ad__title",children:l.title}):null}),Ee(Be,{className:"bi-banner-ad__footer",children:[l.description?pe(je,{className:"bi-banner-ad__description",children:l.description}):null,pe(lt,{className:"bi-banner-ad__button",onClick:Y,children:l.buttonText||"\u7ACB\u5373\u67E5\u770B"})]})]})]}),pe(lt,{className:"bi-banner-ad__close",onClick:re,children:"\xD7"})]})};import{useCallback as ee,useEffect as Ge,useMemo as oe,useRef as V,useState as ye}from"react";import{View as X,Image as ut,Video as Nt,Button as xt,Text as Oe}from"@tarojs/components";import{Fragment as Pt,jsx as P,jsxs as De}from"react/jsx-runtime";var Ye=({unitId:e="",customAd:i,show:r=!0,zIndex:y=999,pictureInPicture:f=!1,checkNativeSplash:E=!0,jumpSeconds:F=5,className:$,onLoad:T,onError:w,onClose:j,onAction:H,onHide:I,onOpenWebview:M})=>{let N=oe(()=>Re(),[]),c=!!(e&&N),[G,C]=ye(!1),[R,Q]=ye(c),[v,l]=ye(!1),[ne,B]=ye(0),[k,m]=ye(!1),[L,D]=ye(!1),Z=V(null),U=V(null),z=V(null),Y=V(null),re=V(null),o=V(0),d=V(!1),A=V(!1),b=V(T),g=V(w),_=V(j),q=V(H),me=V(I),Ae=V(M),u=i||null,ie=oe(()=>Ze(u),[u]),Ie=oe(()=>et(u,ie),[u,ie]),ce=!!ie,Ne=oe(()=>tt(u,ie),[u,ie]),Ce=oe(()=>nt(u),[u]),We=oe(()=>Le(u),[u]),ae=oe(()=>rt(u,F),[u,F]),xe=oe(()=>it(),[]),{contentStyle:le,badgeStyle:Pe}=oe(()=>at(),[]),Me=oe(()=>{let a=["bi-splash-ad"];return v&&a.push("bi-splash-ad--pip"),L&&a.push("bi-splash-ad--pip-animating"),$&&a.push($),a.join(" ")},[$,L,v]);Ge(()=>{b.current=T,g.current=w,_.current=j,q.current=H,me.current=I,Ae.current=M},[H,j,w,I,T,M]);let J=a=>({provider:a,type:"splash"});Ge(()=>{var a;!r||!e||N||(a=g.current)==null||a.call(g,W(h({},J("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"}))},[N,r,e]);let ue=ee(()=>{Z.current&&(clearInterval(Z.current),Z.current=null),U.current&&(clearTimeout(U.current),U.current=null)},[]),ge=ee(()=>{z.current&&(clearTimeout(z.current),z.current=null)},[]),x=ee(()=>{Y.current&&(clearTimeout(Y.current),Y.current=null)},[]),Se=ee(()=>{re.current&&(clearTimeout(re.current),re.current=null)},[]),t=ee(()=>{ue(),ge(),x(),Se()},[ue,ge,Se,x]),n=ee(a=>{var p;t(),C(!1),l(!1),B(0),m(!1),A.current=!1,D(!1),(p=_.current)==null||p.call(_,a)},[t]),s=ee(()=>{let a=R?"wechat":"custom";if(f){ue(),ge(),Se(),D(!0),re.current=setTimeout(()=>{var p;re.current=null,l(!0),D(!1),(p=me.current)==null||p.call(me,J(a))},280);return}n({type:"splash",provider:a})},[ue,ge,Se,n,R,f]),K=ee(()=>{if(ue(),ae<=0){s();return}B(ae),Z.current=setInterval(()=>{B(a=>a<=1?(ue(),U.current=setTimeout(()=>{U.current=null,s()},0),0):a-1)},1e3)},[ue,ae,s]),ve=ee(a=>{!r||!c||!a||v||K()},[c,r,v,K]),S=ee(()=>{let a=!!(!d.current&&(c||ce));t(),Q(c),C(a),l(!1),B(ae),m(!1),A.current=!1,D(!1),ve(a),a&&!c&&ce&&(z.current=setTimeout(()=>{var p;A.current||(t(),C(!1),l(!1),B(0),m(!1),A.current=!1,D(!1),(p=g.current)==null||p.call(g,W(h({},J("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},we(u)))},[c,t,ae,ce,u,ve]),be=ee(()=>{if(!r)return;if(!E){d.current=!1,S();return}if(d.current){C(!1);return}let a=ke();if(!a||typeof a.getShowSplashAdStatus!="function"||o.current>=3){S();return}a.getShowSplashAdStatus({success:p=>{var O;if((p==null?void 0:p.code)===-1){o.current+=1,x(),Y.current=setTimeout(()=>{Y.current=null,be()},300);return}if((p==null?void 0:p.code)===1){t(),C(!1),d.current=!0,(O=b.current)==null||O.call(b,{provider:"wechat",type:"splash",nativeSplash:!0});return}S()},fail:()=>{S()}})},[c,E,t,x,ce,S,r]);Ge(()=>{if(!r){t(),C(!1),Q(c),l(!1),B(0),m(!1),A.current=!1,D(!1),d.current=!1;return}if(o.current=0,!E)d.current=!1;else if(d.current)return t(),Q(c),C(!1),l(!1),B(0),m(!1),A.current=!1,D(!1),()=>{t()};return t(),Q(c),C(!1),l(!1),B(ae),m(!1),A.current=!1,D(!1),be(),()=>{t()}},[c,E,be,t,ae,r]);let Ve=a=>{var p;K(),(p=b.current)==null||p.call(b,se(a,J("wechat")))},pt=a=>{var p;if(R){if(t(),ce){Q(!1),C(!0),l(!1),B(ae),m(!1),A.current=!1,D(!1),z.current=setTimeout(()=>{var O;A.current||(t(),C(!1),l(!1),B(0),m(!1),A.current=!1,D(!1),(O=g.current)==null||O.call(g,W(h({},J("custom")),{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_TIMEOUT",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u8D85\u65F6"})))},we(u));return}C(!1),l(!1),B(0),m(!1),A.current=!1,D(!1),(p=_.current)==null||p.call(_,{provider:"wechat",type:"splash",reason:"wechatAdLoadFail",error:a})}},mt=a=>{var he;let p=a&&typeof a.detail=="object"?a.detail:{},O=W(h({},se(a,J("wechat"))),{errCode:"BI_SPLASH_WECHAT_AD_LOAD_FAIL",errMsg:String(p.errMsg||"\u5FAE\u4FE1\u5F00\u5C4F\u5E7F\u544A\u52A0\u8F7D\u5931\u8D25"),rawErrCode:p.errCode,rawErrMsg:p.errMsg});(he=g.current)==null||he.call(g,O),pt(O)},gt=a=>{n(se(a,J("wechat")))},Ke=()=>{var a;A.current||(ge(),A.current=!0,m(!0),K(),(a=b.current)==null||a.call(b,J("custom")))},ft=(a,p)=>{var O;t(),C(!1),l(!1),B(0),m(!1),A.current=!1,D(!1),(O=g.current)==null||O.call(g,h(h({},se(a,J("custom"))),p))},ze=a=>{ft(a,{errCode:"BI_SPLASH_CUSTOM_MEDIA_LOAD_FAIL",errMsg:"\u5F00\u5C4F\u81EA\u5B9A\u4E49\u5E7F\u544A\u7D20\u6750\u52A0\u8F7D\u5931\u8D25"})},At=()=>{var O;let a=R?"wechat":"custom",p=J(a);(O=q.current)==null||O.call(q,p),a==="custom"&&Ue({customAd:u,actionDetail:p,onOpenWebview:he=>{var _e;(_e=Ae.current)==null||_e.call(Ae,he)},onError:he=>{var _e;(_e=g.current)==null||_e.call(g,he)},miniProgramErrorCode:"BI_SPLASH_NAVIGATE_MINI_PROGRAM_FAIL",navigateErrorCode:"BI_SPLASH_NAVIGATE_FAIL"})},ht=()=>{n({type:"splash",provider:R?"wechat":"custom"})},Fe=R?N:null;return!G||!!!Fe&&!ce?null:De(X,{className:Me,style:{zIndex:y},children:[Fe?P(X,{className:"bi-splash-ad__popup",children:P(X,{className:`bi-splash-ad__media-wrapper${v?" bi-splash-ad__media-wrapper--pip":""}`,children:P(Fe,{className:"bi-splash-ad__wechat-unit",unitId:e,onLoad:Ve,onError:mt,onClose:gt})})}):P(X,{className:"bi-splash-ad__popup",children:De(X,{className:"bi-splash-ad__media-shell",onClick:At,children:[Ne?P(ut,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:ie,mode:"aspectFill",onLoad:Ke,onError:ze}):De(Pt,{children:[P(ut,{className:"bi-splash-ad__media bi-splash-ad__media--background",src:Ie,mode:"aspectFill"}),P(Nt,{className:`bi-splash-ad__video${Ce===1?" bi-splash-ad__video--landscape":""}`,src:ie,poster:Ie,autoplay:!0,muted:(u==null?void 0:u.muted)!==!1,loop:!0,objectFit:"cover",showCenterPlayBtn:!1,showPlayBtn:!1,controls:!1,onLoadedMetaData:Ke,onError:ze})]}),v?P(X,{className:"bi-splash-ad__pip-mask"}):null,v?null:P(X,{className:"bi-splash-ad__badge",style:Pe,children:We}),u&&(u.title||!v&&(u.description||u.buttonText))?De(X,{className:"bi-splash-ad__content",style:le,children:[u.title?P(Oe,{className:"bi-splash-ad__title",children:u.title}):null,!v&&u.description?P(Oe,{className:"bi-splash-ad__description",children:u.description}):null,!v&&u.buttonText?P(xt,{className:"bi-splash-ad__action",children:u.buttonText}):null]}):null]})}),v?P(X,{className:"bi-splash-ad__pip-close",onClick:ht,children:P(X,{className:"bi-splash-ad__pip-close-text",children:"\u5173\u95ED"})}):null,v?null:De(X,{className:"bi-splash-ad__skip",style:xe,onClick:s,children:[De(Oe,{children:[ne,"s"]}),P(X,{className:"bi-splash-ad__skip-divider"}),P(Oe,{className:"bi-splash-ad__skip-text",children:"\u8DF3\u8FC7"})]})]})};import{useEffect as qe,useMemo as Mt,useRef as te,useState as Je}from"react";import{jsx as dt}from"react/jsx-runtime";var ct=["banner","splash"],Rt=({adId:e="",unitId:i,type:r="banner",customAd:y,adOptions:f=null,sdkKey:E="biNova",autoLoad:F=!0,adIntervals:$=30,show:T=!0,zIndex:w=999,pictureInPicture:j=!1,checkNativeSplash:H=!0,jumpSeconds:I=5,className:M,onLoad:N,onError:c,onClose:G,onAction:C,onHide:R,onOpenWebview:Q,onConfigLoad:v,onConfigError:l})=>{let ne=te(0),B=te(""),k=te(N),m=te(c),L=te(G),D=te(C),Z=te(R),U=te(Q),z=te(v),Y=te(l),re=te(T),[o,d]=Je(!1),[A,b]=Je(!1),[g,_]=Je(null);qe(()=>{k.current=N,m.current=c,L.current=G,D.current=C,Z.current=R,U.current=Q,z.current=v,Y.current=l,re.current=T},[C,G,l,v,c,R,N,Q,T]);let q=Mt(()=>ct.includes(r)?r:"banner",[r]),me=()=>!!(F&&e),Ae=()=>{var K;let t=globalThis.getApp,n=typeof t=="function"?t():null;if(!n)return null;let s=n;return s[E]||((K=s.globalData)==null?void 0:K[E])||null},u=()=>{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""},ie=()=>{ne.current+=1,B.current="",d(!1),b(!1),_(null)},Ie=()=>{let t=f&&typeof f=="object"?f:{},n=u();return W(h({},t),{adId:e,placementId:t.placementId||e,appId:t.appId||n,type:q})},ce=t=>{try{return JSON.stringify(t||{})}catch(n){return`${String(t.appId||"")}_${String(t.placementId||"")}`}},Ne=t=>{let n=(t==null?void 0:t.unitId)||"",s=(t==null?void 0:t.customAd)||(t==null?void 0:t.custom)||null,K=typeof(t==null?void 0:t.show)=="boolean"?t.show:!!(n||s);return{unitId:n,customAd:s,show:K}},Ce=t=>{var n,s;(n=Y.current)==null||n.call(Y,t),(s=m.current)==null||s.call(m,t)},We=t=>{var n;(n=L.current)==null||n.call(L,{type:q,adId:e||t.adId||"",provider:"none",reason:"noAd"})},ae=async()=>{var ve;if(!me())return;let t=Ie(),n=ce(t);if(B.current===n&&(o||A))return;let s=Ae();if(!(s!=null&&s.ads)||typeof s.ads.getDisplayAdConfig!="function"){ie(),Ce({type:q,adId:e,errCode:"DISPLAY_AD_SDK_NOT_READY",errMsg:"\u672A\u83B7\u53D6\u5230\u53EF\u7528\u7684\u5E7F\u544A\u670D\u52A1 SDK\uFF0C\u8BF7\u5148\u6CE8\u5165\u5168\u5C40 biNova \u5B9E\u4F8B"});return}let K=ne.current+1;ne.current=K,B.current=n,d(!0),b(!1),_(null);try{let S=await s.ads.getDisplayAdConfig(t);if(K!==ne.current)return;if(!S||S.code!==0||!S.data){d(!1),b(!0),_(null),Ce({type:q,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_FAIL",errMsg:(S==null?void 0:S.message)||"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5931\u8D25",rawResult:S||null});return}let be=Ne(S.data),Ve=!!(re.current&&!be.show);d(!1),b(!0),_(S.data),(ve=z.current)==null||ve.call(z,{type:q,adId:e,requestOptions:t,data:S.data}),Ve&&We(S.data)}catch(S){if(K!==ne.current)return;d(!1),b(!0),_(null),Ce({type:q,adId:e,errCode:"DISPLAY_AD_REMOTE_CONFIG_EXCEPTION",errMsg:S instanceof Error?S.message:"\u83B7\u53D6\u5C55\u793A\u5E7F\u544A\u914D\u7F6E\u5F02\u5E38",error:S})}};qe(()=>{var t;ct.includes(r)||(t=m.current)==null||t.call(m,{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]),qe(()=>{if(!e){ie();return}ae()},[e,f,F,q,E]);let xe=me(),le=xe?Ne(g):null,Pe=le?le.unitId:i||"",Me=le?le.customAd:y||null,J=!!(T&&(!xe||!e||A&&(le!=null&&le.show))),ue=!!H,ge=e||(g==null?void 0:g.adId)||"",x=t=>h({adId:ge},t);return q==="splash"?dt(Ye,h({},{unitId:Pe,customAd:Me,show:J,zIndex:w,pictureInPicture:j,checkNativeSplash:ue,jumpSeconds:I,className:M,onLoad:n=>{var s;(s=k.current)==null||s.call(k,x(n))},onError:n=>{var s;(s=m.current)==null||s.call(m,x(n))},onClose:n=>{var s;(s=L.current)==null||s.call(L,x(n))},onAction:n=>{var s;(s=D.current)==null||s.call(D,x(n))},onHide:n=>{var s;(s=Z.current)==null||s.call(Z,x(n))},onOpenWebview:n=>{var s;(s=U.current)==null||s.call(U,x(n))}})):J?dt(He,h({},{unitId:Pe,customAd:Me,adIntervals:$,className:M,onLoad:t=>{var n;(n=k.current)==null||n.call(k,x(t))},onError:t=>{var n;(n=m.current)==null||n.call(m,x(t))},onClose:t=>{var n;(n=L.current)==null||n.call(L,x(t))},onAction:t=>{var n;(n=D.current)==null||n.call(D,x(t))},onOpenWebview:t=>{var n;(n=U.current)==null||n.call(U,x(t))}})):null};export{He as BiBannerAd,Rt as BiDisplayAd,Ye 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.4",
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": {