@adland/react 0.5.1 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @adland/react
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - af12999: ad variable
8
+
3
9
  ## 0.5.1
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adland/react",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,7 +22,7 @@
22
22
  "react-dom": "^18.0.0 || ^19.0.0"
23
23
  },
24
24
  "dependencies": {
25
- "@adland/data": "^0.4.0",
25
+ "@adland/data": "latest",
26
26
  "@farcaster/miniapp-sdk": "0.2.1",
27
27
  "@types/node": "^20",
28
28
  "@types/react": "^19.1.16",
@@ -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
- // SSR fallback - use production URL
19
- return "https://testnet.adland.space";
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?: "testnet";
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") => {