@adtogether/web-sdk 0.3.1 → 0.4.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 CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.4.0
2
+ * **Security**: Standardized `appId` as the primary identifier across all platforms.
3
+ * **Deprecation**: Formally deprecated `apiKey` in favor of `appId` to align with the AdTogether dashboard.
4
+ * **Sync**: Version parity (0.4.0) across all AdTogether SDKs.
5
+
6
+ ## 0.3.2
7
+ * **Docs**: Added official Model Context Protocol (MCP) server integration instructions to README.
8
+ * **Sync**: Version parity (0.3.2) across all AdTogether SDKs.
9
+
1
10
  ## 0.2.6
2
11
  * **Sync**: Version parity across all AdTogether SDKs.
3
12
 
@@ -59,3 +68,4 @@
59
68
  ## 0.1.0
60
69
 
61
70
  * Initial release of the AdTogether Web SDK.
71
+
@@ -12,7 +12,12 @@ var AdTogether = class _AdTogether {
12
12
  }
13
13
  static initialize(options) {
14
14
  const sdk = _AdTogether.shared;
15
- sdk.appId = options.apiKey || options.appId;
15
+ if (options.apiKey && !options.appId) {
16
+ console.warn('AdTogether: "apiKey" is deprecated. Please use "appId" instead.');
17
+ sdk.appId = options.apiKey;
18
+ } else {
19
+ sdk.appId = options.appId;
20
+ }
16
21
  if (options.bundleId) {
17
22
  sdk.bundleId = options.bundleId;
18
23
  } else if (typeof window !== "undefined") {
@@ -41,7 +46,7 @@ var AdTogether = class _AdTogether {
41
46
  }
42
47
  try {
43
48
  const sdk = _AdTogether.shared;
44
- let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&apiKey=${sdk.appId}`;
49
+ let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&appId=${sdk.appId}`;
45
50
  if (adType) {
46
51
  url += `&adType=${adType}`;
47
52
  }
@@ -113,7 +118,7 @@ var AdTogether = class _AdTogether {
113
118
  body: JSON.stringify({
114
119
  adId,
115
120
  token,
116
- apiKey: _AdTogether.shared.appId,
121
+ appId: _AdTogether.shared.appId,
117
122
  ..._AdTogether.shared.bundleId ? { bundleId: _AdTogether.shared.bundleId } : {},
118
123
  // Send platform and environment to match Flutter SDK
119
124
  platform: "web",
package/dist/index.d.mts CHANGED
@@ -9,7 +9,9 @@ interface AdModel {
9
9
  adType?: AdType;
10
10
  }
11
11
  interface AdTogetherOptions {
12
+ /** The unique identifier for your application. */
12
13
  appId?: string;
14
+ /** @deprecated Use appId instead */
13
15
  apiKey?: string;
14
16
  baseUrl?: string;
15
17
  bundleId?: string;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,9 @@ interface AdModel {
9
9
  adType?: AdType;
10
10
  }
11
11
  interface AdTogetherOptions {
12
+ /** The unique identifier for your application. */
12
13
  appId?: string;
14
+ /** @deprecated Use appId instead */
13
15
  apiKey?: string;
14
16
  baseUrl?: string;
15
17
  bundleId?: string;
package/dist/index.js CHANGED
@@ -38,7 +38,12 @@ var AdTogether = class _AdTogether {
38
38
  }
39
39
  static initialize(options) {
40
40
  const sdk = _AdTogether.shared;
41
- sdk.appId = options.apiKey || options.appId;
41
+ if (options.apiKey && !options.appId) {
42
+ console.warn('AdTogether: "apiKey" is deprecated. Please use "appId" instead.');
43
+ sdk.appId = options.apiKey;
44
+ } else {
45
+ sdk.appId = options.appId;
46
+ }
42
47
  if (options.bundleId) {
43
48
  sdk.bundleId = options.bundleId;
44
49
  } else if (typeof window !== "undefined") {
@@ -67,7 +72,7 @@ var AdTogether = class _AdTogether {
67
72
  }
68
73
  try {
69
74
  const sdk = _AdTogether.shared;
70
- let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&apiKey=${sdk.appId}`;
75
+ let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&appId=${sdk.appId}`;
71
76
  if (adType) {
72
77
  url += `&adType=${adType}`;
73
78
  }
@@ -139,7 +144,7 @@ var AdTogether = class _AdTogether {
139
144
  body: JSON.stringify({
140
145
  adId,
141
146
  token,
142
- apiKey: _AdTogether.shared.appId,
147
+ appId: _AdTogether.shared.appId,
143
148
  ..._AdTogether.shared.bundleId ? { bundleId: _AdTogether.shared.bundleId } : {},
144
149
  // Send platform and environment to match Flutter SDK
145
150
  platform: "web",
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AdTogether
3
- } from "./chunk-EGEGGY7K.mjs";
3
+ } from "./chunk-5UAFUJUK.mjs";
4
4
  export {
5
5
  AdTogether
6
6
  };
@@ -42,7 +42,12 @@ var AdTogether = class _AdTogether {
42
42
  }
43
43
  static initialize(options) {
44
44
  const sdk = _AdTogether.shared;
45
- sdk.appId = options.apiKey || options.appId;
45
+ if (options.apiKey && !options.appId) {
46
+ console.warn('AdTogether: "apiKey" is deprecated. Please use "appId" instead.');
47
+ sdk.appId = options.apiKey;
48
+ } else {
49
+ sdk.appId = options.appId;
50
+ }
46
51
  if (options.bundleId) {
47
52
  sdk.bundleId = options.bundleId;
48
53
  } else if (typeof window !== "undefined") {
@@ -71,7 +76,7 @@ var AdTogether = class _AdTogether {
71
76
  }
72
77
  try {
73
78
  const sdk = _AdTogether.shared;
74
- let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&apiKey=${sdk.appId}`;
79
+ let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&appId=${sdk.appId}`;
75
80
  if (adType) {
76
81
  url += `&adType=${adType}`;
77
82
  }
@@ -143,7 +148,7 @@ var AdTogether = class _AdTogether {
143
148
  body: JSON.stringify({
144
149
  adId,
145
150
  token,
146
- apiKey: _AdTogether.shared.appId,
151
+ appId: _AdTogether.shared.appId,
147
152
  ..._AdTogether.shared.bundleId ? { bundleId: _AdTogether.shared.bundleId } : {},
148
153
  // Send platform and environment to match Flutter SDK
149
154
  platform: "web",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AdTogether
3
- } from "../chunk-EGEGGY7K.mjs";
3
+ } from "../chunk-5UAFUJUK.mjs";
4
4
 
5
5
  // src/react/AdTogetherBanner.tsx
6
6
  import { useEffect, useRef, useState } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtogether/web-sdk",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "The official AdTogether Web SDK — reciprocal ad exchange to increase conversions and grow your audience.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,13 @@ export class AdTogether {
18
18
 
19
19
  static initialize(options: AdTogetherOptions) {
20
20
  const sdk = AdTogether.shared;
21
- sdk.appId = options.apiKey || options.appId;
21
+
22
+ if (options.apiKey && !options.appId) {
23
+ console.warn('AdTogether: "apiKey" is deprecated. Please use "appId" instead.');
24
+ sdk.appId = options.apiKey;
25
+ } else {
26
+ sdk.appId = options.appId;
27
+ }
22
28
 
23
29
  if (options.bundleId) {
24
30
  sdk.bundleId = options.bundleId;
@@ -57,7 +63,7 @@ export class AdTogether {
57
63
 
58
64
  try {
59
65
  const sdk = AdTogether.shared;
60
- let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&apiKey=${sdk.appId}`;
66
+ let url = `${sdk.baseUrl}/api/ads/serve?country=global&adUnitId=${adUnitId}&appId=${sdk.appId}`;
61
67
  if (adType) {
62
68
  url += `&adType=${adType}`;
63
69
  }
@@ -140,7 +146,7 @@ export class AdTogether {
140
146
  body: JSON.stringify({
141
147
  adId,
142
148
  token,
143
- apiKey: AdTogether.shared.appId,
149
+ appId: AdTogether.shared.appId,
144
150
  ...(AdTogether.shared.bundleId ? { bundleId: AdTogether.shared.bundleId } : {}),
145
151
  // Send platform and environment to match Flutter SDK
146
152
  platform: 'web',
package/src/core/types.ts CHANGED
@@ -11,10 +11,13 @@ export interface AdModel {
11
11
  }
12
12
 
13
13
  export interface AdTogetherOptions {
14
+ /** The unique identifier for your application. */
14
15
  appId?: string;
16
+ /** @deprecated Use appId instead */
15
17
  apiKey?: string;
16
18
  baseUrl?: string;
17
19
  bundleId?: string;
18
20
  /** Whether to show your own ads as fallback if no external ads are available. Defaults to true. */
19
21
  allowSelfAds?: boolean;
20
22
  }
23
+