@adtogether/web-sdk 0.1.26 → 0.2.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 +4 -0
- package/README.md +3 -3
- package/dist/{chunk-V3TR7YMJ.mjs → chunk-AFLHEFSH.mjs} +3 -0
- package/dist/index.js +3 -0
- package/dist/index.mjs +1 -1
- package/dist/react/index.js +3 -0
- package/dist/react/index.mjs +1 -1
- package/doc/dashboard.png +0 -0
- package/package.json +1 -1
- package/src/core/AdTogether.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 0.2.0
|
|
2
|
+
* **Security**: Implemented strict validation for required parameters and API keys.
|
|
3
|
+
* **Error Handling**: Improved error handling for invalid or missing App IDs across all platforms, ensuring graceful failures with descriptive logs.
|
|
4
|
+
|
|
1
5
|
## 0.1.25
|
|
2
6
|
* **Docs**: Standardized SDK documentation across all platforms.
|
|
3
7
|
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
This SDK allows web developers (React and Vanilla JS) to easily integrate AdTogether ads into their applications. By displaying ads from other community members, you earn **Ad Credits** that allow your own app's ads to be shown across the AdTogether network.
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
|
-
<img src="
|
|
25
|
+
<img src="https://adtogether.relaxsoftwareapps.com/dashboard.png" width="800" alt="Developer Dashboard">
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
28
|
### 🖼️ Visualizing the Experience
|
|
@@ -92,7 +92,7 @@ function MyApp() {
|
|
|
92
92
|
|
|
93
93
|
| Prop | Type | Default | Description |
|
|
94
94
|
|--------------------|-------------------------|-----------|-------------|
|
|
95
|
-
| `adUnitId` | `string` |
|
|
95
|
+
| `adUnitId` | `string` | `'default'` | Optional label for this ad placement (e.g. `'home_banner'`, `'sidebar'`). Used for analytics grouping only — not validated server-side. |
|
|
96
96
|
| `showCloseButton` | `boolean` | `false` | Show a dismissable close button overlay. |
|
|
97
97
|
| `onAdClosed` | `() => void` | — | Called when the user closes the ad. |
|
|
98
98
|
| `width` | `number \| string` | `'100%'` | Width of the ad element. |
|
|
@@ -137,7 +137,7 @@ function MyApp() {
|
|
|
137
137
|
|
|
138
138
|
| Prop | Type | Default | Description |
|
|
139
139
|
|--------------------|-------------------------|-----------|-------------|
|
|
140
|
-
| `adUnitId` | `string` |
|
|
140
|
+
| `adUnitId` | `string` | `'default'` | Optional label for this ad placement. Used for analytics grouping only. |
|
|
141
141
|
| `isOpen` | `boolean` | **required** | When `true`, the interstitial is displayed. |
|
|
142
142
|
| `onClose` | `() => void` | **required** | Called when the user closes the interstitial. |
|
|
143
143
|
| `closeDelay` | `number` | `3` | Seconds before the close button appears. A countdown is shown during this time. |
|
|
@@ -60,6 +60,9 @@ var AdTogether = class _AdTogether {
|
|
|
60
60
|
const ad = await response.json();
|
|
61
61
|
sdk.lastAdId = ad.id;
|
|
62
62
|
return ad;
|
|
63
|
+
} else if (response.status === 401 || response.status === 403) {
|
|
64
|
+
console.error("AdTogether Error: Invalid App ID. Please check your dashboard.");
|
|
65
|
+
throw new Error(`AdTogether Error: Invalid App ID. Status: ${response.status}`);
|
|
63
66
|
}
|
|
64
67
|
throw new Error(`Failed to fetch ad. Status: ${response.status}`);
|
|
65
68
|
} catch (err) {
|
package/dist/index.js
CHANGED
|
@@ -86,6 +86,9 @@ var AdTogether = class _AdTogether {
|
|
|
86
86
|
const ad = await response.json();
|
|
87
87
|
sdk.lastAdId = ad.id;
|
|
88
88
|
return ad;
|
|
89
|
+
} else if (response.status === 401 || response.status === 403) {
|
|
90
|
+
console.error("AdTogether Error: Invalid App ID. Please check your dashboard.");
|
|
91
|
+
throw new Error(`AdTogether Error: Invalid App ID. Status: ${response.status}`);
|
|
89
92
|
}
|
|
90
93
|
throw new Error(`Failed to fetch ad. Status: ${response.status}`);
|
|
91
94
|
} catch (err) {
|
package/dist/index.mjs
CHANGED
package/dist/react/index.js
CHANGED
|
@@ -90,6 +90,9 @@ var AdTogether = class _AdTogether {
|
|
|
90
90
|
const ad = await response.json();
|
|
91
91
|
sdk.lastAdId = ad.id;
|
|
92
92
|
return ad;
|
|
93
|
+
} else if (response.status === 401 || response.status === 403) {
|
|
94
|
+
console.error("AdTogether Error: Invalid App ID. Please check your dashboard.");
|
|
95
|
+
throw new Error(`AdTogether Error: Invalid App ID. Status: ${response.status}`);
|
|
93
96
|
}
|
|
94
97
|
throw new Error(`Failed to fetch ad. Status: ${response.status}`);
|
|
95
98
|
} catch (err) {
|
package/dist/react/index.mjs
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/core/AdTogether.ts
CHANGED
|
@@ -79,6 +79,9 @@ export class AdTogether {
|
|
|
79
79
|
const ad = await response.json();
|
|
80
80
|
sdk.lastAdId = ad.id;
|
|
81
81
|
return ad;
|
|
82
|
+
} else if (response.status === 401 || response.status === 403) {
|
|
83
|
+
console.error('AdTogether Error: Invalid App ID. Please check your dashboard.');
|
|
84
|
+
throw new Error(`AdTogether Error: Invalid App ID. Status: ${response.status}`);
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
throw new Error(`Failed to fetch ad. Status: ${response.status}`);
|