@wavebirdai/api 0.1.0-beta.1 → 0.1.0-beta.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
@@ -1,22 +1,18 @@
1
1
  # wavebird publisher API
2
2
 
3
- `@wavebirdai/api` provides Banner/Native integration with the wavebird REST API and hosted renderer. Version `0.1.0-beta.1` is an opt-in prerelease. The pinned public GitHub `.4` and optional `.5` archives remain available; existing publishers keep their installed version unless they opt in. The established [`wavebird`](https://www.npmjs.com/package/wavebird) SDK remains separate.
3
+ `@wavebirdai/api` provides Banner, Native and Clip integration with the wavebird REST API and hosted renderer. The pinned public GitHub `.4` and optional `.5` archives, and npm `0.1.0-beta.1`, support Banner and Native. Existing publishers keep their installed version unless they opt in. The established [`wavebird`](https://www.npmjs.com/package/wavebird) SDK remains separate.
4
4
 
5
5
  ## Installation
6
6
 
7
- For the npm prerelease, run this in the existing Next.js app directory beside `package.json`:
7
+ Use the exact available package version and install command shown in Dashboard Overview for your saved project.
8
8
 
9
- ```sh
10
- npm install @wavebirdai/api@0.1.0-beta.1
11
- ```
12
-
13
- The public `.4` GitHub asset uses fixed sizes. Public `.5` adds optional responsive selection. This prerelease corrects the responsive generator example and package guidance; neither public archive is overwritten. A version change does not migrate an existing integration automatically.
9
+ The public `.4` GitHub asset uses fixed sizes. Public `.5` adds optional responsive selection. A version change does not migrate an existing integration automatically.
14
10
 
15
11
  The [full REST reference](https://wavebird.ai/api/reference/endpoints) remains available for integrations without this package.
16
12
 
17
13
  Both JavaScript and TypeScript use the same package and URL; there is no separate language package.
18
14
 
19
- For a saved single-format placement such as Banner-only After, pass `getFormat: () => "banner"` to `createPublisherAds` along with the matching same-origin placement endpoint. The package forwards that choice to the hosted renderer; the server still enforces the saved project and format. Omit `getFormat` when the saved placement intentionally lets wavebird choose among supported formats.
15
+ For a saved single-format placement such as Clip-only After, pass `getFormat: () => "clip"` to `createPublisherAds` along with the matching same-origin placement endpoint. The package forwards that choice to the hosted renderer; the server still enforces the saved project and format. Omit `getFormat` when the saved placement intentionally lets wavebird choose among supported formats.
20
16
 
21
17
  ## Next.js route generator
22
18
 
@@ -35,7 +31,7 @@ Set the server-only environment variables, including `WAVEBIRD_PUBLIC_ORIGINS` w
35
31
 
36
32
  `@wavebirdai/api/server` exports `createPublisherServer`. Configure it with server-only Project ID, Server Test or Live Key, preference signing secret, the publisher's real request authorization function, exact `publicOrigins`, and the saved project/placement values shown in the dashboard. The origin list is required. The package compares the browser Origin with a configured public origin whose host matches the route Host, even when Next.js or a proxy gives the route an internal URL. `localhost` and `127.0.0.1` are separate origins, and each port and scheme must match exactly; HTTP is accepted only for loopback. It returns authenticated `placementPOST`, `consentGET`, `consentPOST`, and `withGeneration` handlers, plus the server-only `reportGeneration(jobId, event)` method. The helper constructs the existing `/v1/placements`, `/v1/consent`, and `/v1/jobs/{id}/generation/{event}` requests; it does not introduce a new wavebird protocol. The wavebird API remains authoritative for saved scope, creative formats, duration, fallback, and financial classification.
37
33
 
38
- Responsive selection is opt-in with `responsiveSizeSelection: true`. The hosted browser adapter sends the measured reserved container size. The server chooses one of the saved `allowedSizes` that fits, or returns `no_fit` without an upstream placement request. A size can carry `formats: ["banner"]`, `formats: ["native"]`, or both; this annotation remains on the publisher server and is stripped from the wavebird request. A browser format preference is accepted only when it is among the saved `allowedFormats` and compatible with the selected size. Without opt-in, existing fixed-size requests retain their previous behavior. Reserve enough height for the selected creative and its controls; do not stretch the returned creative or place it over the model result.
34
+ Responsive selection is opt-in with `responsiveSizeSelection: true`. The hosted browser adapter sends the measured reserved container size. The server chooses one of the saved `allowedSizes` that fits, or returns `no_fit` without an upstream placement request. A size can carry `formats: ["banner"]`, `formats: ["native"]`, `formats: ["clip"]`, or an approved combination; this annotation remains on the publisher server and is stripped from the wavebird request. A browser format preference is accepted only when it is among the saved `allowedFormats` and compatible with the selected size. Without opt-in, existing fixed-size requests retain their previous behavior. Reserve enough height for the selected creative and its controls; do not stretch the returned creative or place it over the model result.
39
35
 
40
36
  Create the server helper when a request arrives, as the included Next.js examples do. This lets Next.js build a publisher app without loading its server-only Test key into the build process; the helper still validates configuration before handling traffic.
41
37
 
package/dist/server.d.ts CHANGED
@@ -13,11 +13,11 @@ export type PublisherServerOptions = {
13
13
  consentMode: "wavebird_consent" | "own_cmp";
14
14
  gdprApplies: boolean;
15
15
  publisher: { app_name: string; app_domain: string; categories: string[] };
16
- allowedFormats: Array<"banner" | "native">;
16
+ allowedFormats: Array<"banner" | "native" | "clip">;
17
17
  positionHint: "above" | "below" | "sidebar" | "between";
18
18
  maxWidth: number;
19
19
  maxHeight: number;
20
- allowedSizes: Array<{ width: number; height: number; formats?: Array<"banner" | "native"> }>;
20
+ allowedSizes: Array<{ width: number; height: number; formats?: Array<"banner" | "native" | "clip"> }>;
21
21
  responsiveSizeSelection?: boolean;
22
22
  bidfloor?: number;
23
23
  bidfloorCurrency?: string;
package/dist/server.js CHANGED
@@ -21,7 +21,7 @@ function normalizeOptions(options) {
21
21
  if (!ID.test(options.surfaceId || "") || !PLACEMENT_KEY.test(options.placementKey || "")) throw new Error("publisher_placement_invalid");
22
22
  if (!["before", "during", "after"].includes(options.timing)) throw new Error("publisher_timing_invalid");
23
23
  if (!["wavebird_consent", "own_cmp"].includes(options.consentMode)) throw new Error("publisher_consent_mode_invalid");
24
- if (!Array.isArray(options.allowedFormats) || options.allowedFormats.length === 0 || options.allowedFormats.some(value => !["banner", "native"].includes(value))) throw new Error("publisher_formats_invalid");
24
+ if (!Array.isArray(options.allowedFormats) || options.allowedFormats.length === 0 || options.allowedFormats.some(value => !["banner", "native", "clip"].includes(value))) throw new Error("publisher_formats_invalid");
25
25
  if (!["above", "below", "sidebar", "between"].includes(options.positionHint)) throw new Error("publisher_position_invalid");
26
26
  if (!Number.isSafeInteger(options.maxWidth) || options.maxWidth < 1 || !Number.isSafeInteger(options.maxHeight) || options.maxHeight < 1) throw new Error("publisher_envelope_invalid");
27
27
  if (!Array.isArray(options.allowedSizes) || options.allowedSizes.length === 0 || options.allowedSizes.some(size => !Number.isSafeInteger(size.width) || !Number.isSafeInteger(size.height) || size.width < 1 || size.height < 1 || size.width > options.maxWidth || size.height > options.maxHeight ||
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@wavebirdai/api",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "Banner/Native publisher integration for the wavebird API",
6
+ "description": "Banner, Native, and Clip publisher integration for the wavebird API",
7
7
  "license": "MIT",
8
8
  "repository": { "type": "git", "url": "https://github.com/wavebird-ai/api" },
9
9
  "engines": { "node": ">=20" },