@cunpingtai/webad-react-ad-scripts 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,17 @@
8
8
  pnpm add @cunpingtai/webad-react-ad-scripts
9
9
  ```
10
10
 
11
+ 如果 pnpm 报 `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`,请在使用方项目根目录的
12
+ `pnpm-workspace.yaml` 中只豁免本包,然后重新安装:
13
+
14
+ ```yaml
15
+ minimumReleaseAgeExclude:
16
+ - "@cunpingtai/webad-react-ad-scripts"
17
+ ```
18
+
19
+ 这是使用方项目的供应链等待策略,不是包安装失败。也可以设置 `minimumReleaseAge: 0`
20
+ 完全关闭检查,但不推荐。详见完整接入指南。
21
+
11
22
  需要 React 18.3 或 React 19。
12
23
 
13
24
  ## 根部接入
@@ -34,13 +45,15 @@ export function AdvertisingProvider({ children }: React.PropsWithChildren) {
34
45
 
35
46
  `pageKey` 只在真实路由切换时变化。不要传随机数、时间戳、Tab 状态或窗口宽度。
36
47
 
48
+ 本地开发环境不会显示广告。`localhost`、`*.localhost`、`127.0.0.1` 和 `::1` 不会请求中央配置。
49
+
37
50
  ## 后台配置
38
51
 
39
52
  打开 `https://a1.yumeref.com/admin`,编辑对应站点:
40
53
 
41
54
  - Social Bar、Popunder、Smartlink 每站各配置一个;
42
55
  - Banner 和 Native Banner 可以添加多个;
43
- - 每个页面广告位使用唯一名称,例如 `home-top`、`article-middle`、`sidebar-sticky`;
56
+ - 当前统一使用三个 Banner 名称:`placement-728x90`、`placement-320x50`、`placement-300x250`;Native Banner 使用 `placement-native`;
44
57
  - Banner 填脚本地址、广告 Key、宽度和高度;
45
58
  - Native Banner 填脚本地址和 Container ID。
46
59
 
@@ -57,8 +70,9 @@ import {
57
70
  AdsterraSocialBar,
58
71
  } from "@cunpingtai/webad-react-ad-scripts";
59
72
 
60
- <AdsterraBanner placement="home-top" />
61
- <AdsterraNativeBanner placement="article-middle" />
73
+ <AdsterraBanner placement="placement-728x90" />
74
+ <AdsterraBanner placement="placement-300x250" />
75
+ <AdsterraNativeBanner placement="placement-native" />
62
76
 
63
77
  <AdsterraSmartlink className="download-button">
64
78
  继续下载
@@ -68,7 +82,7 @@ import {
68
82
  <AdsterraPopunder />
69
83
  ```
70
84
 
71
- Banner 和 Native Banner 还支持 `className`、`style`。组件找不到对应配置、类型不匹配或当前策略不允许时会返回 `null`。
85
+ 这些是后台广告位名称,不是自动识别的尺寸参数;后台配置的尺寸必须与名称对应。同一页面中的同一个 `placement` 只加载一次。Banner 和 Native Banner 还支持 `className`、`style`。组件找不到对应配置、类型不匹配或当前策略不允许时会返回 `null`。
72
86
 
73
87
  ## 策略
74
88