@adland/react 0.5.1 → 0.6.0
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/CHANGELOG.md +18 -0
- package/package.json +3 -3
- package/src/components/Ad.tsx +15 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @adland/react
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 09a1d72: large refactor
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [0ee3757]
|
|
12
|
+
- Updated dependencies [09a1d72]
|
|
13
|
+
- @adland/data@0.6.0
|
|
14
|
+
|
|
15
|
+
## 0.5.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- af12999: ad variable
|
|
20
|
+
|
|
3
21
|
## 0.5.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adland/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@adland/data": "^0.4.0",
|
|
26
25
|
"@farcaster/miniapp-sdk": "0.2.1",
|
|
27
26
|
"@types/node": "^20",
|
|
28
27
|
"@types/react": "^19.1.16",
|
|
29
28
|
"@types/react-dom": "^18.3.1",
|
|
30
29
|
"lucide-react": "0.561.0",
|
|
31
|
-
"tsup": "^8.0.1"
|
|
30
|
+
"tsup": "^8.0.1",
|
|
31
|
+
"@adland/data": "0.6.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
package/src/components/Ad.tsx
CHANGED
|
@@ -6,17 +6,27 @@ import { Loader, SquareDashed } from "lucide-react";
|
|
|
6
6
|
import { type AdData } from "@adland/data";
|
|
7
7
|
import { useFetch } from "../hooks/useFetch";
|
|
8
8
|
|
|
9
|
+
type Network = "testnet" | "mainnet";
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Get the base URL for the network
|
|
11
13
|
* Uses relative URL in browser (for local dev), otherwise defaults to production
|
|
12
14
|
*/
|
|
13
|
-
const getBaseUrl = (): string => {
|
|
15
|
+
const getBaseUrl = (network: Network): string => {
|
|
14
16
|
if (typeof window !== "undefined") {
|
|
15
17
|
// In browser - use relative URL for local development
|
|
16
18
|
return "";
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
if (network === "testnet") {
|
|
22
|
+
return "https://testnet.adland.space";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (network === "mainnet") {
|
|
26
|
+
return "https://app.adland.space";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return "";
|
|
20
30
|
};
|
|
21
31
|
|
|
22
32
|
export interface AdProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -31,7 +41,7 @@ export interface AdProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
31
41
|
/**
|
|
32
42
|
* Network to use for tracking requests (currently only "testnet" is supported)
|
|
33
43
|
*/
|
|
34
|
-
network?:
|
|
44
|
+
network?: Network;
|
|
35
45
|
/**
|
|
36
46
|
* Optional base URL override. If not provided, uses relative URL in browser or production URL in SSR
|
|
37
47
|
*/
|
|
@@ -79,7 +89,7 @@ export function Ad({
|
|
|
79
89
|
enabled: !!owner && !!slotId,
|
|
80
90
|
},
|
|
81
91
|
);
|
|
82
|
-
const networkBaseUrl = baseUrl ?? getBaseUrl();
|
|
92
|
+
const networkBaseUrl = baseUrl ?? getBaseUrl(network);
|
|
83
93
|
|
|
84
94
|
const send = useCallback(
|
|
85
95
|
(type: "view" | "click") => {
|