@trillboards/ads-sdk 2.3.0 → 2.3.1

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/dist/index.d.mts CHANGED
@@ -35,6 +35,11 @@ interface ProgrammaticSettings {
35
35
  variant_name: string | null;
36
36
  min_interval_seconds?: number;
37
37
  sources?: VastSource[];
38
+ vast_waterfall?: {
39
+ enabled: boolean;
40
+ sources: VastSource[];
41
+ total_timeout_ms: number;
42
+ };
38
43
  auction_winner?: AuctionWinner | null;
39
44
  }
40
45
  interface VastSource {
@@ -42,7 +47,7 @@ interface VastSource {
42
47
  vast_url: string;
43
48
  priority: number;
44
49
  timeout_ms: number;
45
- enabled: boolean;
50
+ enabled?: boolean;
46
51
  }
47
52
  interface AuctionWinner {
48
53
  source: string;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,11 @@ interface ProgrammaticSettings {
35
35
  variant_name: string | null;
36
36
  min_interval_seconds?: number;
37
37
  sources?: VastSource[];
38
+ vast_waterfall?: {
39
+ enabled: boolean;
40
+ sources: VastSource[];
41
+ total_timeout_ms: number;
42
+ };
38
43
  auction_winner?: AuctionWinner | null;
39
44
  }
40
45
  interface VastSource {
@@ -42,7 +47,7 @@ interface VastSource {
42
47
  vast_url: string;
43
48
  priority: number;
44
49
  timeout_ms: number;
45
- enabled: boolean;
50
+ enabled?: boolean;
46
51
  }
47
52
  interface AuctionWinner {
48
53
  source: string;
package/dist/index.js CHANGED
@@ -320,10 +320,17 @@ var ApiClient = class {
320
320
  }
321
321
  const data = await response.json();
322
322
  const newEtag = response.headers.get("ETag");
323
+ const hbs = data.data?.header_bidding_settings;
323
324
  const result = {
324
325
  ads: data.data?.ads ?? [],
325
326
  settings: data.data?.settings ?? {},
326
- programmatic: data.data?.header_bidding_settings ?? null,
327
+ programmatic: hbs ? {
328
+ ...hbs,
329
+ sources: (hbs.vast_waterfall?.sources ?? []).map((s) => ({
330
+ ...s,
331
+ enabled: s.enabled !== false
332
+ }))
333
+ } : null,
327
334
  screenId: data.data?.screen_id ?? null,
328
335
  screenOrientation: data.data?.screen_orientation ?? null,
329
336
  screenDimensions: data.data?.screen_dimensions ?? null,
@@ -921,7 +928,7 @@ var WaterfallEngine = class {
921
928
  */
922
929
  getNextSource(sources) {
923
930
  if (!sources || sources.length === 0) return null;
924
- const sorted = [...sources].filter((s) => s.enabled).sort((a, b) => a.priority - b.priority || Math.random() - 0.5);
931
+ const sorted = [...sources].filter((s) => s.enabled !== false).sort((a, b) => a.priority - b.priority || Math.random() - 0.5);
925
932
  for (const source of sorted) {
926
933
  if (this.circuitBreaker.isAvailable(source.name)) {
927
934
  return { source, vastUrl: source.vast_url };
@@ -936,7 +943,7 @@ var WaterfallEngine = class {
936
943
  */
937
944
  getAvailableSources(sources) {
938
945
  if (!sources || sources.length === 0) return [];
939
- return sources.filter((s) => s.enabled && this.circuitBreaker.isAvailable(s.name)).sort((a, b) => a.priority - b.priority || Math.random() - 0.5).map((source) => ({ source, vastUrl: source.vast_url }));
946
+ return sources.filter((s) => s.enabled !== false && this.circuitBreaker.isAvailable(s.name)).sort((a, b) => a.priority - b.priority || Math.random() - 0.5).map((source) => ({ source, vastUrl: source.vast_url }));
940
947
  }
941
948
  /** Record a successful ad fill for a source. */
942
949
  recordSuccess(sourceName) {